release-25.4: sql: sort rulesForRelease versions in descending order #156414
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 #156374.
/cc @cockroachdb/release
This PR fixes incorrect ordering in the
rulesForReleasesarray:Background
The
rulesForReleasesarray inpkg/sql/schemachanger/scplan/plan.gostores schema changer rule registries for different cluster versions. The array is documented to be in descending order (newest version first), and theGetRulesRegistryForRelease()function depends on this ordering to correctly match cluster versions with their corresponding rule sets.Bug
The array had V25_2 and V25_3 in ascending order instead of descending:
Before (incorrect):
After (correct):
Impact
GetRulesRegistryForRelease()iterates through the array in order and returns the first entry whereactiveVersion.IsActive()is true. With the incorrect ascending order, a cluster running version 25.3 would incorrectly get the 25.2 rules instead of the 25.3 rules.Changes
pkg/sql/schemachanger/scplan/plan.gopkg/cli/testdata/declarative-rules/invalid_versionpkg/cli/testdata/declarative-rules/deprulesEpic: None
Release note (bug fix): Fix rulesForReleases ordering to correctly match cluster versions with schema changer rule sets.
Release justification:
GetRulesRegistryForRelease()iterates through the array in order and returns the first entry whereactiveVersion.IsActive()is true. With the incorrect ascending order, a cluster running version 25.3 would incorrectly get the 25.2 rules instead of the 25.3 rules.