Remove now unused PGXACT.
authorAndres Freund <[email protected]>
Tue, 7 Apr 2020 04:28:55 +0000 (21:28 -0700)
committerAndres Freund <[email protected]>
Tue, 7 Apr 2020 04:28:55 +0000 (21:28 -0700)
src/backend/access/transam/twophase.c
src/backend/storage/ipc/procarray.c
src/backend/storage/lmgr/proc.c
src/include/storage/proc.h

index ebbd21186b2ece08e5815866c8c3b045609aa29f..3b18ed89fd78e3f46af7401ae6b04191dfc0a6eb 100644 (file)
@@ -21,9 +21,9 @@
  *     GIDs and aborts the transaction if there already is a global
  *     transaction in prepared state with the same GID.
  *
- *     A global transaction (gxact) also has dummy PGXACT and PGPROC; this is
- *     what keeps the XID considered running by TransactionIdIsInProgress.
- *     It is also convenient as a PGPROC to hook the gxact's locks to.
+ *     A global transaction (gxact) also has dummy PGPROC; this is what keeps
+ *     the XID considered running by TransactionIdIsInProgress.  It is also
+ *     convenient as a PGPROC to hook the gxact's locks to.
  *
  *     Information to recover prepared transactions in case of crash is
  *     now stored in WAL for the common case. In some cases there will be
index 5c22404956e530e20902caae4fd487fea73ad509..bd825d006993231a876431680e3570b520aff6ac 100644 (file)
@@ -96,7 +96,7 @@ typedef struct ProcArrayStruct
    /* oldest catalog xmin of any replication slot */
    TransactionId replication_slot_catalog_xmin;
 
-   /* indexes into allPgXact[], has PROCARRAY_MAXPROCS entries */
+   /* indexes into allProcs[], has PROCARRAY_MAXPROCS entries */
    int         pgprocnos[FLEXIBLE_ARRAY_MEMBER];
 } ProcArrayStruct;
 
@@ -183,7 +183,6 @@ typedef struct ComputedHorizons
 static ProcArrayStruct *procArray;
 
 static PGPROC *allProcs;
-static PGXACT *allPgXact;
 
 /*
  * Bookkeeping for tracking emulated transactions in recovery
@@ -270,8 +269,7 @@ static int  KnownAssignedXidsGetAndSetXmin(TransactionId *xarray,
 static TransactionId KnownAssignedXidsGetOldestXmin(void);
 static void KnownAssignedXidsDisplay(int trace_level);
 static void KnownAssignedXidsReset(void);
-static inline void ProcArrayEndTransactionInternal(PGPROC *proc,
-                                                  PGXACT *pgxact, TransactionId latestXid);
+static inline void ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid);
 static void ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid);
 static void MaintainLatestCompletedXid(TransactionId latestXid);
 
@@ -356,7 +354,6 @@ CreateSharedProcArray(void)
    }
 
    allProcs = ProcGlobal->allProcs;
-   allPgXact = ProcGlobal->allPgXact;
 
    /* Create or attach to the KnownAssignedXids arrays too, if needed */
    if (EnableHotStandby)
