Skip to content

Commit

Permalink
better slots on dead iter (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
munakoiso authored Nov 15, 2024
1 parent 28c738f commit 1725297
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
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 @@ -878,6 +878,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

0 comments on commit 1725297

Please sign in to comment.