aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-11 13:43:31 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-11 13:43:31 +0300
commit7c797e7194d969f974abf579cacf30ffdccdbb95 (patch)
treee8613658516942b58181f98615721a0c997996c2 /src/backend/utils
parentf510fc1d904d3266fd433b49664a7685f4fc89ef (diff)
downloadpostgresql-7c797e7194d969f974abf579cacf30ffdccdbb95.tar.gz
postgresql-7c797e7194d969f974abf579cacf30ffdccdbb95.zip
Fix the size of predicate lock manager's shared memory hash tables at creation.
This way they don't compete with the regular lock manager for the slack shared memory, making the behavior more predictable.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/hash/dynahash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index f718785ee47..d9027291ee3 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -160,6 +160,7 @@ struct HTAB
MemoryContext hcxt; /* memory context if default allocator used */
char *tabname; /* table name (for error messages) */
bool isshared; /* true if table is in shared memory */
+ bool isfixed; /* if true, don't enlarge */
/* freezing a shared table isn't allowed, so we can keep state here */
bool frozen; /* true = no more inserts allowed */
@@ -435,6 +436,8 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
errmsg("out of memory")));
}
+ if (flags & HASH_FIXED_SIZE)
+ hashp->isfixed = true;
return hashp;
}
@@ -1334,6 +1337,9 @@ element_alloc(HTAB *hashp, int nelem)
HASHELEMENT *prevElement;
int i;
+ if (hashp->isfixed)
+ return false;
+
/* Each element has a HASHELEMENT header plus user data. */
elementSize = MAXALIGN(sizeof(HASHELEMENT)) + MAXALIGN(hctlv->entrysize);