File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -623,15 +623,17 @@ def primary_endpoint(self) -> str | None:
623
623
# Force a retry if there is no primary or the member that was
624
624
# returned is not in the list of the current cluster members
625
625
# (like when the cluster was not updated yet after a failed switchover).
626
- if not primary_endpoint or primary_endpoint not in self ._units_ips :
627
- # TODO figure out why peer data is not available
628
- if primary_endpoint and len (self ._units_ips ) == 1 and len (self ._peers .units ) > 1 :
629
- logger .warning (
630
- "Possibly incomplete peer data: Will not map primary IP to unit IP"
631
- )
632
- return primary_endpoint
633
- logger .debug ("primary endpoint early exit: Primary IP not in cached peer list." )
626
+ if not primary_endpoint :
627
+ logger .warning (f"Missing primary IP for { primary } " )
634
628
primary_endpoint = None
629
+ elif primary_endpoint not in self ._units_ips :
630
+ if len (self ._peers .units ) == 0 :
631
+ logger .info (f"The unit didn't join { PEER } relation? Using { primary_endpoint } " )
632
+ elif len (self ._units_ips ) == 1 and len (self ._peers .units ) > 1 :
633
+ logger .warning (f"Possibly incomplete peer data, keep using { primary_endpoint } " )
634
+ else :
635
+ logger .debug ("Early exit primary_endpoint: Primary IP not in cached peer list" )
636
+ primary_endpoint = None
635
637
except RetryError :
636
638
return None
637
639
else :
You can’t perform that action at this time.
0 commit comments