Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better slots on dead iter #53

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def read_config(filename=None, options=None):
'certfile': None,
'ca_cert': None,
'verify_certs': 'no',
'drop_slot_countdown': 10,
'drop_slot_countdown': 300,
'replication_slots_polling': None,
'max_allowed_switchover_lag_ms': 60000,
},
Expand Down
1 change: 1 addition & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ def dead_iter(self, db_state, zk_state, is_actually_dead):
holder = self.zk.get_current_lock_holder()
if holder and holder != helpers.get_hostname():
if role == 'replica' and holder == last_primary:
self._acquire_replication_source_slot_lock(last_primary)
logging.info('Seems that primary has not changed but PostgreSQL is dead. Starting it.')
return self.db.start_postgresql()

Expand Down
1 change: 1 addition & 0 deletions tests/features/cascade.feature
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ Feature: Check not HA hosts
priority: 0
use_replication_slots: 'yes'
quorum_commit: 'yes'
drop_slot_countdown: 10
primary:
change_replication_type: 'yes'
primary_switch_checks: 1
Expand Down
1 change: 1 addition & 0 deletions tests/features/kill_primary.feature
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ Feature: Destroy primary in various scenarios
priority: 0
use_replication_slots: 'yes'
quorum_commit: 'yes'
drop_slot_countdown: 10
primary:
change_replication_type: 'yes'
primary_switch_checks: 1
Expand Down
1 change: 1 addition & 0 deletions tests/features/slot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: Replication slots
global:
priority: 0
use_replication_slots: 'yes'
drop_slot_countdown: 10
primary:
change_replication_type: 'no'
primary_switch_checks: 1
Expand Down