Stephen Frost <[email protected]> wrote:
> Tom Lane ([email protected]) wrote:
>> I'd be happy with "max_pred_locks_per_transaction" which gets the
>> worst case down without being too obviously at variance with
>> "max_locks_per_transaction".
>
> Sounds good to me. The header length for show all would drop to
> only 206 characters (or so) with that change.
Patch attached.
-Kevin
*** a/doc/src/sgml/config.sgml
--- b/doc/src/sgml/config.sgml
***************
*** 5188,5202 **** dynamic_library_path =
'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem>
</varlistentry>
! <varlistentry id="guc-max-predicate-locks-per-transaction"
xreflabel="max_predicate_locks_per_transaction">
! <term><varname>max_predicate_locks_per_transaction</varname>
(<type>integer</type>)</term>
<indexterm>
! <primary><varname>max_predicate_locks_per_transaction</> configuration
parameter</primary>
</indexterm>
<listitem>
<para>
The shared predicate lock table tracks locks on
! <varname>max_predicate_locks_per_transaction</varname> * (<xref
linkend="guc-max-connections"> + <xref
linkend="guc-max-prepared-transactions">) objects (e.g., tables);
hence, no more than this many distinct objects can be locked at
--- 5188,5202 ----
</listitem>
</varlistentry>
! <varlistentry id="guc-max-pred-locks-per-transaction"
xreflabel="max_pred_locks_per_transaction">
! <term><varname>max_pred_locks_per_transaction</varname>
(<type>integer</type>)</term>
<indexterm>
! <primary><varname>max_pred_locks_per_transaction</> configuration
parameter</primary>
</indexterm>
<listitem>
<para>
The shared predicate lock table tracks locks on
! <varname>max_pred_locks_per_transaction</varname> * (<xref
linkend="guc-max-connections"> + <xref
linkend="guc-max-prepared-transactions">) objects (e.g., tables);
hence, no more than this many distinct objects can be locked at
*** a/src/backend/storage/lmgr/predicate.c
--- b/src/backend/storage/lmgr/predicate.c
***************
*** 1874,1880 **** DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG
*newtargettag)
* thresholds are, either making it proportional to the number of
* tuples in a page & pages in a relation, or at least making it a
* GUC. Currently the threshold is 3 for a page lock, and
! * max_predicate_locks_per_transaction/2 for a relation lock, chosen
* entirely arbitrarily (and without benchmarking).
*/
static int
--- 1874,1880 ----
* thresholds are, either making it proportional to the number of
* tuples in a page & pages in a relation, or at least making it a
* GUC. Currently the threshold is 3 for a page lock, and
! * max_pred_locks_per_transaction/2 for a relation lock, chosen
* entirely arbitrarily (and without benchmarking).
*/
static int
***************
*** 2063,2069 **** CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_predicate_locks_per_transaction.")));
if (!found)
{
SHMQueueInit(&(target->predicateLocks));
--- 2063,2069 ----
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_pred_locks_per_transaction.")));
if (!found)
{
SHMQueueInit(&(target->predicateLocks));
***************
*** 2082,2088 **** CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_predicate_locks_per_transaction.")));
if (!found)
{
--- 2082,2088 ----
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_pred_locks_per_transaction.")));
if (!found)
{
***************
*** 2341,2347 **** PredicateLockTupleRowVersionLink(const Relation relation,
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_predicate_locks_per_transaction.")));
if (!found)
{
SHMQueueInit(&(newtarget->predicateLocks));
--- 2341,2347 ----
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to increase
max_pred_locks_per_transaction.")));
if (!found)
{
SHMQueueInit(&(newtarget->predicateLocks));
***************
*** 3337,3343 **** ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool
partial,
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to
increase max_predicate_locks_per_transaction.")));
if (found)
{
if (predlock->commitSeqNo < sxact->commitSeqNo)
--- 3337,3343 ----
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
! errhint("You might need to
increase max_pred_locks_per_transaction.")));
if (found)
{
if (predlock->commitSeqNo < sxact->commitSeqNo)
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 1725,1734 **** static struct config_int ConfigureNamesInt[] =
},
{
! {"max_predicate_locks_per_transaction", PGC_POSTMASTER,
LOCK_MANAGEMENT,
gettext_noop("Sets the maximum number of predicate
locks per transaction."),
gettext_noop("The shared predicate lock table is sized
on the assumption that "
! "at most max_predicate_locks_per_transaction *
max_connections distinct "
"objects will need to be
locked at any one time.")
},
&max_predicate_locks_per_xact,
--- 1725,1734 ----
},
{
! {"max_pred_locks_per_transaction", PGC_POSTMASTER,
LOCK_MANAGEMENT,
gettext_noop("Sets the maximum number of predicate
locks per transaction."),
gettext_noop("The shared predicate lock table is sized
on the assumption that "
! "at most max_pred_locks_per_transaction *
max_connections distinct "
"objects will need to be
locked at any one time.")
},
&max_predicate_locks_per_xact,
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers