Re: Logging in LockBufferForCleanup()

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Fujii Masao <fujii(at)postgresql(dot)org>
Subject: Re: Logging in LockBufferForCleanup()
Date: 2022-02-10 15:47:50
Message-ID: 9b446d57-481d-e65e-4f17-ccd4e90f82e3@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/02/10 20:28, Masahiko Sawada wrote:
> While I understand that these are theoretically valid concerns, it’s
> unclear to me how much the current code leads to bad effects in
> practice. There are other low-level codes/paths that call palloc()
> while holding LWLocks, and I’m not sure that the overheads result in
> visible negative performance impact particularly because the calling
> to LockBufferForCleanup() is likely to accompany wait in the first
> place.

I'm also not sure that. palloc() for PS display, copy of process title, GetCurrentTimestamp() and ereport() of recovery conflict happen when we fail to acquire the lock. In this case we also call ResolveRecoveryConflictWithBufferPin() and wait to be signaled there. So compared to the wait time or overhead caused in ResolveRecoveryConflictWithBufferPin(), ISTM that the overhead caused by them would be ralatively small. Also ereport() of recovery conflict can happen only when log_recovery_conflict_waits parameter is enabled and the deadlock timeout happens during the lock wait.

> BTW I think calling to LockBufferForCleanup() in a critical
> section is a bad idea for sure since it becomes uninterruptible.

Yes. And as far as I tested, currently LockBufferForCleanup() is not called in critical section. Right?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari Mannsåker 2022-02-10 15:53:02 Re: faulty link
Previous Message Robert Haas 2022-02-10 15:32:42 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints