Skip to content

Commit b710248

Browse files
committed
pg_upgrade: start/stop new server after pg_resetwal
When commit 0f33a71 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
1 parent a69dfe5 commit b710248

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,25 @@ report_clusters_compatible(void)
174174

175175

176176
void
177-
issue_warnings(void)
177+
issue_warnings_and_set_wal_level(void)
178178
{
179+
/*
180+
* We unconditionally start/stop the new server because pg_resetwal -o
181+
* set wal_level to 'minimum'. If the user is upgrading standby
182+
* servers using the rsync instructions, they will need pg_upgrade
183+
* to write its final WAL record showing wal_level as 'replica'.
184+
*/
185+
start_postmaster(&new_cluster, true);
186+
179187
/* Create dummy large object permissions for old < PG 9.0? */
180188
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
181-
{
182-
start_postmaster(&new_cluster, true);
183189
new_9_0_populate_pg_largeobject_metadata(&new_cluster, false);
184-
stop_postmaster(false);
185-
}
186190

187191
/* Reindex hash indexes for old < 10.0 */
188192
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 906)
189-
{
190-
start_postmaster(&new_cluster, true);
191193
old_9_6_invalidate_hash_indexes(&new_cluster, false);
192-
stop_postmaster(false);
193-
}
194+
195+
stop_postmaster(false);
194196
}
195197

196198

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ main(int argc, char **argv)
162162
create_script_for_cluster_analyze(&analyze_script_file_name);
163163
create_script_for_old_cluster_deletion(&deletion_script_file_name);
164164

165-
issue_warnings();
165+
issue_warnings_and_set_wal_level();
166166

167167
pg_log(PG_REPORT, "\nUpgrade Complete\n");
168168
pg_log(PG_REPORT, "----------------\n");

src/bin/pg_upgrade/pg_upgrade.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void output_check_banner(bool live_check);
332332
void check_and_dump_old_cluster(bool live_check);
333333
void check_new_cluster(void);
334334
void report_clusters_compatible(void);
335-
void issue_warnings(void);
335+
void issue_warnings_and_set_wal_level(void);
336336
void output_completion_banner(char *analyze_script_file_name,
337337
char *deletion_script_file_name);
338338
void check_cluster_versions(void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy