@ -56,6 +56,7 @@ char *connstr_source = NULL;
bool debug = false ;
bool showprogress = false ;
bool dry_run = false ;
bool do_sync = true ;
/* Target history */
TimeLineHistoryEntry * targetHistory ;
@ -71,6 +72,8 @@ usage(const char *progname)
printf ( _ ( " --source-pgdata=DIRECTORY source data directory to synchronize with \n " ) ) ;
printf ( _ ( " --source-server=CONNSTR source server to synchronize with \n " ) ) ;
printf ( _ ( " -n, --dry-run stop before modifying anything \n " ) ) ;
printf ( _ ( " -N, --no-sync do not wait for changes to be written \n " ) ) ;
printf ( _ ( " safely to disk \n " ) ) ;
printf ( _ ( " -P, --progress write progress messages \n " ) ) ;
printf ( _ ( " --debug write a lot of debug messages \n " ) ) ;
printf ( _ ( " -V, --version output version information, then exit \n " ) ) ;
@ -89,6 +92,7 @@ main(int argc, char **argv)
{ " source-server " , required_argument , NULL , 2 } ,
{ " version " , no_argument , NULL , ' V ' } ,
{ " dry-run " , no_argument , NULL , ' n ' } ,
{ " no-sync " , no_argument , NULL , ' N ' } ,
{ " progress " , no_argument , NULL , ' P ' } ,
{ " debug " , no_argument , NULL , 3 } ,
{ NULL , 0 , NULL , 0 }
@ -125,7 +129,7 @@ main(int argc, char **argv)
}
}
while ( ( c = getopt_long ( argc , argv , " D:nP " , long_options , & option_index ) ) ! = - 1 )
while ( ( c = getopt_long ( argc , argv , " D:nN P " , long_options , & option_index ) ) ! = - 1 )
{
switch ( c )
{
@ -141,6 +145,10 @@ main(int argc, char **argv)
dry_run = true ;
break ;
case ' N ' :
do_sync = false ;
break ;
case 3 :
debug = true ;
break ;
@ -709,7 +717,7 @@ updateControlFile(ControlFileData *ControlFile)
static void
syncTargetDirectory ( const char * argv0 )
{
if ( dry_run )
if ( ! do_sync | | dry_run )
return ;
fsync_pgdata ( datadir_target , progname , PG_VERSION_NUM ) ;