mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Use group updates when setting transaction status in clog.
Commit0e141c0fbbintroduced a mechanism to reduce contention on ProcArrayLock by having a single process clear XIDs in the procArray on behalf of multiple processes, reducing the need to hand the lock around. A previous attempt to introduce a similar mechanism for CLogControlLock inccce90b398crashed and burned, but the design problem which resulted in those failures is believed to have been corrected in this version. Amit Kapila, with some cosmetic changes by me. See the previous commit message for additional credits. Discussion: http://postgr.es/m/CAA4eK1KudxzgWhuywY_X=yeSAhJMT4DwCjroV5Ay60xaeB2Eew@mail.gmail.com
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#ifndef _PROC_H_
|
||||
#define _PROC_H_
|
||||
|
||||
#include "access/clog.h"
|
||||
#include "access/xlogdefs.h"
|
||||
#include "lib/ilist.h"
|
||||
#include "storage/latch.h"
|
||||
@@ -171,6 +172,17 @@ struct PGPROC
|
||||
|
||||
uint32 wait_event_info; /* proc's wait information */
|
||||
|
||||
/* Support for group transaction status update. */
|
||||
bool clogGroupMember; /* true, if member of clog group */
|
||||
pg_atomic_uint32 clogGroupNext; /* next clog group member */
|
||||
TransactionId clogGroupMemberXid; /* transaction id of clog group member */
|
||||
XidStatus clogGroupMemberXidStatus; /* transaction status of clog
|
||||
* group member */
|
||||
int clogGroupMemberPage; /* clog page corresponding to
|
||||
* transaction id of clog group member */
|
||||
XLogRecPtr clogGroupMemberLsn; /* WAL location of commit record for clog
|
||||
* group member */
|
||||
|
||||
/* Per-backend LWLock. Protects fields below (but not group fields). */
|
||||
LWLock backendLock;
|
||||
|
||||
@@ -242,6 +254,8 @@ typedef struct PROC_HDR
|
||||
PGPROC *bgworkerFreeProcs;
|
||||
/* First pgproc waiting for group XID clear */
|
||||
pg_atomic_uint32 procArrayGroupFirst;
|
||||
/* First pgproc waiting for group transaction status update */
|
||||
pg_atomic_uint32 clogGroupFirst;
|
||||
/* WALWriter process's latch */
|
||||
Latch *walwriterLatch;
|
||||
/* Checkpointer process's latch */
|
||||
|
||||
Reference in New Issue
Block a user