@@ -281,7 +281,13 @@ def check_timeline(self) -> bool:
281281
282282 def is_standby_cluster (self ) -> bool :
283283 """:returns: `True` if global configuration has a valid "standby_cluster" section."""
284- return global_config .is_standby_cluster
284+ return self .patroni .multisite .is_active and not self .patroni .multisite .is_leader_site () \
285+ or global_config .is_standby_cluster
286+
287+ def get_standby_cluster_config (self ):
288+ if self .patroni .multisite .is_active :
289+ return self .patroni .multisite .get_active_standby_config ()
290+ return global_config .get_standby_cluster_config ()
285291
286292 def is_leader (self ) -> bool :
287293 """:returns: `True` if the current node is the leader, based on expiration set when it last held the key."""
@@ -555,7 +561,7 @@ def bootstrap(self) -> str:
555561 return ret or 'trying to bootstrap {0}' .format (msg )
556562
557563 # no leader, but configuration may allowed replica creation using backup tools
558- create_replica_methods = global_config .get_standby_cluster_config ().get ('create_replica_methods' , []) \
564+ create_replica_methods = self .get_standby_cluster_config ().get ('create_replica_methods' , []) \
559565 if self .is_standby_cluster () else None
560566 can_bootstrap = self .state_handler .can_create_replica_without_replication_connection (create_replica_methods )
561567 concurrent_bootstrap = self .cluster .initialize == ""
@@ -730,7 +736,7 @@ def _get_node_to_follow(self, cluster: Cluster) -> Union[Leader, Member, None]:
730736 for param in params : # It is highly unlikely to happen, but we want to protect from the case
731737 node_to_follow .data .pop (param , None ) # when above-mentioned params came from outside.
732738 if self .is_standby_cluster ():
733- standby_config = global_config .get_standby_cluster_config ()
739+ standby_config = self .get_standby_cluster_config ()
734740 node_to_follow .data .update ({p : standby_config [p ] for p in params if standby_config .get (p )})
735741
736742 return node_to_follow
@@ -2391,7 +2397,7 @@ def get_remote_member(self, member: Union[Leader, Member, None] = None) -> Remot
23912397 config or cluster.config.data.
23922398 """
23932399 data : Dict [str , Any ] = {}
2394- cluster_params = global_config .get_standby_cluster_config ()
2400+ cluster_params = self .get_standby_cluster_config ()
23952401
23962402 if cluster_params :
23972403 data .update ({k : v for k , v in cluster_params .items () if k in RemoteMember .ALLOWED_KEYS })
0 commit comments