Skip to content

Commit

Permalink
opt: fix flake in TestExecBuild due to new stats cache refresh mechanism
Browse files Browse the repository at this point in the history
This commit fixes a flake caused by the new stats cache update mechanism,
which refreshes the stats asynchronously. The solution is to retry the
test query until the new stats are available in the cache.

Fixes cockroachdb#50863

Release note: None
  • Loading branch information
rytaft committed Jul 31, 2020
1 parent c821d52 commit ee258ac
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/sql/opt/exec/execbuilder/testdata/stats
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,26 @@ statement ok
CREATE STATISTICS u ON u FROM uv;
CREATE STATISTICS v ON v FROM uv

query TTIIIB colnames
SELECT
statistics_name,
column_names,
row_count,
distinct_count,
null_count,
histogram_id IS NOT NULL AS has_histogram
FROM
[SHOW STATISTICS FOR TABLE uv]
----
statistics_name column_names row_count distinct_count null_count has_histogram
u {u} 8 2 0 true
v {v} 8 7 0 true

statement ok
set enable_zigzag_join = false

# Verify we scan index v which has the more selective constraint.
query TTTTT
query TTTTT retry
EXPLAIN (VERBOSE) SELECT * FROM uv WHERE u = 1 AND v = 1
----
· distributed true · ·
Expand Down

0 comments on commit ee258ac

Please sign in to comment.