• Tom Lane's avatar
    Avoid hard-wired sleep delays in stats regression test. · 4e37b3e1
    Tom Lane authored
    On faster machines, the overall runtime for running the core regression
    tests is under twenty seconds these days, of which the hard-wired delays
    in the stats test are a significant fraction.  But on closer inspection,
    it seems like we shouldn't need those.
    
    The initial 2-second delay is there only to reduce the risk of the test's
    stats messages not getting sent due to contention.  But analysis of the
    last ten years' worth of buildfarm runs shows no evidence that such
    failures actually occur.  (We do see failures that look like stats
    messages not getting sent, particularly on Windows; but there is little
    reason to believe that the initial delay reduces their frequency.)
    
    The later 1-second delay is there to ensure that our session's stats
    will have gotten sent.  But we could also do that by starting a fresh
    session, which takes well under 1 second even on very slow machines.
    
    Hence, let's remove both delays and see what happens.  The first delay
    was the only test of pg_sleep_for() in the regression tests, but we can
    move that responsibility into wait_for_stats().
    
    Discussion: https://postgr.es/m/17795.1493869423@sss.pgh.pa.us
    4e37b3e1
stats.sql 5.84 KB