Skip to content

Commit 59251c3

Browse files
committed
do not fsync WAL segments during streaming
1 parent 288c122 commit 59251c3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backup.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,8 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno)
23942394
/*
23952395
* Stop WAL streaming if current 'xlogpos' exceeds 'stop_backup_lsn', which is
23962396
* set by pg_stop_backup().
2397+
*
2398+
* TODO: Add streamed file to file list when segment is finished
23972399
*/
23982400
static bool
23992401
stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
@@ -2499,7 +2501,11 @@ StreamLog(void *arg)
24992501
ctl.sysidentifier = NULL;
25002502

25012503
#if PG_VERSION_NUM >= 100000
2502-
ctl.walmethod = CreateWalDirectoryMethod(stream_arg->basedir, 0, true);
2504+
ctl.walmethod = CreateWalDirectoryMethod(
2505+
stream_arg->basedir,
2506+
// (instance_config.compress_alg == NONE_COMPRESS) ? 0 : instance_config.compress_level,
2507+
0,
2508+
true);
25032509
ctl.replication_slot = replication_slot;
25042510
ctl.stop_socket = PGINVALID_SOCKET;
25052511
#if PG_VERSION_NUM >= 100000 && PG_VERSION_NUM < 110000
@@ -2509,6 +2515,8 @@ StreamLog(void *arg)
25092515
ctl.basedir = (char *) stream_arg->basedir;
25102516
#endif
25112517

2518+
ctl.do_sync = false; /* We sync all files at the end of backup */
2519+
// ctl.mark_done /* for future use in s3 */
25122520
ctl.stream_stop = stop_streaming;
25132521
ctl.standby_message_timeout = standby_message_timeout;
25142522
ctl.partial_suffix = NULL;

0 commit comments

Comments
 (0)