Skip to content

Commit 5dea32c

Browse files
balasankarcBen Prescott_ibaum
committed
Merge branch '7841-pg_upgrade-fails-on-single-node-geo-secondary-gitlab-15-11-postgresql-12-13' into 'master'
Fix pg-upgrade failure on Geo secondary nodes Closes #7841 See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6984 Merged-by: Balasankar 'Balu' C <[email protected]> Approved-by: Andrew Patterson <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Reviewed-by: Ben Prescott_ <[email protected]> Co-authored-by: Ben Prescott_ <[email protected]> Co-authored-by: Ian Baum <[email protected]>
2 parents 2e55a8b + 9f4ff92 commit 5dea32c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

files/gitlab-ctl-commands/pg-upgrade.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@
276276
elsif @instance_type == :patroni_standby_leader
277277
patroni_standby_leader_upgrade
278278
end
279-
elsif @roles.include?('geo-primary')
279+
elsif @roles.include?('geo_primary')
280280
log 'Detected a GEO primary node'
281281
@instance_type = :geo_primary
282282
general_upgrade
283-
elsif @roles.include?('geo-secondary')
283+
elsif @roles.include?('geo_secondary')
284284
log 'Detected a Geo secondary node'
285285
@instance_type = :geo_secondary
286286
geo_secondary_upgrade(options[:tmp_dir], options[:timeout])
@@ -447,21 +447,22 @@ def geo_secondary_upgrade(tmp_dir, timeout)
447447
log('Upgrading the postgresql database')
448448
begin
449449
promote_database
450-
rescue GitlabCtl::Errors::ExecutionError
451-
die "There was an error promoting the database. Please check the logs"
450+
rescue GitlabCtl::Errors::ExecutionError => e
451+
log "STDOUT: #{e.stdout}"
452+
log "STDERR: #{e.stderr}"
453+
die "There was an error promoting the database from standby, please check the logs and output."
452454
end
453455

454456
# Restart the database after promotion, and wait for it to be ready
455457
restart_database
456458
GitlabCtl::PostgreSQL.wait_for_postgresql(600)
457459

458460
common_pre_upgrade
459-
460-
# Only disable maintenance_mode if geo-pg is not enabled
461-
common_post_upgrade(!@geo_pg_enabled)
461+
cleanup_data_dir
462462
end
463463

464464
geo_pg_upgrade
465+
common_post_upgrade
465466
end
466467

467468
def geo_pg_upgrade
@@ -485,7 +486,6 @@ def geo_pg_upgrade
485486
rescue GitlabCtl::Errors::ExecutionError
486487
die "Error running pg_upgrade on secondary, please check logs"
487488
end
488-
common_post_upgrade
489489
end
490490

491491
def get_locale_encoding

0 commit comments

Comments
 (0)