pgsql: Make stats regression test robust in the face of parallel query. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make stats regression test robust in the face of parallel query.
Date
Msg-id E1abx9j-000811-Sw@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make stats regression test robust in the face of parallel query.

Historically, the wait_for_stats() function in this test has simply checked
for a report of an indexscan on tenk2, corresponding to the last command
issued before we expect stats updates to appear.  However, with parallel
query that indexscan could be done by a parallel worker that will emit
its stats counters to the collector before the session's main backend does
(a full second before, in fact, thanks to the "pg_sleep(1.0)" added by
commit 957d08c81f9cc277).  That leaves a sizable window in which an
autovacuum-triggered write of the stats files would present a state in
which the indexscan on tenk2 appears to have been done, but none of the
write updates performed by the test have been.  This is evidently the
explanation for intermittent failures seen by me and on buildfarm member
mandrill.

To fix, we should check separately for both the tenk2 seqscan and indexscan
counts, since those might be reported by different processes that could be
delayed arbitrarily on an overloaded test machine.  And we need to check
for at least one update-related count.  If we ever allow parallel workers
to do writes, this will get even more complicated ... but in view of all
the other hard problems that will entail, I don't feel a need to solve this
one today.

Per research by Rahila Syed and myself; part of this patch is Rahila's.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/60690a6fe8351995b1eeb9a53f2b634c3bce3a3d

Modified Files
--------------
src/test/regress/expected/stats.out | 24 ++++++++++++++++++++----
src/test/regress/sql/stats.sql      | 24 ++++++++++++++++++++----
2 files changed, 40 insertions(+), 8 deletions(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Fix typo in comment.
Next
From: Fujii Masao
Date:
Subject: pgsql: Ignore recovery_min_apply_delay until recovery has reached consi