@@ -284,7 +284,7 @@ TwoPhaseShmemInit(void)
284
284
TwoPhaseState -> freeGXacts = & gxacts [i ];
285
285
286
286
/* associate it with a PGPROC assigned by InitProcGlobal */
287
- gxacts [i ].pgprocno = PreparedXactProcs [i ]. pgprocno ;
287
+ gxacts [i ].pgprocno = GetNumberFromPGProc ( & PreparedXactProcs [i ]) ;
288
288
289
289
/*
290
290
* 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,
461
461
462
462
/* Initialize the PGPROC entry */
463
463
MemSet (proc ,0 ,sizeof (PGPROC ));
464
- proc -> pgprocno = gxact -> pgprocno ;
465
464
dlist_node_init (& proc -> links );
466
465
proc -> waitStatus = PROC_WAIT_STATUS_OK ;
467
466
if (LocalTransactionIdIsValid (MyProc -> lxid ))
@@ -780,7 +779,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
780
779
while (status -> array != NULL && status -> currIdx < status -> ngxacts )
781
780
{
782
781
GlobalTransaction gxact = & status -> array [status -> currIdx ++ ];
783
- PGPROC * proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
782
+ PGPROC * proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
784
783
Datum values [5 ]= {0 };
785
784
bool nulls [5 ]= {0 };
786
785
HeapTuple tuple ;
@@ -935,7 +934,7 @@ TwoPhaseGetDummyProc(TransactionId xid, bool lock_held)
935
934
{
936
935
GlobalTransaction gxact = TwoPhaseGetGXact (xid ,lock_held );
937
936
938
- return & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
937
+ return GetPGProcByNumber ( gxact -> pgprocno ) ;
939
938
}
940
939
941
940
/************************************************************************/
@@ -1080,7 +1079,7 @@ save_state_data(const void *data, uint32 len)
1080
1079
void
1081
1080
StartPrepare (GlobalTransaction gxact )
1082
1081
{
1083
- PGPROC * proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
1082
+ PGPROC * proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
1084
1083
TransactionId xid = gxact -> xid ;
1085
1084
TwoPhaseFileHeader hdr ;
1086
1085
TransactionId * children ;
@@ -1539,7 +1538,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
1539
1538
* try to commit the same GID at once.
1540
1539
*/
1541
1540
gxact = LockGXact (gid ,GetUserId ());
1542
- proc = & ProcGlobal -> allProcs [ gxact -> pgprocno ] ;
1541
+ proc = GetPGProcByNumber ( gxact -> pgprocno ) ;
1543
1542
xid = gxact -> xid ;
1544
1543
1545
1544
/*