aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-09-16 01:56:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-09-16 01:56:56 +0000
commit2b74fcedc4065bdbbbc3a11d09090249226f3154 (patch)
tree79bd2e8d08fe81a933aef5a8dabf80367c005bc0
parentc1758175f8a9da4d5e3fce0da9640398ab036007 (diff)
downloadpostgresql-2b74fcedc4065bdbbbc3a11d09090249226f3154.tar.gz
postgresql-2b74fcedc4065bdbbbc3a11d09090249226f3154.zip
Widen the nLocks counts in local lock tables from int to int64. This
forestalls potential overflow when the same table (or other object, but usually tables) is accessed by very many successive queries within a single transaction. Per report from Michael Milligan. Back-patch to 8.0, which is as far back as the patch conveniently applies. There have been no reports of overflow in pre-8.3 releases, but clearly the risk existed all along. (Michael's report suggests that 8.3 may consume lock counts faster than prior releases, but with no test case to look at it's hard to be sure about that. Widening the counts seems a good future-proofing measure in any event.)
-rw-r--r--src/include/storage/lock.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 7f67a3ac3a9..5bc197760ca 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.84 2004/12/31 22:03:42 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.84.4.1 2008/09/16 01:56:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -236,7 +236,7 @@ typedef struct LOCALLOCKOWNER
* use a forward struct reference to avoid circularity.
*/
struct ResourceOwnerData *owner;
- int nLocks; /* # of times held by this owner */
+ int64 nLocks; /* # of times held by this owner */
} LOCALLOCKOWNER;
typedef struct LOCALLOCK
@@ -247,7 +247,7 @@ typedef struct LOCALLOCK
/* data */
LOCK *lock; /* associated LOCK object in shared mem */
PROCLOCK *proclock; /* associated PROCLOCK object in shmem */
- int nLocks; /* total number of times lock is held */
+ int64 nLocks; /* total number of times lock is held */
int numLockOwners; /* # of relevant ResourceOwners */
int maxLockOwners; /* allocated size of array */
LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */