pgsql: Prevent underflow in KeepLogSeg(). - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Prevent underflow in KeepLogSeg().
Date
Msg-id E1ps9LF-005ECM-8I@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Prevent underflow in KeepLogSeg().

The call to XLogGetReplicationSlotMinimumLSN() might return a
greater LSN than the one given to the function.  Subsequent segment
number calculations might then underflow, which could result in
unexpected behavior when removing or recyling WAL files.  This was
introduced with max_slot_wal_keep_size in c655077639.  To fix, skip
the block of code for replication slots if the LSN is greater.

Reported-by: Xu Xingwang
Author: Kyotaro Horiguchi
Reviewed-by: Junwang Zhao
Discussion: https://postgr.es/m/17903-4288d439dee856c6%40postgresql.org
Backpatch-through: 13

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/be40dd63e00d4ccb1bc10cab5c086a6e544c3a30

Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Fix wrong construct_array_builtin() call in GUCArrayDelete()
Next
From: Amit Kapila
Date:
Subject: pgsql: Improve one of the test cases in 035_standby_logical_decoding.pl