Re: Accept recovery conflict interrupt on blocked writing

Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>

From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-01-17T16:01:53Z
Lists: pgsql-hackers

Attachments

I've tested on a PG16, the issue is indeed triggered with the
replication blocked while the conflicting query is stuck in
ClientWrite.

I've cleaned up the tests: I've created a dedicated PgProto
(definitely open to suggestions for a better name...) module
containing all the helpers to send and receive messages on a raw
socket in 0001.

0002 contains the change with the test using the new PgProto module.
The failure on windows I had was due to using the wrong username. I
was using $USER variable env and I'm now getting the user from an
existing psql session instead. Also, I think the DoingBlockingWrite
variable was unnecessary? Calling ProcessRecoveryConflictInterrupts
should be enough as I don't think QueryCancelHoldoffCount can be >0
when writing on a socket it should always be able to cancel the
statement.