mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Immediately reserve LSN on upon creation of replication slot (#783)
This feature is available starting from 9.6
This commit is contained in:
@@ -1560,11 +1560,13 @@ $$""".format(name, ' '.join(options)), name, password, password)
|
||||
if cursor.rowcount != 1: # Either slot doesn't exists or it is still active
|
||||
self._schedule_load_slots = True # schedule load_replication_slots on the next iteration
|
||||
|
||||
immediately_reserve = ', true' if self._major_version >= 90600 else ''
|
||||
|
||||
# create new slots
|
||||
for slot in slots - set(self._replication_slots):
|
||||
self._query("""SELECT pg_create_physical_replication_slot(%s)
|
||||
self._query("""SELECT pg_create_physical_replication_slot(%s{0})
|
||||
WHERE NOT EXISTS (SELECT 1 FROM pg_replication_slots
|
||||
WHERE slot_name = %s)""", slot, slot)
|
||||
WHERE slot_name = %s)""".format(immediately_reserve), slot, slot)
|
||||
|
||||
self._replication_slots = slots
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user