Re: RecoveryInProgress() has critical side effects - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: RecoveryInProgress() has critical side effects
Date
Msg-id YawLYK/xuV3SxXIb@paquier.xyz
Whole thread Raw
In response to Re: RecoveryInProgress() has critical side effects  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: RecoveryInProgress() has critical side effects  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Tue, Nov 16, 2021 at 09:41:58AM -0500, Robert Haas wrote:
> Maybe I'm not understanding you properly here, but it seems like you
> might be forgetting that this is a local variable and thus every
> backend is going to have something different. In the startup process,
> it will be initialized by StartupXLOG(); in other processes, it's
> currently initialized by RecoveryInProgress(), but with this patch it
> wouldn't be. Either way, it's then updated by future calls to
> XLogInsertRecord() as required. XLOG_FPW_CHANGE records might affect
> the new value that gets set the next time XLogInsertRecord(), but they
> don't directly affect doPageWrites.

My main worry here is that this changes slightly the definition of
doPageWrites across stable branches at the end of recovery as there
could be records generated there.  Note that GetFullPageWriteInfo()
gets called in XLogInsert(), while Insert->fullPageWrites gets updated
before CleanupAfterArchiveRecovery().  And it may influence
the value of doPageWrites in the startup process.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: SPI TupTable memory context
Next
From: Michael Paquier
Date:
Subject: Re: Remove extra Logging_collector check before calling SysLogger_Start()