postgres.git / summary / log / commit / refs

commit    c4118d3b9bf4273a2877ea20ff6ccb337dbb5abf
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Mon May 15 01:39:10 2017 +0000
First released in: 10.0, 9.6.4

    Make stats regression test more robust in the face of parallel query.
    
    Commit 60690a6fe attempted to fix the wait_for_stats() function in this
    test so that it would wait properly if the tenk2 scans were done in
    parallel workers instead of the main session (typically as a consequence of
    force_parallel_mode being turned on).  However, we made it test for whether
    the main session's actions had been reported by looking for inserts on
    'trunc_stats_test'.  This is the Wrong Thing, because those aren't the last
    updates we expect the main session to do.  As shown by recent failures on
    buildfarm member frogmouth, it's entirely likely that the trunc_stats_test
    updates will be reported in a separate message from later updates, which
    means there can be a window in which wait_for_stats() will exit but not all
    the updates we are expecting to see will have arrived.  We should test for
    the last updates we're expecting, namely those on 'trunc_stats_test4'.
    
    Unfortunately, I doubt that this explains frogmouth's failures, because
    there's no reason to believe that it's running the tenk2 queries in
    parallel.  Still, the test is wrong on its own terms, so fix and back-patch
    to 9.6 where parallel query came in.


src/test/regress/expected/stats.out | 4 ++-- src/test/regress/sql/stats.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out index a811265d69e..4f397a32804 100644 --- a/src/test/regress/expected/stats.out +++ b/src/test/regress/expected/stats.out @@ -59,9 +59,9 @@ begin FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr WHERE st.relname='tenk2' AND cl.relname='tenk2'; - -- check to see if updates have been sensed + -- check to see if all updates have been sensed SELECT (n_tup_ins > 0) INTO updated3 - FROM pg_stat_user_tables WHERE relname='trunc_stats_test'; + FROM pg_stat_user_tables WHERE relname='trunc_stats_test4'; exit when updated1 and updated2 and updated3; diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql index b3e2efa5354..521dc4d6a34 100644 --- a/src/test/regress/sql/stats.sql +++ b/src/test/regress/sql/stats.sql @@ -54,9 +54,9 @@ begin FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr WHERE st.relname='tenk2' AND cl.relname='tenk2'; - -- check to see if updates have been sensed + -- check to see if all updates have been sensed SELECT (n_tup_ins > 0) INTO updated3 - FROM pg_stat_user_tables WHERE relname='trunc_stats_test'; + FROM pg_stat_user_tables WHERE relname='trunc_stats_test4'; exit when updated1 and updated2 and updated3; [parent: 69db3b0cfccc]