Skip to content
Snippets Groups Projects
Commit f93cd8b1 authored by Hossein Pursultani's avatar Hossein Pursultani
Browse files

Better errors and messaging

parent e4cfa05c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -589,16 +589,20 @@ def guess_patroni_node_role
when :patroni_running_on_replica
log 'Looks like that this is a replica node but the Patroni service is still running.'
log 'Try to stop the Patroni service before attempting the upgrade.'
die 'Patroni service is still running on the replica node.'
when :patroni_stopped_on_leader
log 'Looks like that this is the leader node but the Patroni is not running.'
log 'Try to start the Patroni service before attempting the upgrade.'
die 'Patroni service is not running on the leader node.'
else
log 'Unable to detect the role of this Patroni node.'
log 'Try to use --leader or --replica switches to specify the role manually.'
log 'See: https://docs.gitlab.com/ee/administration/postgresql/replication_and_failover.html#upgrading-postgresql-major-version-in-a-patroni-cluster'
end
 
die 'Failed to detect the role of this Patroni node.'
die 'Unable to detect the role of this Patroni node.'
end
end
end
 
Loading
Loading
@@ -609,6 +613,8 @@ def check_patroni_cluster_status
 
return unless @instance_type == :patroni_leader
 
die 'Patroni service is not running on the leader node.' unless node.up?
running_replica_count = 0
node.cluster_status[:members]&.each do |member|
running_replica_count += 1 if member[:state] == 'running' && member[:role] == 'replica'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment