On 2025/05/31 0:28, Fujii Masao wrote:
Otherwise, maybe "log_lock_failures" would be better.
Yes, this seems better for consistency with log_lock_waits.
Patch attached.
Regards,
--
Fujii Masao
NTT DATA Japan Corporation
From 71f4c9cf71bff0edeae0077e95670569115ccc0f Mon Sep 17 00:00:00 2001
From: Fujii Masao <fu...@postgresql.org>
Date: Sat, 31 May 2025 00:47:44 +0900
Subject: [PATCH v1] Rename log_lock_failure GUC to log_lock_failures for
consistency.
This commit renames the GUC log_lock_failure to log_lock_failures
to align with the existing similar setting log_lock_waits, which uses
the plural form. This improves naming consistency across related GUCs.
Suggested-by: Peter Eisentraut <pe...@eisentraut.org>
Author: Fujii Masao <masao.fu...@gmail.com
Discussion:
https://postgr.es/m/7a8198b6-d5b8-4910-b41e-8d3efcbb0...@eisentraut.org
---
doc/src/sgml/config.sgml | 6 +++---
doc/src/sgml/release-18.sgml | 2 +-
src/backend/access/heap/heapam.c | 6 +++---
src/backend/access/heap/heapam_handler.c | 2 +-
src/backend/storage/lmgr/lock.c | 2 +-
src/backend/utils/misc/guc_tables.c | 4 ++--
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/storage/lock.h | 2 +-
8 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index f4a0191c55b..021153b2a5f 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7923,10 +7923,10 @@ log_line_prefix = '%m [%p] %q%u@%d/%a '
</listitem>
</varlistentry>
- <varlistentry id="guc-log-lock-failure" xreflabel="log_lock_failure">
- <term><varname>log_lock_failure</varname> (<type>boolean</type>)
+ <varlistentry id="guc-log-lock-failures" xreflabel="log_lock_failures">
+ <term><varname>log_lock_failures</varname> (<type>boolean</type>)
<indexterm>
- <primary><varname>log_lock_failure</varname> configuration
parameter</primary>
+ <primary><varname>log_lock_failures</varname> configuration
parameter</primary>
</indexterm>
</term>
<listitem>
diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml
index 3315ea52def..d7340465e79 100644
--- a/doc/src/sgml/release-18.sgml
+++ b/doc/src/sgml/release-18.sgml
@@ -727,7 +727,7 @@ Author: Fujii Masao <fu...@postgresql.org>
<listitem>
<para>
-Add server variable log_lock_failure to log lock acquisition failures (Yuki
Seino)
+Add server variable log_lock_failures to log lock acquisition failures (Yuki
Seino)
<ulink url="&commit_baseurl;6d376c3b0">§</ulink>
</para>
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 9ec8cda1c68..eec4eeb9919 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -4953,7 +4953,7 @@ l3:
case LockWaitError:
if
(!ConditionalMultiXactIdWait((MultiXactId) xwait,
status, infomask, relation,
-
NULL, log_lock_failure))
+
NULL, log_lock_failures))
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("could not obtain lock on row in relation \"%s\"",
@@ -4991,7 +4991,7 @@ l3:
}
break;
case LockWaitError:
- if
(!ConditionalXactLockTableWait(xwait, log_lock_failure))
+ if
(!ConditionalXactLockTableWait(xwait, log_lock_failures))
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("could not obtain lock on row in relation \"%s\"",
@@ -5256,7 +5256,7 @@ heap_acquire_tuplock(Relation relation, ItemPointer tid,
LockTupleMode mode,
break;
case LockWaitError:
- if (!ConditionalLockTupleTuplock(relation, tid, mode,
log_lock_failure))
+ if (!ConditionalLockTupleTuplock(relation, tid, mode,
log_lock_failures))
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("could not obtain lock
on row in relation \"%s\"",
diff --git a/src/backend/access/heap/heapam_handler.c
b/src/backend/access/heap/heapam_handler.c
index ac082fefa77..cb4bc35c93e 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -464,7 +464,7 @@ tuple_lock_retry:
return
TM_WouldBlock;
break;
case LockWaitError:
- if
(!ConditionalXactLockTableWait(SnapshotDirty.xmax, log_lock_failure))
+ if
(!ConditionalXactLockTableWait(SnapshotDirty.xmax, log_lock_failures))
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("could not obtain lock on row in relation \"%s\"",
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 86b06b9223f..2776ceb295b 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -51,7 +51,7 @@
/* GUC variables */
int max_locks_per_xact; /* used to set the lock table size
*/
-bool log_lock_failure = false;
+bool log_lock_failures = false;
#define NLOCKENTS() \
mul_size(max_locks_per_xact, add_size(MaxBackends, max_prepared_xacts))
diff --git a/src/backend/utils/misc/guc_tables.c
b/src/backend/utils/misc/guc_tables.c
index 2f8cbd86759..f04bfedb2fd 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -1602,11 +1602,11 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
{
- {"log_lock_failure", PGC_SUSET, LOGGING_WHAT,
+ {"log_lock_failures", PGC_SUSET, LOGGING_WHAT,
gettext_noop("Logs lock failures."),
NULL
},
- &log_lock_failure,
+ &log_lock_failures,
false,
NULL, NULL, NULL
},
diff --git a/src/backend/utils/misc/postgresql.conf.sample
b/src/backend/utils/misc/postgresql.conf.sample
index 87ce76b18f4..341f88adc87 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -624,7 +624,7 @@
# %% = '%'
# e.g. '<%u%%%d> '
#log_lock_waits = off # log lock waits >= deadlock_timeout
-#log_lock_failure = off # log lock failures
+#log_lock_failures = off # log lock failures
#log_recovery_conflict_waits = off # log standby recovery conflict waits
# >= deadlock_timeout
#log_parameter_max_length = -1 # when logging statements, limit logged
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 6f2108a44e8..4862b80eec3 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -30,7 +30,7 @@ typedef struct PGPROC PGPROC;
/* GUC variables */
extern PGDLLIMPORT int max_locks_per_xact;
-extern PGDLLIMPORT bool log_lock_failure;
+extern PGDLLIMPORT bool log_lock_failures;
#ifdef LOCK_DEBUG
extern PGDLLIMPORT int Trace_lock_oidmin;
--
2.49.0