release-23.2: execbuilder: fix a silly bug around finding the most recent full stat #148479
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 #148329.
/cc @cockroachdb/release
This commit fixes a bug that was added in 3bc0992. In short, in a complicated logical expression we had
v1 && v2 || v3when we wantedv1 && (v2 || v3). This allowed us to hit an index of bounds when evaluatingv3, which in this concrete case could mean that we iterated over all stats and didn't find any full ones.There are two other places with similar conditionals, and they have the correct usage of parenthesis, so I didn't change the structure overall.
Also the bug seems quite difficult to hit, so I omitted the release note.
Fixes: #148316.
Release note: None
Release justification: critical bug fix: we've seen this bug result in a failure to take a backup (#148316) since it can error out an internal query used by the backup (another example is #148414 with
read-role-with-membershipsinternal query). In the extreme, failure to backup data can result in a data loss.