Commit 5f1e802
sql: fix flaky TestIndexSplitAndScatterWithStats
The test was flaky because the stats cache could contain a stale entry
(populated during INSERT planning) when MaybeSplitIndexSpans ran during
CREATE INDEX. Despite its name, GetFreshTableStats returns cached data
without checking whether stats have been updated. The async cache
refresh triggered by CREATE STATISTICS may not complete in time.
Fix by invalidating the stats cache on all nodes after CREATE STATISTICS,
forcing a fresh read from the database.
Fixes: #170609
Release note: None
Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>1 parent 4c9163a commit 5f1e802
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
| |||
0 commit comments