On 2023-Dec-02, Ivan Trofimov wrote:
> Thank you for looking into this, much appreciated.
>
> Yes, I can confirm that the patch fixes both the busy-loop and
> client<->server desynchronization problem for me.
Great, thanks for the confirmation.
Mulling it over while writing better comments for it, I realized that it
could still be somewhat brittle, and it's also confusing that part of
the logic is in PQgetResult and the rest in pqCommandQueueAdvance; so I
moved it all to the latter, which also lets me document it more clearly
in the comments. I addressed the brittleness by changing what to test:
instead of just "it's an error, then do nothing if the queue has a
SYNC", we can verify that we actually have a matching SYNC in both
places. This seems much better.
Patch v2 attached. I'll be pushing this to 14+ tomorrow, unless
something ugly comes up.
Thanks for reporting this problem!
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)