]> granicus.if.org Git - postgresql/commit
Fix isolationtester race condition for notices sent before blocking.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Jul 2019 00:21:54 +0000 (20:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Jul 2019 00:21:54 +0000 (20:21 -0400)
commit30717637c1c58fcd02980a6752c7e13c9de12b69
tree77a80d7e82ac45a51428c9d5d6b7a749d34d0821
parentebd49928215e3854d91167e798949a75b34958d0
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
src/test/isolation/expected/insert-conflict-specconflict.out
src/test/isolation/isolationtester.c
src/test/isolation/specs/insert-conflict-specconflict.spec