Skip to content

Commit b157cc9

Browse files
michaelpqCommitfest Bot
authored andcommitted
Integrate more FullTransactionIds into 2PC code
This refactoring is a follow-up of the work done in 5a1dfde, that has switched 2PC file names to use FullTransactionIds. This will help with the integration of solutions for the handling on-disk orphaned 2PC files, without requiring a need to build the file names from epoch numbers and TransactionId, avoiding a lot of back-and-forth between the FullTransactionIds retrieved from the file names and how these are passed around in the internal 2PC logic. Note that the core of the change is use of a FullTransactionId instead of a TransactionId in GlobalTransactionData, that tracks 2PC file information in shared memory.
1 parent 21c9756 commit b157cc9

File tree

12 files changed

+200
-154
lines changed

12 files changed

+200
-154
lines changed

src/backend/access/transam/multixact.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ AtPrepare_MultiXact(void)
18471847
* Clean up after successful PREPARE TRANSACTION
18481848
*/
18491849
void
1850-
PostPrepare_MultiXact(TransactionId xid)
1850+
PostPrepare_MultiXact(FullTransactionId fxid)
18511851
{
18521852
MultiXactId myOldestMember;
18531853

@@ -1858,7 +1858,7 @@ PostPrepare_MultiXact(TransactionId xid)
18581858
myOldestMember = OldestMemberMXactId[MyProcNumber];
18591859
if (MultiXactIdIsValid(myOldestMember))
18601860
{
1861-
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(xid, false);
1861+
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(fxid, false);
18621862

18631863
/*
18641864
* Even though storing MultiXactId is atomic, acquire lock to make
@@ -1896,10 +1896,10 @@ PostPrepare_MultiXact(TransactionId xid)
18961896
* Recover the state of a prepared transaction at startup
18971897
*/
18981898
void
1899-
multixact_twophase_recover(TransactionId xid, uint16 info,
1899+
multixact_twophase_recover(FullTransactionId fxid, uint16 info,
19001900
void *recdata, uint32 len)
19011901
{
1902-
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(xid, false);
1902+
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(fxid, false);
19031903
MultiXactId oldestMember;
19041904

19051905
/*
@@ -1917,10 +1917,10 @@ multixact_twophase_recover(TransactionId xid, uint16 info,
19171917
* Similar to AtEOXact_MultiXact but for COMMIT PREPARED
19181918
*/
19191919
void
1920-
multixact_twophase_postcommit(TransactionId xid, uint16 info,
1920+
multixact_twophase_postcommit(FullTransactionId fxid, uint16 info,
19211921
void *recdata, uint32 len)
19221922
{
1923-
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(xid, true);
1923+
ProcNumber dummyProcNumber = TwoPhaseGetDummyProcNumber(fxid, true);
19241924

19251925
Assert(len == sizeof(MultiXactId));
19261926

@@ -1932,10 +1932,10 @@ multixact_twophase_postcommit(TransactionId xid, uint16 info,
19321932
* This is actually just the same as the COMMIT case.
19331933
*/
19341934
void
1935-
multixact_twophase_postabort(TransactionId xid, uint16 info,
1935+
multixact_twophase_postabort(FullTransactionId fxid, uint16 info,
19361936
void *recdata, uint32 len)
19371937
{
1938-
multixact_twophase_postcommit(xid, info, recdata, len);
1938+
multixact_twophase_postcommit(fxid, info, recdata, len);
19391939
}
19401940

19411941
/*

0 commit comments

Comments
 (0)