summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Korotkov2025-06-23 18:27:42 +0000
committerAlexander Korotkov2025-06-23 18:27:42 +0000
commit70d8a91f82f19d270facd25bb6292a949773dfce (patch)
treee4f4f44cf5a1482d74b6f286be42b56553fe2d80
parentccd5bc93fdfeae22c935f405b0687be5cfa9caa4 (diff)
Remove excess assert from InvalidatePossiblyObsoleteSlot()
ca307d5cec90 introduced keeping WAL segments by slot's last saved restart LSN. It also added an assertion that the slot's restart LSN never goes backward. However, situations when the restart LSN goes backward have been spotted by buildfarm animals and investigated in the thread. When pg_receivewal starts the replication, it sets the last replayed LSN to the beginning of the segment, which is older than what ReplicationSlotReserveWal() set for the slot. A similar situation can happen to pg_basebackup. When standby reconnects to the primary, it sends the last replayed LSN, which might be older than the last confirmed flush LSN. In both these situations, a concurrent checkpoint may trigger an assert trap. Based on ideas from Vitaly Davydov <[email protected]>, Hayato Kuroda (Fujitsu) <[email protected]>, Vignesh C <[email protected]>, Amit Kapila <[email protected]>. Reported-by: Vignesh C <[email protected]> Reported-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CALDaNm3s-jpQTe1MshsvQ8GO%3DTLj233JCdkQ7uZ6pwqRVpxAdw%40mail.gmail.com Reviewed-by: Vignesh C <[email protected]> Reviewed-by: Amit Kapila <[email protected]>
-rw-r--r--src/backend/replication/slot.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index c64f020742f..c11e588d632 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -1810,8 +1810,6 @@ InvalidatePossiblyObsoleteSlot(uint32 possible_causes,
*/
SpinLockAcquire(&s->mutex);
- Assert(s->data.restart_lsn >= s->last_saved_restart_lsn);
-
restart_lsn = s->data.restart_lsn;
/* we do nothing if the slot is already invalid */