@@ -284,7 +284,7 @@ TwoPhaseShmemInit(void)
284284 TwoPhaseState -> freeGXacts = & gxacts [i ];
285285
286286 /* associate it with a PGPROC assigned by InitProcGlobal */
287- gxacts [i ].pgprocno = PreparedXactProcs [i ]. pgprocno ;
287+ gxacts [i ].pgprocno = GetNumberFromPGProc ( & PreparedXactProcs [i ]) ;
288288
289289 /*
290290 * Assign a unique ID for each dummy proc, so that the range of
@@ -461,7 +461,6 @@ MarkAsPreparingGuts(GlobalTransaction gxact, TransactionId xid, const char *gid,
461461
462462 /* Initialize the PGPROC entry */
463463 MemSet (proc , 0 , sizeof (PGPROC ));
464- proc -> pgprocno = gxact -> pgprocno ;
465464 dlist_node_init (& proc -> links );
466465 proc -> waitStatus = PROC_WAIT_STATUS_OK ;
467466 if (LocalTransactionIdIsValid (MyProc -> lxid ))
@@ -780,7 +779,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
780779 while (status -> array != NULL && status -> currIdx < status -> ngxacts )
781780 {
782781 GlobalTransaction gxact = & status -> array [status -> currIdx ++ ];
783- PGPROC * proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
782+ PGPROC * proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
784783 Datum values [5 ] = {0 };
785784 bool nulls [5 ] = {0 };
786785 HeapTuple tuple ;
@@ -935,7 +934,7 @@ TwoPhaseGetDummyProc(TransactionId xid, bool lock_held)
935934{
936935 GlobalTransaction gxact = TwoPhaseGetGXact (xid , lock_held );
937936
938- return & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
937+ return GetPGProcByNumber ( gxact -> pgprocno ) ;
939938}
940939
941940/************************************************************************/
@@ -1080,7 +1079,7 @@ save_state_data(const void *data, uint32 len)
10801079void
10811080StartPrepare (GlobalTransaction gxact )
10821081{
1083- PGPROC * proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
1082+ PGPROC * proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
10841083 TransactionId xid = gxact -> xid ;
10851084 TwoPhaseFileHeader hdr ;
10861085 TransactionId * children ;
@@ -1539,7 +1538,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
15391538 * try to commit the same GID at once.
15401539 */
15411540 gxact = LockGXact (gid , GetUserId ());
1542- proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
1541+ proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
15431542 xid = gxact -> xid ;
15441543
15451544 /*
0 commit comments