On Thu, Dec 3, 2026 at 1:09 PM shihao zhong <[email protected]> wrote:
> The attached patch clears the flag only in the startup process, and
> adds a TAP test.

Thanks for the report and patch! Your analysis seems correct to me.

With this change, checkpointer (probably and also bgwriter ?) would acquire
ControlFileLock with LW_EXCLUSIVE mode on every call to
UpdateMinRecoveryPoint() during crash recovery, instead of returning
early after the first call. Could this have a performance impact,
or is it not worth worrying about?

ISTM that we could avoid this by taking ControlFileLock with LW_SHARED mode
when LocalMinRecoveryPoint is invalid, before proceeding to the existing path:

    if (!XLogRecPtrIsValid(LocalMinRecoveryPoint))
    {
        if (InRecovery)
        {
            updateMinRecoveryPoint = false;
            return;
        }

        LWLockAcquire(ControlFileLock, LW_SHARED);
        LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
        LWLockRelease(ControlFileLock);

        if (!XLogRecPtrIsValid(LocalMinRecoveryPoint))
            return;
    }

Is this worthwhile, or overkill?


Regarding the test change, does the test guarantee that the checkpointer
calls UpdateMinRecoveryPoint() before the startup process switches to
archive recovery? Requesting a restartpoint does not seem to guarantee
that ordering. No? I'm just concerned about that the test may pass without
the fix if the checkpointer runs too late. Thought?

Regards,

-- 
Fujii Masao


Reply via email to