Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc64086b

Browse files
committed
Reorder actions in ProcArrayApplyRecoveryInfo()
Since5a1dfde, 2PC filenames use FullTransactionId. Thus, it needs toconvert TransactionId to FullTransactionId in StandbyTransactionIdIsPrepared()using TransamVariables->nextXid. However, ProcArrayApplyRecoveryInfo()first releases locks with usage StandbyTransactionIdIsPrepared(), then advancesTransamVariables->nextXid. This sequence of actions could cause errors.This commit makes ProcArrayApplyRecoveryInfo() advanceTransamVariables->nextXid before releasing locks.Reported-by: Thomas Munro, Michael PaquierDiscussion:https://postgr.es/m/CA%2BhUKGLj_ve1_pNAnxwYU9rDcv7GOhsYXJt7jMKSA%3D5-6ss-Cw%40mail.gmail.comDiscussion:https://postgr.es/m/Zadp9f4E1MYvMJqe%40paquier.xyz
1 parent6db4598 commitc64086b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ void
10531053
ProcArrayApplyRecoveryInfo(RunningTransactionsrunning)
10541054
{
10551055
TransactionId*xids;
1056+
TransactionIdxid;
10561057
intnxids;
10571058
inti;
10581059

@@ -1066,6 +1067,16 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
10661067
*/
10671068
ExpireOldKnownAssignedTransactionIds(running->oldestRunningXid);
10681069

1070+
/*
1071+
* Adjust TransamVariables->nextXid before StandbyReleaseOldLocks(),
1072+
* because we will need it up to date for accessing two-phase transactions
1073+
* in StandbyReleaseOldLocks().
1074+
*/
1075+
xid=running->nextXid;
1076+
TransactionIdRetreat(xid);
1077+
AdvanceNextFullTransactionIdPastXid(xid);
1078+
Assert(FullTransactionIdIsValid(TransamVariables->nextXid));
1079+
10691080
/*
10701081
* Remove stale locks, if any.
10711082
*/
@@ -1275,11 +1286,6 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
12751286

12761287
LWLockRelease(ProcArrayLock);
12771288

1278-
/* TransamVariables->nextXid must be beyond any observed xid. */
1279-
AdvanceNextFullTransactionIdPastXid(latestObservedXid);
1280-
1281-
Assert(FullTransactionIdIsValid(TransamVariables->nextXid));
1282-
12831289
KnownAssignedXidsDisplay(DEBUG3);
12841290
if (standbyState==STANDBY_SNAPSHOT_READY)
12851291
elog(DEBUG1,"recovery snapshots are now enabled");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp