diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-04-03 16:34:36 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-04-03 16:34:36 +0000 |
| commit | 9c9b619473cd9d2f3f3181bd9cd6862c64abb4d3 (patch) | |
| tree | 4cf41b7316d638094c0f30c8e2c0b6565d4465ee /src/include | |
| parent | fb4279e99cf71c27c132a75ed62a08395329b496 (diff) | |
Remove the CheckpointStartLock in favor of having backends show whether they
are in their commit critical sections via flags in the ProcArray. Checkpoint
can watch the ProcArray to determine when it's safe to proceed. This is
a considerably better solution to the original problem of race conditions
between checkpoint and transaction commit: it speeds up commit, since there's
one less lock to fool with, and it prevents the problem of checkpoint being
delayed indefinitely when there's a constant flow of commits. Heikki, with
some kibitzing from Tom.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/storage/lwlock.h | 3 | ||||
| -rw-r--r-- | src/include/storage/proc.h | 4 | ||||
| -rw-r--r-- | src/include/storage/procarray.h | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index b4503f92135..c47256a1599 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.34 2007/02/15 23:23:23 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.35 2007/04/03 16:34:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -49,7 +49,6 @@ typedef enum LWLockId WALWriteLock, ControlFileLock, CheckpointLock, - CheckpointStartLock, CLogControlLock, SubtransControlLock, MultiXactGenLock, diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 2b20eda828d..772cf52cdf9 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.96 2007/03/07 13:35:03 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.97 2007/04/03 16:34:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -74,6 +74,8 @@ struct PGPROC Oid databaseId; /* OID of database this backend is using */ Oid roleId; /* OID of role using this backend */ + bool inCommit; /* true if within commit critical section */ + bool inVacuum; /* true if current xact is a LAZY VACUUM */ bool isAutovacuum; /* true if it's autovacuum */ diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h index 93e82e43680..cd2df663809 100644 --- a/src/include/storage/procarray.h +++ b/src/include/storage/procarray.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.12 2007/01/16 13:28:57 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.13 2007/04/03 16:34:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,9 @@ extern bool TransactionIdIsInProgress(TransactionId xid); extern bool TransactionIdIsActive(TransactionId xid); extern TransactionId GetOldestXmin(bool allDbs, bool ignoreVacuum); +extern int GetTransactionsInCommit(TransactionId **xids_p); +extern bool HaveTransactionsInCommit(TransactionId *xids, int nxids); + extern PGPROC *BackendPidGetProc(int pid); extern int BackendXidGetPid(TransactionId xid); extern bool IsBackendPid(int pid); |
