pgsql: Fix one-off bug causing missing commit timestamps for subtransac

Started by Michael Paquierover 4 years ago1 messagescomitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Fix one-off bug causing missing commit timestamps for subtransactions

The logic in charge of writing commit timestamps (enabled with
track_commit_timestamp) for subtransactions had a one-bug bug,
where it would be possible that commit timestamps go missing for the
last subtransaction committed.

While on it, simplify a bit the iteration logic in the loop writing the
commit timestamps, as per suggestions from Kyotaro Horiguchi and Tom
Lane, so as some variable initializations are not part of the loop
itself.

Issue introduced in 73c986a.

Analyzed-by: Alex Kingsborough
Author: Alex Kingsborough, Kyotaro Horiguchi
Discussion: /messages/by-id/73A66172-4050-4F2A-B7F1-13508EDA2144@amazon.com
Backpatch-through: 10

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0ffe2975c37473981113fc461990c7533bbcf26d

Modified Files
--------------
src/backend/access/transam/commit_ts.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)