release-23.2: sqlstats: add retries to stats test on locked table #120010
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #119977 on behalf of @dhartunian.
/cc @cockroachdb/release
Previously, the
TestSQLStatsReadLimitSizeOnLockedTable
test would fail very occasionally due to a rare scenario. When stats are written, they contain a column that's a hashed shard index. It's expected that statements are uniformly distributed across this shard, but that's not guaranteed. Later in the test we check a random shard to make sure its stats count exceeds a minimum of 1 (because we place a total lower bound of 8 in the cluster setting, which is then divided by 8 to derive the per-shard limit). This case will occasionally fail if the random shard that's picked happens to only contain a single statement within.This change modifies the loop at the end of the test to expect a
false
value and make sure to get at least a singletrue
result after 3 iterations, instead of requiring 3true
results every single time. The requirement that the queries run despite contention will still stand since we'll return an error in that case.Resolves: #119067
Epic: None
Release note: None
Release justification: