summaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-03-06 21:17:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-03-06 21:17:56 +0000
commit731603a92b115db97c1202df243954195070c500 (patch)
tree1f1226cc72e3635f2800042ebfda6316d9f8a2ea /src/backend/storage/lmgr
parent03842eb03bbded18a55177e40594018f05a73623 (diff)
downloadpostgresql-731603a92b115db97c1202df243954195070c500.tar.gz
A few further tweaks to shared memory space estimation.
This change brings the default size of the main shmem block back under 1MB, which is a fairly popular value for the kernel's SHMMAX parameter.
Diffstat (limited to 'src/backend/storage/lmgr')
-rw-r--r--src/backend/storage/lmgr/lock.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index ed9a5b3131..2f822add66 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.45 1999/02/22 06:16:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.46 1999/03/06 21:17:44 tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@@ -339,8 +339,8 @@ LockMethodTableInit(char *tabName,
* to find the different locks.
* ----------------------
*/
- info.keysize = sizeof(LOCKTAG);
- info.datasize = sizeof(LOCK);
+ info.keysize = SHMEM_LOCKTAB_KEYSIZE;
+ info.datasize = SHMEM_LOCKTAB_DATASIZE;
info.hash = tag_hash;
hash_flags = (HASH_ELEM | HASH_FUNCTION);
@@ -361,8 +361,8 @@ LockMethodTableInit(char *tabName,
* the same lock, additional information must be saved (locks per tx).
* -------------------------
*/
- info.keysize = XID_TAGSIZE;
- info.datasize = sizeof(XIDLookupEnt);
+ info.keysize = SHMEM_XIDTAB_KEYSIZE;
+ info.datasize = SHMEM_XIDTAB_DATASIZE;
info.hash = tag_hash;
hash_flags = (HASH_ELEM | HASH_FUNCTION);
@@ -1488,13 +1488,18 @@ LockShmemSize(int maxBackends)
/* lockHash table */
size += hash_estimate_size(NLOCKENTS(maxBackends),
- sizeof(LOCKTAG),
- sizeof(LOCK));
+ SHMEM_LOCKTAB_KEYSIZE,
+ SHMEM_LOCKTAB_DATASIZE);
/* xidHash table */
size += hash_estimate_size(maxBackends,
- XID_TAGSIZE,
- sizeof(XIDLookupEnt));
+ SHMEM_XIDTAB_KEYSIZE,
+ SHMEM_XIDTAB_DATASIZE);
+
+ /* Since the lockHash entry count above is only an estimate,
+ * add 10% safety margin.
+ */
+ size += size / 10;
return size;
}