1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-25 12:03:53 +03:00

snapshot scalability: Move PGXACT->vacuumFlags to ProcGlobal->vacuumFlags.

Similar to the previous commit this increases the chance that data
frequently needed by GetSnapshotData() stays in l2 cache. As we now
take care to not unnecessarily write to ProcGlobal->vacuumFlags, there
should be very few modifications to the ProcGlobal->vacuumFlags array.

Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Robert Haas <robertmhaas@gmail.com>
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/20200301083601.ews6hz5dduc3w2se@alap3.anarazel.de
This commit is contained in:
Andres Freund
2020-07-15 15:35:07 -07:00
parent 941697c3c1
commit 5788e258bb
9 changed files with 75 additions and 42 deletions

View File

@@ -41,7 +41,7 @@ struct XidCache
};
/*
* Flags for PGXACT->vacuumFlags
* Flags for ProcGlobal->vacuumFlags[]
*/
#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */
#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */
@@ -167,6 +167,9 @@ struct PGPROC
bool delayChkpt; /* true if this proc delays checkpoint start */
uint8 vacuumFlags; /* this backend's vacuum flags, see PROC_*
* above. mirrored in
* ProcGlobal->vacuumFlags[pgxactoff] */
/*
* Info to allow us to wait for synchronous replication, if needed.
* waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend.
@@ -244,7 +247,6 @@ extern PGDLLIMPORT struct PGXACT *MyPgXact;
*/
typedef struct PGXACT
{
uint8 vacuumFlags; /* vacuum-related flags, see above */
bool overflowed;
uint8 nxids;
@@ -314,6 +316,12 @@ typedef struct PROC_HDR
/* Array mirroring PGPROC.xid for each PGPROC currently in the procarray */
TransactionId *xids;
/*
* Array mirroring PGPROC.vacuumFlags for each PGPROC currently in the
* procarray.
*/
uint8 *vacuumFlags;
/* Length of allProcs array */
uint32 allProcCount;
/* Head of list of free PGPROC structures */