Re: low wal_retrieve_retry_interval causes missed signals on Windows - Mailing list pgsql-hackers

From Andres Freund
Subject Re: low wal_retrieve_retry_interval causes missed signals on Windows
Date
Msg-id 20230111204836.rqzzbcufc7gziidx@awork3.anarazel.de
Whole thread Raw
In response to low wal_retrieve_retry_interval causes missed signals on Windows  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: low wal_retrieve_retry_interval causes missed signals on Windows
List pgsql-hackers
Hi,

On 2023-01-10 22:11:16 -0800, Nathan Bossart wrote:
> The attached patch fixes this by always calling WaitLatch(), even if
> wal_retrieve_retry_interval milliseconds have already elapsed and the
> timeout is 0.

It doesn't seem right to call WaitLatch() just for that purpose - nor
necessarily a complete fix.

Given that we check for interrupts in other parts of recovery with
HandleStartupProcInterrupt(), which doesn't interact with latches, isn't the
actual bug that HandleStartupProcInterrupt() doesn't contain the same black
magic that CHECK_FOR_INTERRUPTS() contains on windows?  Namely this stuff:


#ifndef WIN32
...
#else
#define INTERRUPTS_PENDING_CONDITION() \
    (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \
     unlikely(InterruptPending))
#endif

/* Service interrupt, if one is pending and it's safe to service it now */
#define CHECK_FOR_INTERRUPTS() \
do { \
    if (INTERRUPTS_PENDING_CONDITION()) \
        ProcessInterrupts(); \
} while(0)


Looks like we have that bug in quite a few places... Some are "protected" by
unconditional WaitLatch() calls, but at least pgarch.c, checkpointer.c via
CheckpointWriteDelay() seem borked.


Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: logical decoding and replication of sequences, take 2
Next
From: Andres Freund
Date:
Subject: Re: logical decoding and replication of sequences, take 2