1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

pg_upgrade: preserve database and relation minmxid values

Also set these values for pre-9.3 old clusters that don't have values to
preserve.

Analysis by Alvaro

Backpatch through 9.3
This commit is contained in:
Bruce Momjian
2014-07-02 15:29:38 -04:00
parent a36a8fa376
commit a61daa14d5
5 changed files with 171 additions and 83 deletions

View File

@ -203,10 +203,11 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
/*
* Using autovacuum=off disables cleanup vacuum and analyze, but freeze
* vacuums can still happen, so we set autovacuum_freeze_max_age to its
* maximum. We assume all datfrozenxid and relfrozen values are less than
* a gap of 2000000000 from the current xid counter, so autovacuum will
* not touch them.
* vacuums can still happen, so we set autovacuum_freeze_max_age and
* autovacuum_multixact_freeze_max_age to their maximums. We assume all
* datfrozenxid, relfrozenxid, and relminmxid values are less than a gap
* of 2000000000 from the current xid counter, so autovacuum will not
* touch them.
*
* Turn off durability requirements to improve object creation speed, and
* we only modify the new cluster, so only use it there. If there is a
@ -214,11 +215,13 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
* win on ext4.
*/
snprintf(cmd, sizeof(cmd),
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s\" start",
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s%s\" start",
cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
(cluster->controldata.cat_ver >=
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? " -b" :
" -c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
(GET_MAJOR_VERSION(cluster->major_version) >= 903) ?
" -c autovacuum_multixact_freeze_max_age=2000000000" : "",
(cluster == &new_cluster) ?
" -c synchronous_commit=off -c fsync=off -c full_page_writes=off" : "",
cluster->pgopts ? cluster->pgopts : "", socket_string);