pgsql: Fix isolationtester race condition for notices sent beforeblock - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix isolationtester race condition for notices sent beforeblock
Date
Msg-id E1hrWx3-0002E6-Se@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix isolationtester race condition for notices sent before blocking.

If a test sends a notice just before blocking, it's possible on
slow machines for isolationtester to detect the blocked state before
it's consumed the notice.  (For this to happen, the notice would have
to arrive after isolationtester has waited for data for 10ms, so on
fast/lightly-loaded machines it's hard to reproduce the failure.)
But, if we have seen the backend as blocked, it's certainly already
sent any notices it's going to send.  Therefore, one more round of
PQconsumeInput and PQisBusy should be enough to collect and process
any such notices.

This appears to explain the instability noted in commit ebd499282, so undo
the hack therein to not print notices from insert-conflict-specconflict.

Patch by me, diagnosis by Andres Freund.

Discussion: https://postgr.es/m/14616.1564251339@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/30717637c1c58fcd02980a6752c7e13c9de12b69

Modified Files
--------------
.../expected/insert-conflict-specconflict.out      | 38 ++++++++++++++++++++++
src/test/isolation/isolationtester.c               | 22 +++++++++++++
.../specs/insert-conflict-specconflict.spec        |  6 ----
3 files changed, 60 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Don't drop NOTICE messages in isolation tests.
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix typo in fd.c