pgsql: Change the misleading local end_lsn for prepared transactions.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Change the misleading local end_lsn for prepared transactions.
Date: 2024-08-09 05:05:03
Message-ID: E1scHoF-003N1a-Nk@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Change the misleading local end_lsn for prepared transactions.

The apply worker was using XactLastCommitEnd as local end_lsn for applying
prepare and rollback_prepare. The XactLastCommitEnd value is the end lsn
of the last commit applied before the prepare transaction which makes no
sense. This LSN is used to decide whether we can send the acknowledgment
of the corresponding remote LSN to the server.

It is okay not to set the local_end LSN with the actual WAL position for
the prepare because we always flush the prepare record. So, we can send
the acknowledgment of the remote_end LSN as soon as prepare is finished.

The current code is misleading but as such doesn't create any problem, so
decided not to backpatch.

Author: Hayato Kuroda
Reviewed-by: Shveta Malik, Amit Kapila
Discussion: https://postgr.es/m/TYAPR01MB5692FA4926754B91E9D7B5F0F5AA2@TYAPR01MB5692.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/701cf1e3174d560a19c019f1085c73ef667acf2d

Modified Files
--------------
src/backend/replication/logical/worker.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2024-08-09 05:24:24 pgsql: Remove obsolete RECHECK keyword completely
Previous Message Alvaro Herrera 2024-08-09 00:38:42 pgsql: libpq: Add suppress argument to pqTraceOutputNchar