mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Replace replication slot's invalidated_at LSN with an enum
This is mainly useful because the upcoming logical-decoding-on-standby feature adds further reasons for invalidating slots, and we don't want to end up with multiple invalidated_* fields, or check different attributes. Eventually we should consider not resetting restart_lsn when invalidating a slot due to max_slot_wal_keep_size. But that's a user visible change, so left for later. Increases SLOT_VERSION, due to the changed field (with a different alignment, no less). Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de
This commit is contained in:
@@ -315,12 +315,10 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
|
||||
nulls[i++] = true;
|
||||
|
||||
/*
|
||||
* If invalidated_at is valid and restart_lsn is invalid, we know for
|
||||
* certain that the slot has been invalidated. Otherwise, test
|
||||
* availability from restart_lsn.
|
||||
* If the slot has not been invalidated, test availability from
|
||||
* restart_lsn.
|
||||
*/
|
||||
if (XLogRecPtrIsInvalid(slot_contents.data.restart_lsn) &&
|
||||
!XLogRecPtrIsInvalid(slot_contents.data.invalidated_at))
|
||||
if (slot_contents.data.invalidated != RS_INVAL_NONE)
|
||||
walstate = WALAVAIL_REMOVED;
|
||||
else
|
||||
walstate = GetWALAvailability(slot_contents.data.restart_lsn);
|
||||
|
||||
Reference in New Issue
Block a user