@@ -563,8 +560,6 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
 void
 ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
 {
-   PGXACT     *pgxact = &allPgXact[proc->pgprocno];
-
    if (TransactionIdIsValid(latestXid))
    {
        /*
@@ -582,7 +577,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
         */
        if (LWLockConditionalAcquire(ProcArrayLock, LW_EXCLUSIVE))
        {
-           ProcArrayEndTransactionInternal(proc, pgxact, latestXid);
+           ProcArrayEndTransactionInternal(proc, latestXid);
            LWLockRelease(ProcArrayLock);
        }
        else
@@ -622,8 +617,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
  * We don't do any locking here; caller must handle that.
  */
 static inline void
-ProcArrayEndTransactionInternal(PGPROC *proc, PGXACT *pgxact,
-                               TransactionId latestXid)
+ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid)
 {
    size_t      pgxactoff = proc->pgxactoff;
 
@@ -741,9 +735,8 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
    while (nextidx != INVALID_PGPROCNO)
    {
        PGPROC     *proc = &allProcs[nextidx];
-       PGXACT     *pgxact = &allPgXact[nextidx];
 
-       ProcArrayEndTransactionInternal(proc, pgxact, proc->procArrayGroupMemberXid);
+       ProcArrayEndTransactionInternal(proc, proc->procArrayGroupMemberXid);
 
        /* Move to next proc in list. */
        nextidx = pg_atomic_read_u32(&proc->procArrayGroupNext);
index 650543bdc52d928d12300f5ea3105bf38b01feac..80ebd493a0baba486e3f9b73ba9db07a9ebd766f 100644 (file)
@@ -65,7 +65,6 @@ bool      log_lock_waits = false;
 
 /* Pointer to this process's PGPROC and PGXACT structs, if any */
 PGPROC    *MyProc = NULL;
-PGXACT    *MyPgXact = NULL;
 
 /*
  * This spinlock protects the freelist of recycled PGPROC structures.
@@ -109,9 +108,6 @@ ProcGlobalShmemSize(void)
    size = add_size(size, mul_size(TotalProcs, sizeof(PGPROC)));
    size = add_size(size, sizeof(slock_t));
 
-   size = add_size(size, mul_size(MaxBackends, sizeof(PGXACT)));
-   size = add_size(size, mul_size(NUM_AUXILIARY_PROCS, sizeof(PGXACT)));
-   size = add_size(size, mul_size(max_prepared_xacts, sizeof(PGXACT)));
    size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->xids)));
    size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->nsubxids)));
    size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->vacuumFlags)));
@@ -161,7 +157,6 @@ void
 InitProcGlobal(void)
 {
    PGPROC     *procs;
-   PGXACT     *pgxacts;
    int         i,
                j;
    bool        found;
@@ -202,18 +197,6 @@ InitProcGlobal(void)
    /* XXX allProcCount isn't really all of them; it excludes prepared xacts */
    ProcGlobal->allProcCount = MaxBackends + NUM_AUXILIARY_PROCS;
 
-   /*
-    * Also allocate a separate array of PGXACT structures.  This is separate
-    * from the main PGPROC array so that the most heavily accessed data is
-    * stored contiguously in memory in as few cache lines as possible. This
-    * provides significant performance benefits, especially on a
-    * multiprocessor system.  There is one PGXACT structure for every PGPROC
-    * structure.
-    */
-   pgxacts = (PGXACT *) ShmemAlloc(TotalProcs * sizeof(PGXACT));
-   MemSet(pgxacts, 0, TotalProcs * sizeof(PGXACT));
-   ProcGlobal->allPgXact = pgxacts;
-
    /*
     * Also allocate a separate arrays for data that is frequently (e.g. by
     * GetSnapshotData()) accessed from outside a backend.  There is one entry
@@ -382,7 +365,6 @@ InitProcess(void)
                (errcode(ERRCODE_TOO_MANY_CONNECTIONS),
                 errmsg("sorry, too many clients already")));
    }
-   MyPgXact = &ProcGlobal->allPgXact[MyProc->pgprocno];
 
    /*
     * Cross-check that the PGPROC is of the type we expect; if this were not
@@ -579,7 +561,6 @@ InitAuxiliaryProcess(void)
    ((volatile PGPROC *) auxproc)->pid = MyProcPid;
 
    MyProc = auxproc;
-   MyPgXact = &ProcGlobal->allPgXact[auxproc->pgprocno];
 
    SpinLockRelease(ProcStructLock);
 
index d721834ecea25feda97c21003953a88ea7c00fd6..f701da8bd449a89d38491e19f27b6641f0f56ee5 100644 (file)
@@ -218,19 +218,6 @@ struct PGPROC
 
 
 extern PGDLLIMPORT PGPROC *MyProc;
-extern PGDLLIMPORT struct PGXACT *MyPgXact;
-
-/*
- * Prior to PostgreSQL 9.2, the fields below were stored as part of the
- * PGPROC.  However, benchmarking revealed that packing these particular
- * members into a separate array as tightly as possible sped up GetSnapshotData
- * considerably on systems with many CPU cores, by reducing the number of
- * cache lines needing to be fetched.  Thus, think very carefully before adding
- * anything else here.
- */
-typedef struct PGXACT
-{
-} PGXACT;
 
 /*
  * There is one ProcGlobal struct for the whole database cluster.
@@ -239,8 +226,6 @@ typedef struct PROC_HDR
 {
    /* Array of PGPROC structures (not including dummies for prepared txns) */
    PGPROC     *allProcs;
-   /* Array of PGXACT structures (not including dummies for prepared txns) */
-   PGXACT     *allPgXact;
 
    /*
     * Arrays with per-backend information that is hotly accessed, indexed by