diff options
author | Fujii Masao <fujii@postgresql.org> | 2025-03-14 23:14:12 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2025-03-14 23:14:12 +0900 |
commit | 6d376c3b0d1e79c318d2a1c04097025784e28377 (patch) | |
tree | d1ed6941bfa91892223567b1aa2659a31abc660f /src/backend/utils/misc/guc_tables.c | |
parent | e80171d57c25caf4362a7de17e96195f905386ea (diff) | |
download | postgresql-6d376c3b0d1e79c318d2a1c04097025784e28377.tar.gz postgresql-6d376c3b0d1e79c318d2a1c04097025784e28377.zip |
Add GUC option to log lock acquisition failures.
This commit introduces a new GUC, log_lock_failure, which controls whether
a detailed log message is produced when a lock acquisition fails. Currently,
it only supports logging lock failures caused by SELECT ... NOWAIT.
The log message includes information about all processes holding or
waiting for the lock that couldn't be acquired, helping users analyze and
diagnose the causes of lock failures.
Currently, this option does not log failures from SELECT ... SKIP LOCKED,
as that could generate excessive log messages if many locks are skipped,
causing unnecessary noise.
This mechanism can be extended in the future to support for logging
lock failures from other commands, such as LOCK TABLE ... NOWAIT.
Author: Yuki Seino <seinoyu@oss.nttdata.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/411280a186cc26ef7034e0f2dfe54131@oss.nttdata.com
Diffstat (limited to 'src/backend/utils/misc/guc_tables.c')
-rw-r--r-- | src/backend/utils/misc/guc_tables.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 508970680d1..9c0b10ad4dc 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -1586,6 +1586,15 @@ struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, { + {"log_lock_failure", PGC_SUSET, LOGGING_WHAT, + gettext_noop("Logs lock failures."), + NULL + }, + &log_lock_failure, + false, + NULL, NULL, NULL + }, + { {"log_recovery_conflict_waits", PGC_SIGHUP, LOGGING_WHAT, gettext_noop("Logs standby recovery conflict waits."), NULL |