Skip to content

Commit 8a21ac3

Browse files
craig[bot]fqazi
andcommitted
Merge #128630
128630: catalog/lease: fix incorrect version check for expiry based leases r=fqazi a=fqazi Previously, with the version bump on master to 24.3, we started using the bootstrap values for 24.1. When using these values in a dev environment, the comparison between the system descriptor and the session-based leasing version can fail, since the system database descriptor doesn't have the dev versions padding. To address this, this patch removes the dev offset from the comparison. Fixes: #128629 Release note: None Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
2 parents d4df563 + f8ae669 commit 8a21ac3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/sql/catalog/lease/count.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ func countLeasesWithDetail(
8686
systemDBVersion = &v
8787
}
8888
leasingDescIsSessionBased := systemDBVersion != nil &&
89-
systemDBVersion.AtLeast(clusterversion.V24_1_SessionBasedLeasingUpgradeDescriptor.Version())
89+
clusterversion.RemoveDevOffset(*systemDBVersion).AtLeast(
90+
clusterversion.RemoveDevOffset(clusterversion.V24_1_SessionBasedLeasingUpgradeDescriptor.Version()))
9091
leasingMode := readSessionBasedLeasingMode(ctx, settings)
9192
whereClauses := make([][]string, 2)
9293
containsSystemDatabase := false
@@ -116,13 +117,11 @@ func countLeasesWithDetail(
116117
// expiry based descriptor synthetically.
117118
if leasingDescIsSessionBased {
118119
syntheticDescriptors = append(syntheticDescriptors, systemschema.LeaseTable_V23_2())
119-
whereClauseIdx = append(whereClauseIdx, 0)
120-
usesOldSchema = append(usesOldSchema, true)
121120
} else {
122121
syntheticDescriptors = append(syntheticDescriptors, nil)
123-
whereClauseIdx = append(whereClauseIdx, 1)
124-
usesOldSchema = append(usesOldSchema, false)
125122
}
123+
whereClauseIdx = append(whereClauseIdx, 0)
124+
usesOldSchema = append(usesOldSchema, true)
126125
}
127126
if leasingMode >= SessionBasedDrain {
128127
// The leasing descriptor is not yet session based, so inject the session

0 commit comments

Comments
 (0)