Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions patroni/ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ def on_shutdown(checkpoint_location: int, prev_location: int) -> None:
status['released'] = True

if mode == 'multisite':
on_shutdown = self.patroni.multisite.on_shutdown # pyright: ignore [reportAssignmentType] # noqa: F811
on_shutdown = self.patroni.multisite.on_shutdown # noqa: F811

def before_shutdown() -> None:
if self.state_handler.mpp_handler.is_coordinator():
Expand All @@ -1643,7 +1643,7 @@ def before_shutdown() -> None:

# for demotion to a standby cluster we need shutdown checkpoint lsn to be written to optime, not the prev one
checkpoint_lsn, prev_lsn = self.state_handler.latest_checkpoint_locations() \
if mode == 'graceful' else (None, None)
if mode in ('graceful', 'multisite') else (None, None)

is_standby_leader = mode == 'demote-cluster' and not status['released']
if is_standby_leader:
Expand All @@ -1660,8 +1660,7 @@ def before_shutdown() -> None:
time.sleep(2) # Give a time to somebody to take the leader lock

if mode == 'multisite':
self.patroni.multisite.on_shutdown(
self.state_handler.latest_checkpoint_location(), None) # pyright: ignore [reportArgumentType]
on_shutdown(checkpoint_lsn, prev_lsn) # pyright: ignore [reportArgumentType] # noqa: F811

if mode == 'demote-cluster':
if demote_cluster_with_archive:
Expand Down
Loading