Re: Add “FOR UPDATE NOWAIT” lock details to the log.

Yuki Seino <seinoyu@oss.nttdata.com>

From: Yuki Seino <seinoyu@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2024-12-19T08:21:20Z
Lists: pgsql-hackers

Attachments

> I will design a new GUC while ensuring consistency with 'log_lock_waits'.
>
>> Regarding the patch, when I applied it to HEAD, it failed to compile 
>> with
>> the following errors. Could you update the patch to address this?
>>
>> proc.c:1538:20: error: use of undeclared identifier 'buf'
>>  1538 |                         initStringInfo(&buf);
>>       |                                         ^
>> proc.c:1539:20: error: use of undeclared identifier 'lock_waiters_sbuf'
>>  1539 | initStringInfo(&lock_waiters_sbuf);
>>       |                                         ^
>> proc.c:1540:20: error: use of undeclared identifier 'lock_holders_sbuf'
>>  1540 | initStringInfo(&lock_holders_sbuf);
>>       |                                         ^
>> ....
>
> Conflicted with another commit [1]. I'll rebase it later.
>
>
> [1] 
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=3c0fd64fec8ed6fa3987c33f076fcffbc3f268c3
Rebased and added new GUC log_lock_failure and minor fixes. Currently 
only NOWAIT errors are supported.
I would like to revisit the possibility of extending this GUC to include
client cancellations and lock timeouts at another opportunity.

-- 
Regards,
Yuki Seino
NTT DATA GROUP CORPORATION

Commits

  1. Rename log_lock_failure GUC to log_lock_failures for consistency.

  2. Add GUC option to log lock acquisition failures.

  3. Split ProcSleep function into JoinWaitQueue and ProcSleep