@@ -46,7 +46,7 @@ struct CreateSubscriberOptions
46
46
SimpleStringList replslot_names ; /* list of replication slot names */
47
47
int recovery_timeout ; /* stop recovery after this time */
48
48
bool all_dbs ; /* all option */
49
- SimpleStringList objecttypes_to_remove ; /* list of object types to remove */
49
+ SimpleStringList objecttypes_to_clean ; /* list of object types to cleanup */
50
50
};
51
51
52
52
/* per-database publication/subscription info */
@@ -71,8 +71,8 @@ struct LogicalRepInfos
71
71
{
72
72
struct LogicalRepInfo * dbinfo ;
73
73
bool two_phase ; /* enable-two-phase option */
74
- bits32 objecttypes_to_remove ; /* flags indicating which object types
75
- * to remove on subscriber */
74
+ bits32 objecttypes_to_clean ; /* flags indicating which object types
75
+ * to clean up on subscriber */
76
76
};
77
77
78
78
static void cleanup_objects_atexit (void );
@@ -253,13 +253,13 @@ usage(void)
253
253
printf (_ (" -n, --dry-run dry run, just show what would be done\n" ));
254
254
printf (_ (" -p, --subscriber-port=PORT subscriber port number (default %s)\n" ), DEFAULT_SUB_PORT );
255
255
printf (_ (" -P, --publisher-server=CONNSTR publisher connection string\n" ));
256
- printf (_ (" -R, --remove=OBJECTTYPE remove all objects of the specified type from specified\n"
257
- " databases on the subscriber; accepts: \"%s\"\n" ), "publications" );
258
256
printf (_ (" -s, --socketdir=DIR socket directory to use (default current dir.)\n" ));
259
257
printf (_ (" -t, --recovery-timeout=SECS seconds to wait for recovery to end\n" ));
260
258
printf (_ (" -T, --enable-two-phase enable two-phase commit for all subscriptions\n" ));
261
259
printf (_ (" -U, --subscriber-username=NAME user name for subscriber connection\n" ));
262
260
printf (_ (" -v, --verbose output verbose messages\n" ));
261
+ printf (_ (" --clean=OBJECTTYPE drop all objects of the specified type from specified\n"
262
+ " databases on the subscriber; accepts: \"%s\"\n" ), "publications" );
263
263
printf (_ (" --config-file=FILENAME use specified main server configuration\n"
264
264
" file when running target cluster\n" ));
265
265
printf (_ (" --publication=NAME publication name\n" ));
@@ -1730,7 +1730,7 @@ static void
1730
1730
check_and_drop_publications (PGconn * conn , struct LogicalRepInfo * dbinfo )
1731
1731
{
1732
1732
PGresult * res ;
1733
- bool drop_all_pubs = dbinfos .objecttypes_to_remove & OBJECTTYPE_PUBLICATIONS ;
1733
+ bool drop_all_pubs = dbinfos .objecttypes_to_clean & OBJECTTYPE_PUBLICATIONS ;
1734
1734
1735
1735
Assert (conn != NULL );
1736
1736
@@ -2026,7 +2026,6 @@ main(int argc, char **argv)
2026
2026
{"dry-run" , no_argument , NULL , 'n' },
2027
2027
{"subscriber-port" , required_argument , NULL , 'p' },
2028
2028
{"publisher-server" , required_argument , NULL , 'P' },
2029
- {"remove" , required_argument , NULL , 'R' },
2030
2029
{"socketdir" , required_argument , NULL , 's' },
2031
2030
{"recovery-timeout" , required_argument , NULL , 't' },
2032
2031
{"enable-two-phase" , no_argument , NULL , 'T' },
@@ -2038,6 +2037,7 @@ main(int argc, char **argv)
2038
2037
{"publication" , required_argument , NULL , 2 },
2039
2038
{"replication-slot" , required_argument , NULL , 3 },
2040
2039
{"subscription" , required_argument , NULL , 4 },
2040
+ {"clean" , required_argument , NULL , 5 },
2041
2041
{NULL , 0 , NULL , 0 }
2042
2042
};
2043
2043
@@ -2109,7 +2109,7 @@ main(int argc, char **argv)
2109
2109
2110
2110
get_restricted_token ();
2111
2111
2112
- while ((c = getopt_long (argc , argv , "ad:D:np:P:R: s:t:TU:v" ,
2112
+ while ((c = getopt_long (argc , argv , "ad:D:np:P:s:t:TU:v" ,
2113
2113
long_options , & option_index )) != -1 )
2114
2114
{
2115
2115
switch (c )
@@ -2139,12 +2139,6 @@ main(int argc, char **argv)
2139
2139
case 'P' :
2140
2140
opt .pub_conninfo_str = pg_strdup (optarg );
2141
2141
break ;
2142
- case 'R' :
2143
- if (!simple_string_list_member (& opt .objecttypes_to_remove , optarg ))
2144
- simple_string_list_append (& opt .objecttypes_to_remove , optarg );
2145
- else
2146
- pg_fatal ("object type \"%s\" specified more than once for -R/--remove" , optarg );
2147
- break ;
2148
2142
case 's' :
2149
2143
opt .socket_dir = pg_strdup (optarg );
2150
2144
canonicalize_path (opt .socket_dir );
@@ -2191,6 +2185,12 @@ main(int argc, char **argv)
2191
2185
else
2192
2186
pg_fatal ("subscription \"%s\" specified more than once for --subscription" , optarg );
2193
2187
break ;
2188
+ case 5 :
2189
+ if (!simple_string_list_member (& opt .objecttypes_to_clean , optarg ))
2190
+ simple_string_list_append (& opt .objecttypes_to_clean , optarg );
2191
+ else
2192
+ pg_fatal ("object type \"%s\" specified more than once for --clean" , optarg );
2193
+ break ;
2194
2194
default :
2195
2195
/* getopt_long already emitted a complaint */
2196
2196
pg_log_error_hint ("Try \"%s --help\" for more information." , progname );
@@ -2334,13 +2334,13 @@ main(int argc, char **argv)
2334
2334
}
2335
2335
2336
2336
/* Verify the object types specified for removal from the subscriber */
2337
- for (SimpleStringListCell * cell = opt .objecttypes_to_remove .head ; cell ; cell = cell -> next )
2337
+ for (SimpleStringListCell * cell = opt .objecttypes_to_clean .head ; cell ; cell = cell -> next )
2338
2338
{
2339
2339
if (pg_strcasecmp (cell -> val , "publications" ) == 0 )
2340
- dbinfos .objecttypes_to_remove |= OBJECTTYPE_PUBLICATIONS ;
2340
+ dbinfos .objecttypes_to_clean |= OBJECTTYPE_PUBLICATIONS ;
2341
2341
else
2342
2342
{
2343
- pg_log_error ("invalid object type \"%s\" specified for -R/--remove " , cell -> val );
2343
+ pg_log_error ("invalid object type \"%s\" specified for --clean " , cell -> val );
2344
2344
pg_log_error_hint ("The valid value is: \"%s\"" , "publications" );
2345
2345
exit (1 );
2346
2346
}
0 commit comments