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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix one-off bug causing missing commit timestamps for subtransac
Date: 2022-01-21 05:55:40
Message-ID: E1nAmtg-0002d6-LD@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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: https://postgr.es/m/73A66172-4050-4F2A-B7F1-13508EDA2144@amazon.com
Backpatch-through: 10

Branch
------
REL_13_STABLE

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

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

Browse pgsql-committers by date

  From Date Subject
Next Message Etsuro Fujita 2022-01-21 08:54:27 pgsql: postgres_fdw: Fix subabort cleanup of connections used in asynch
Previous Message Thomas Munro 2022-01-21 02:42:17 pgsql: Add new simple TAP test for tablespaces, attempt II.