Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f74827

Browse files
committed
pg_upgrade: remove pg_multixact files left by initdb
This fixes a bug that caused vacuum to fail when the '0000' files leftby initdb were accessed as part of vacuum's cleanup of old pg_multixactfiles.Backpatch through 9.3
1 parenta87a7dc commit0f74827

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,22 +363,35 @@ create_new_objects(void)
363363
}
364364

365365
/*
366-
* Delete the given subdirectory contents from the new cluster, and copy the
367-
* files from the old cluster into it.
366+
* Delete the given subdirectory contents from the new cluster
368367
*/
369368
staticvoid
370-
copy_subdir_files(char*subdir)
369+
remove_new_subdir(char*subdir,boolrmtopdir)
371370
{
372-
charold_path[MAXPGPATH];
373371
charnew_path[MAXPGPATH];
374372

375373
prep_status("Deleting files from new %s",subdir);
376374

377-
snprintf(old_path,sizeof(old_path),"%s/%s",old_cluster.pgdata,subdir);
378375
snprintf(new_path,sizeof(new_path),"%s/%s",new_cluster.pgdata,subdir);
379-
if (!rmtree(new_path,true))
376+
if (!rmtree(new_path,rmtopdir))
380377
pg_fatal("could not delete directory \"%s\"\n",new_path);
378+
381379
check_ok();
380+
}
381+
382+
/*
383+
* Copy the files from the old cluster into it
384+
*/
385+
staticvoid
386+
copy_subdir_files(char*subdir)
387+
{
388+
charold_path[MAXPGPATH];
389+
charnew_path[MAXPGPATH];
390+
391+
remove_new_subdir(subdir, true);
392+
393+
snprintf(old_path,sizeof(old_path),"%s/%s",old_cluster.pgdata,subdir);
394+
snprintf(new_path,sizeof(new_path),"%s/%s",new_cluster.pgdata,subdir);
382395

383396
prep_status("Copying old %s to new server",subdir);
384397

@@ -419,6 +432,7 @@ copy_clog_xlog_xid(void)
419432
{
420433
copy_subdir_files("pg_multixact/offsets");
421434
copy_subdir_files("pg_multixact/members");
435+
422436
prep_status("Setting next multixact ID and offset for new cluster");
423437

424438
/*
@@ -436,6 +450,13 @@ copy_clog_xlog_xid(void)
436450
}
437451
elseif (new_cluster.controldata.cat_ver >=MULTIXACT_FORMATCHANGE_CAT_VER)
438452
{
453+
/*
454+
* Remove files created by initdb that no longer match the
455+
* new multi-xid value.
456+
*/
457+
remove_new_subdir("pg_multixact/offsets", false);
458+
remove_new_subdir("pg_multixact/members", false);
459+
439460
prep_status("Setting oldest multixact ID on new cluster");
440461

441462
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp