• Tom Lane's avatar
    Fix isolationtester race condition for notices sent before blocking. · 30717637
    Tom Lane authored
    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 ebd49928, 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
    30717637
isolationtester.c 22.8 KB