Skip to content

Commit cecb590

Browse files
committed
Allocate all entries in the serializable xid hash up-front, so that you don't
run out of shared memory when you try to assign an xid to a transaction. Kevin Grittner
1 parent 2ad0348 commit cecb590

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/backend/storage/lmgr/predicate.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,6 @@ InitPredicateLocks(void)
10181018
* PredicateLockShmemSize!
10191019
*/
10201020
max_table_size = (MaxBackends + max_prepared_xacts);
1021-
init_table_size = max_table_size / 2;
10221021

10231022
/*
10241023
* Allocate a list to hold information on transactions participating in
@@ -1029,7 +1028,6 @@ InitPredicateLocks(void)
10291028
* be summarized for storage in SLRU and the "dummy" transaction.
10301029
*/
10311030
max_table_size *= 10;
1032-
init_table_size *= 10;
10331031

10341032
PredXact = ShmemInitStruct("PredXactList",
10351033
PredXactListDataSize,
@@ -1092,7 +1090,7 @@ InitPredicateLocks(void)
10921090
hash_flags = (HASH_ELEM | HASH_FUNCTION);
10931091

10941092
SerializableXidHash = ShmemInitHash("SERIALIZABLEXID hash",
1095-
init_table_size,
1093+
max_table_size,
10961094
max_table_size,
10971095
&info,
10981096
hash_flags);
@@ -1595,10 +1593,10 @@ RegisterPredicateLockingXid(const TransactionId xid)
15951593
&sxidtag,
15961594
HASH_ENTER, &found);
15971595
if (!sxid)
1596+
/* This should not be possible, based on allocation. */
15981597
ereport(ERROR,
15991598
(errcode(ERRCODE_OUT_OF_MEMORY),
1600-
errmsg("out of shared memory"),
1601-
errhint("You might need to increase max_predicate_locks_per_transaction.")));
1599+
errmsg("out of shared memory")));
16021600

16031601
Assert(!found);
16041602

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy