Fix oldest xmin and LSN computation across repslots after advancing
authorMichael Paquier <michael@paquier.xyz>
Thu, 18 Jun 2020 07:35:36 +0000 (16:35 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 18 Jun 2020 07:35:36 +0000 (16:35 +0900)
commit1657e14b50d23cdf8bb9fec0a4e5d9cc0b7b265e
treed723f99f25f8ff00c0c15d7bb69c776fe2787eff
parent3ced1dd6c479389b4000ae484a12b11e8d77b844
Fix oldest xmin and LSN computation across repslots after advancing

Advancing a replication slot did not recompute the oldest xmin and LSN
values across replication slots, preventing resource removal like
segments not recycled at checkpoint time.  The original commit that
introduced the slot advancing in 9c7d06d never did the update of those
oldest values, and b0afdca removed this code.

This commit adds a TAP test to check segment recycling with advancing
for physical slots, enforcing an extra segment switch before advancing
to check if the segment gets correctly recycled after a checkpoint.

Reported-by: Andres Freund
Reviewed-by: Alexey Kondratov, Kyptaro Horiguchi
Discussion: https://postgr.es/m/20200609171904.kpltxxvjzislidks@alap3.anarazel.de
Backpatch-through: 11
src/backend/replication/slotfuncs.c
src/test/recovery/t/001_stream_rep.pl