@@ -311,23 +311,26 @@ create_new_objects(void)
311311 uninstall_support_functions_from_new_cluster ();
312312}
313313
314-
314+ /*
315+ * Delete the given subdirectory contents from the new cluster, and copy the
316+ * files from the old cluster into it.
317+ */
315318static void
316- copy_clog_xlog_xid ( void )
319+ copy_subdir_files ( char * subdir )
317320{
318- char old_clog_path [MAXPGPATH ];
319- char new_clog_path [MAXPGPATH ];
321+ char old_path [MAXPGPATH ];
322+ char new_path [MAXPGPATH ];
320323
321- /* copy old commit logs to new data dir */
322- prep_status ("Deleting new commit clogs" );
324+ prep_status ("Deleting files from new %s" , subdir );
323325
324- snprintf (old_clog_path , sizeof (old_clog_path ), "%s/pg_clog " , old_cluster .pgdata );
325- snprintf (new_clog_path , sizeof (new_clog_path ), "%s/pg_clog " , new_cluster .pgdata );
326- if (!rmtree (new_clog_path , true))
327- pg_log (PG_FATAL , "could not delete directory \"%s\"\n" , new_clog_path );
326+ snprintf (old_path , sizeof (old_path ), "%s/%s " , old_cluster .pgdata , subdir );
327+ snprintf (new_path , sizeof (new_path ), "%s/%s " , new_cluster .pgdata , subdir );
328+ if (!rmtree (new_path , true))
329+ pg_log (PG_FATAL , "could not delete directory \"%s\"\n" , new_path );
328330 check_ok ();
329331
330- prep_status ("Copying old commit clogs to new server" );
332+ prep_status ("Copying old %s to new server" , subdir );
333+
331334 exec_prog (true, false, UTILITY_LOG_FILE ,
332335#ifndef WIN32
333336 SYSTEMQUOTE "%s \"%s\" \"%s\" >> \"%s\" 2>&1" SYSTEMQUOTE ,
@@ -337,8 +340,16 @@ copy_clog_xlog_xid(void)
337340 SYSTEMQUOTE "%s \"%s\" \"%s\\\" >> \"%s\" 2>&1" SYSTEMQUOTE ,
338341 "xcopy /e /y /q /r" ,
339342#endif
340- old_clog_path , new_clog_path , UTILITY_LOG_FILE );
343+ old_path , new_path , UTILITY_LOG_FILE );
344+
341345 check_ok ();
346+ }
347+
348+ static void
349+ copy_clog_xlog_xid (void )
350+ {
351+ /* copy old commit logs to new data dir */
352+ copy_subdir_files ("pg_clog" );
342353
343354 /* set the next transaction id of the new cluster */
344355 prep_status ("Setting next transaction ID for new cluster" );
0 commit comments