postgres.git / summary / log / commit / refs
commit 0efdbd323e53091779ddc3f048123214612a76f9
Author: Bruce Momjian <bruce@momjian.us>
Date: Tue Jun 20 17:20:02 2017 +0000
First released in: 10.0, 9.2.22, 9.3.18, 9.4.13, 9.5.8, 9.6.4
pg_upgrade: start/stop new server after pg_resetwal
When commit 0f33a719fdbb5d8c43839ea0d2c90cd03e2af2d2 removed the
instructions to start/stop the new cluster before running rsync, it was
now possible for pg_resetwal/pg_resetxlog to leave the final WAL record
at wal_level=minimum, preventing upgraded standby servers from
reconnecting.
This patch fixes that by having pg_upgrade unconditionally start/stop
the new cluster after pg_resetwal/pg_resetxlog has run.
Backpatch through 9.2 since, though the instructions were added in PG
9.5, they worked all the way back to 9.2.
Discussion: https://postgr.es/m/20170620171844.GC24975@momjian.us
Backpatch-through: 9.2
src/bin/pg_upgrade/check.c | 16 +++++++++++-----
src/bin/pg_upgrade/pg_upgrade.c | 2 +-
src/bin/pg_upgrade/pg_upgrade.h | 2 +-
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index a3ee116a8cd..a26e55ca7fb 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -164,15 +164,21 @@ report_clusters_compatible(void)
void
-issue_warnings(void)
+issue_warnings_and_set_wal_level(void)
{
+ /*
+ * We unconditionally start/stop the new server because pg_resetwal -o
+ * set wal_level to 'minimum'. If the user is upgrading standby
+ * servers using the rsync instructions, they will need pg_upgrade
+ * to write its final WAL record showing wal_level as 'replica'.
+ */
+ start_postmaster(&new_cluster, true);
+
/* Create dummy large object permissions for old < PG 9.0? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
- {
- start_postmaster(&new_cluster, true);
new_9_0_populate_pg_largeobject_metadata(&new_cluster, false);
- stop_postmaster(false);
- }
+
+ stop_postmaster(false);
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 90c07205bf8..710b8efb874 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -160,7 +160,7 @@ main(int argc, char **argv)
create_script_for_cluster_analyze(&analyze_script_file_name);
create_script_for_old_cluster_deletion(&deletion_script_file_name);
- issue_warnings();
+ issue_warnings_and_set_wal_level();
pg_log(PG_REPORT, "\nUpgrade Complete\n");
pg_log(PG_REPORT, "----------------\n");
diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
index 19dca83386f..439552c5da7 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -334,7 +334,7 @@ void output_check_banner(bool live_check);
void check_and_dump_old_cluster(bool live_check);
void check_new_cluster(void);
void report_clusters_compatible(void);
-void issue_warnings(void);
+void issue_warnings_and_set_wal_level(void);
void output_completion_banner(char *analyze_script_file_name,
char *deletion_script_file_name);
void check_cluster_versions(void);
[parent: 1dce0536497d]