@@ -122,6 +122,7 @@ static parray *datname_include_list = NULL;
122122/* arrays for --exclude-path's */
123123static parray * exclude_absolute_paths_list = NULL ;
124124static parray * exclude_relative_paths_list = NULL ;
125+ static char * waldir_path = NULL ;
125126
126127/* checkdb options */
127128bool need_amcheck = false;
@@ -238,6 +239,7 @@ static ConfigOption cmd_options[] =
238239 { 's' , 160 , "primary-conninfo" , & primary_conninfo , SOURCE_CMD_STRICT },
239240 { 's' , 'S' , "primary-slot-name" ,& replication_slot , SOURCE_CMD_STRICT },
240241 { 'f' , 'I' , "incremental-mode" , opt_incr_restore_mode , SOURCE_CMD_STRICT },
242+ { 's' , 'X' , "waldir" , & waldir_path , SOURCE_CMD_STRICT },
241243 /* checkdb options */
242244 { 'b' , 195 , "amcheck" , & need_amcheck , SOURCE_CMD_STRICT },
243245 { 'b' , 196 , "heapallindexed" , & heapallindexed , SOURCE_CMD_STRICT },
@@ -754,6 +756,21 @@ main(int argc, char *argv[])
754756 restore_params -> partial_restore_type = INCLUDE ;
755757 restore_params -> partial_db_list = datname_include_list ;
756758 }
759+
760+ if (waldir_path )
761+ {
762+ /* clean up xlog directory name, check it's absolute */
763+ canonicalize_path (waldir_path );
764+ if (!is_absolute_path (waldir_path ))
765+ {
766+ elog (ERROR , "WAL directory location must be an absolute path" );
767+ }
768+ if (strlen (waldir_path ) > MAXPGPATH )
769+ elog (ERROR , "Value specified to --waldir is too long" );
770+
771+ }
772+ restore_params -> waldir = waldir_path ;
773+
757774 }
758775
759776 /*
0 commit comments