diff options
Diffstat (limited to 'src/bin/pg_upgrade/pg_upgrade.c')
-rw-r--r-- | src/bin/pg_upgrade/pg_upgrade.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index ce0ce04a3e9..551e6cc5f8e 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -272,13 +272,13 @@ static void prepare_new_databases(void) { /* - * We set autovacuum_freeze_max_age to its maximum value so autovacuum - * does not launch here and delete clog files, before the frozen xids are - * set. + * Before we restore anything, set frozenxids of initdb-created tables. */ - set_frozenxids(false); + /* + * Now restore global objects (roles and tablespaces). + */ prep_status("Restoring global objects in the new cluster"); /* @@ -496,14 +496,25 @@ copy_clog_xlog_xid(void) /* * set_frozenxids() * - * We have frozen all xids, so set datfrozenxid, relfrozenxid, and - * relminmxid to be the old cluster's xid counter, which we just set - * in the new cluster. User-table frozenxid and minmxid values will - * be set by pg_dump --binary-upgrade, but objects not set by the pg_dump - * must have proper frozen counters. + * This is called on the new cluster before we restore anything, with + * minmxid_only = false. Its purpose is to ensure that all initdb-created + * vacuumable tables have relfrozenxid/relminmxid matching the old cluster's + * xid/mxid counters. We also initialize the datfrozenxid/datminmxid of the + * built-in databases to match. + * + * As we create user tables later, their relfrozenxid/relminmxid fields will + * be restored properly by the binary-upgrade restore script. Likewise for + * user-database datfrozenxid/datminmxid. However, if we're upgrading from a + * pre-9.3 database, which does not store per-table or per-DB minmxid, then + * the relminmxid/datminmxid values filled in by the restore script will just + * be zeroes. + * + * Hence, with a pre-9.3 source database, a second call occurs after + * everything is restored, with minmxid_only = true. This pass will + * initialize all tables and databases, both those made by initdb and user + * objects, with the desired minmxid value. frozenxid values are left alone. */ -static -void +static void set_frozenxids(bool minmxid_only) { int dbnum; |