@@ -40,6 +40,7 @@ static volatile bool time_to_stop = false;
40
40
static bool do_create_slot = false;
41
41
static bool slot_exists_ok = false;
42
42
static bool do_drop_slot = false;
43
+ static bool do_sync = true;
43
44
static bool synchronous = false;
44
45
static char * replication_slot = NULL ;
45
46
static XLogRecPtr endpos = InvalidXLogRecPtr ;
@@ -81,6 +82,7 @@ usage(void)
81
82
printf (_ (" -E, --endpos=LSN exit after receiving the specified LSN\n" ));
82
83
printf (_ (" --if-not-exists do not error if slot already exists when creating a slot\n" ));
83
84
printf (_ (" -n, --no-loop do not loop on connection lost\n" ));
85
+ printf (_ (" --no-sync do not wait for changes to be written safely to disk\n" ));
84
86
printf (_ (" -s, --status-interval=SECS\n"
85
87
" time between status packets sent to server (default: %d)\n" ), (standby_message_timeout / 1000 ));
86
88
printf (_ (" -S, --slot=SLOTNAME replication slot to use\n" ));
@@ -425,7 +427,7 @@ StreamLog(void)
425
427
stream .stop_socket = PGINVALID_SOCKET ;
426
428
stream .standby_message_timeout = standby_message_timeout ;
427
429
stream .synchronous = synchronous ;
428
- stream .do_sync = true ;
430
+ stream .do_sync = do_sync ;
429
431
stream .mark_done = false;
430
432
stream .walmethod = CreateWalDirectoryMethod (basedir , compresslevel ,
431
433
stream .do_sync );
@@ -487,6 +489,7 @@ main(int argc, char **argv)
487
489
{"drop-slot" , no_argument , NULL , 2 },
488
490
{"if-not-exists" , no_argument , NULL , 3 },
489
491
{"synchronous" , no_argument , NULL , 4 },
492
+ {"no-sync" , no_argument , NULL , 5 },
490
493
{NULL , 0 , NULL , 0 }
491
494
};
492
495
@@ -595,6 +598,9 @@ main(int argc, char **argv)
595
598
case 4 :
596
599
synchronous = true;
597
600
break ;
601
+ case 5 :
602
+ do_sync = false;
603
+ break ;
598
604
default :
599
605
600
606
/*
@@ -637,6 +643,14 @@ main(int argc, char **argv)
637
643
exit (1 );
638
644
}
639
645
646
+ if (synchronous && !do_sync )
647
+ {
648
+ fprintf (stderr , _ ("%s: cannot use --synchronous together with --no-sync\n" ), progname );
649
+ fprintf (stderr , _ ("Try \"%s --help\" for more information.\n" ),
650
+ progname );
651
+ exit (1 );
652
+ }
653
+
640
654
/*
641
655
* Required arguments
642
656
*/
0 commit comments