pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()
Date: 2024-01-19 15:19:24
Message-ID: E1rQqeS-002A0s-Qm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reorder actions in ProcArrayApplyRecoveryInfo()

Since 5a1dfde8334b, 2PC filenames use FullTransactionId. Thus, it needs to
convert TransactionId to FullTransactionId in StandbyTransactionIdIsPrepared()
using TransamVariables->nextXid. However, ProcArrayApplyRecoveryInfo()
first releases locks with usage StandbyTransactionIdIsPrepared(), then advances
TransamVariables->nextXid. This sequence of actions could cause errors.
This commit makes ProcArrayApplyRecoveryInfo() advance
TransamVariables->nextXid before releasing locks.

Reported-by: Thomas Munro, Michael Paquier
Discussion: https://postgr.es/m/CA%2BhUKGLj_ve1_pNAnxwYU9rDcv7GOhsYXJt7jMKSA%3D5-6ss-Cw%40mail.gmail.com
Discussion: https://postgr.es/m/Zadp9f4E1MYvMJqe%40paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/storage/ipc/procarray.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-01-19 15:39:06 pgsql: doc: Update compiler for FreeBSD specific instructions
Previous Message Peter Eisentraut 2024-01-19 14:47:40 pgsql: Add stratnum GiST support function