pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Delay fsyncs of pg_basebackup until the end of backup
4+ messages / 1 participants
[nested] [flat]

* pgsql: Delay fsyncs of pg_basebackup until the end of backup
@ 2019-09-04 04:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2019-09-04 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Delay fsyncs of pg_basebackup until the end of backup

Since the addition of fsync requests in bc34223 to make base backup data
consistent on disk once pg_basebackup finishes, each tablespace tar file
is individually flushed once completed, with an additional flush of the
parent directory when the base backup finishes.  While holding a
connection to the server, a fsync request taking a long time may cause a
failure of the base backup, which is annoying for any integration.  A
recent example of breakage can involve tcp_user_timeout, but
wal_sender_timeout can cause similar problems.

While reviewing the code, there was a second issue causing too many
fsync requests to be done for the same WAL data.  As recursive fsyncs
are done at the end of the backup for both the plain and tar formats
from the base target directory where everything is written, it is fine
to disable fsyncs when fetching or streaming WAL.

Reported-by: Ryohei Takahashi
Author: Michael Paquier
Reviewed-by: Ryohei Takahashi
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com
Backpatch-through: 10

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/522baf14847a7e4cc97c49c7b1c28d21bc33921f

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Delay fsyncs of pg_basebackup until the end of backup
@ 2019-09-04 04:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2019-09-04 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Delay fsyncs of pg_basebackup until the end of backup

Since the addition of fsync requests in bc34223 to make base backup data
consistent on disk once pg_basebackup finishes, each tablespace tar file
is individually flushed once completed, with an additional flush of the
parent directory when the base backup finishes.  While holding a
connection to the server, a fsync request taking a long time may cause a
failure of the base backup, which is annoying for any integration.  A
recent example of breakage can involve tcp_user_timeout, but
wal_sender_timeout can cause similar problems.

While reviewing the code, there was a second issue causing too many
fsync requests to be done for the same WAL data.  As recursive fsyncs
are done at the end of the backup for both the plain and tar formats
from the base target directory where everything is written, it is fine
to disable fsyncs when fetching or streaming WAL.

Reported-by: Ryohei Takahashi
Author: Michael Paquier
Reviewed-by: Ryohei Takahashi
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com
Backpatch-through: 10

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/64eb426afc344600d7d4b9944ed7c3be7ed1812d

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Delay fsyncs of pg_basebackup until the end of backup
@ 2019-09-04 04:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2019-09-04 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Delay fsyncs of pg_basebackup until the end of backup

Since the addition of fsync requests in bc34223 to make base backup data
consistent on disk once pg_basebackup finishes, each tablespace tar file
is individually flushed once completed, with an additional flush of the
parent directory when the base backup finishes.  While holding a
connection to the server, a fsync request taking a long time may cause a
failure of the base backup, which is annoying for any integration.  A
recent example of breakage can involve tcp_user_timeout, but
wal_sender_timeout can cause similar problems.

While reviewing the code, there was a second issue causing too many
fsync requests to be done for the same WAL data.  As recursive fsyncs
are done at the end of the backup for both the plain and tar formats
from the base target directory where everything is written, it is fine
to disable fsyncs when fetching or streaming WAL.

Reported-by: Ryohei Takahashi
Author: Michael Paquier
Reviewed-by: Ryohei Takahashi
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com
Backpatch-through: 10

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/996c92b27dfe5e36702f3a5a06c883b76be98705

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Delay fsyncs of pg_basebackup until the end of backup
@ 2019-09-04 04:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2019-09-04 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Delay fsyncs of pg_basebackup until the end of backup

Since the addition of fsync requests in bc34223 to make base backup data
consistent on disk once pg_basebackup finishes, each tablespace tar file
is individually flushed once completed, with an additional flush of the
parent directory when the base backup finishes.  While holding a
connection to the server, a fsync request taking a long time may cause a
failure of the base backup, which is annoying for any integration.  A
recent example of breakage can involve tcp_user_timeout, but
wal_sender_timeout can cause similar problems.

While reviewing the code, there was a second issue causing too many
fsync requests to be done for the same WAL data.  As recursive fsyncs
are done at the end of the backup for both the plain and tar formats
from the base target directory where everything is written, it is fine
to disable fsyncs when fetching or streaming WAL.

Reported-by: Ryohei Takahashi
Author: Michael Paquier
Reviewed-by: Ryohei Takahashi
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com
Backpatch-through: 10

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dbbae33bcd3357f4dd880f9214c18e0ed2c92c49

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-09-04 04:26 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 04:26 pgsql: Delay fsyncs of pg_basebackup until the end of backup Michael Paquier <michael@paquier.xyz>
2019-09-04 04:26 pgsql: Delay fsyncs of pg_basebackup until the end of backup Michael Paquier <michael@paquier.xyz>
2019-09-04 04:26 pgsql: Delay fsyncs of pg_basebackup until the end of backup Michael Paquier <michael@paquier.xyz>
2019-09-04 04:26 pgsql: Delay fsyncs of pg_basebackup until the end of backup Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox