Skip to content

Commit 5d7e8e4

Browse files
craig[bot]DarrylWongsumeerbholadt
committed
158016: mixedversion: add regression test for #157852 r=herkolategan a=DarrylWong Release note: none Epic: none 158343: mma: remove accidental duplicate comment r=wenyihu6 a=sumeerbhola Epic: CRDB-55052 Release note: None 158357: sql/ttl/ttljob: skip flaky TestRowLevelTTLJobMultipleNodes test r=yuzefovich a=dt Updates #158317. Release note: none. Epic: none. Co-authored-by: DarrylWong <darryl@cockroachlabs.com> Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com> Co-authored-by: David Taylor <davidt@davidt.io>
4 parents 1d3dc6f + 5cf1f6c + a199d8d + b6e051e commit 5d7e8e4

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

pkg/cmd/roachtest/roachtestutil/mixedversion/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ go_test(
5757
embed = [":mixedversion"],
5858
embedsrcs = ["testdata/test_releases.yaml"],
5959
deps = [
60+
"//pkg/build",
61+
"//pkg/clusterversion",
6062
"//pkg/cmd/roachtest/option",
6163
"//pkg/cmd/roachtest/registry",
6264
"//pkg/cmd/roachtest/roachtestutil",

pkg/cmd/roachtest/roachtestutil/mixedversion/mixedversion_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"math/rand"
1212
"testing"
1313

14+
"github.com/cockroachdb/cockroach/pkg/build"
15+
"github.com/cockroachdb/cockroach/pkg/clusterversion"
1416
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1517
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
1618
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestutil/clusterupgrade"
@@ -477,3 +479,37 @@ func TestSupportsSkipUpgradeTo(t *testing.T) {
477479
expect(v, false)
478480
}
479481
}
482+
483+
// Regression test for #157852.
484+
// This tests that our skip upgrade logic does not break when we are in the middle
485+
// of the version bump process. We bump the current version and the minSupportedVersion
486+
// separately, so we want to make sure that:
487+
// 1. supportsSkipUpgradeTo does not let us perform a skip upgrade from a non supportedVersion.
488+
// This edge case happens if we bump the minSupportedVersion first and there is only 1 supported
489+
// previous release in the current series despite being a .2 or .4 release.
490+
// 2. supportsSkipUpgradeTo does not let us perform a skip upgrade over a .2 or .4 release.
491+
// This edge case happens if we bump the current version first and there could be 3 supported
492+
// previous releases in the current series.
493+
func TestSupportsSkipCurrentVersion(t *testing.T) {
494+
mvt := newTest()
495+
496+
// Case 1: If the minimumSupportedVersion on the current release says there is only 1 supported
497+
// previous release, then it doesn't matter if the previous release is an innovation or not,
498+
// we can't skip over it.
499+
numSupportedVersions := len(clusterversion.SupportedPreviousReleases())
500+
501+
// Case 2: If the current release is an innovation release, it means the previous release
502+
// is _not_ an innovation, i.e. we can't skip over it.
503+
currentRelease := clusterversion.Latest.ReleaseSeries()
504+
isInnovationRelease := currentRelease.Minor == 1 || currentRelease.Minor == 3
505+
506+
// We can only perform a skip upgrade to the current version if it's not an innovation and
507+
// there are multiple supported previous versions.
508+
expected := !isInnovationRelease && numSupportedVersions > 1
509+
510+
// N.B. The predecessor is only used to determine if we should skip over the
511+
// mixedversion test's minimum supported version, and not relevant for this test.
512+
pred := clusterupgrade.MustParseVersion("24.2.1")
513+
actual := mvt.supportsSkipUpgradeTo(pred, &clusterupgrade.Version{Version: version.MustParse(build.BinaryVersion())})
514+
require.Equal(t, expected, actual)
515+
}

pkg/kv/kvserver/allocator/mmaprototype/cluster_state_rebalance_stores.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,6 @@ func (re *rebalanceEnv) rebalanceLeasesFromLocalStoreID(
523523
log.KvDistribution.VEventf(ctx, 2, "local store s%d is CPU overloaded (%v >= %v), attempting lease transfers first",
524524
store.StoreID, store.dimSummary[CPURate], overloadSlow)
525525
// This store is local, and cpu overloaded. Shed leases first.
526-
//
527-
// NB: due to REQUIREMENT(change-computation), the top-k ranges for ss
528-
// reflect the latest adjusted state, including pending changes. Thus,
529-
// this store must be a replica and the leaseholder, which is asserted
530-
// below. The code below additionally ignores the range if it has pending
531-
// changes, which while not necessary for the is-leaseholder assertion,
532-
// makes the case where we assert even narrower.
533526
topKRanges := ss.adjusted.topKRanges[localStoreID]
534527
var leaseTransferCount int
535528
n := topKRanges.len()

pkg/sql/ttl/ttljob/ttljob_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ INSERT INTO t (id, crdb_internal_expiration) VALUES (1, now() - '1 month'), (2,
593593
func TestRowLevelTTLJobMultipleNodes(t *testing.T) {
594594
defer leaktest.AfterTest(t)()
595595
defer log.Scope(t).Close(t)
596+
skip.WithIssue(t, 158317)
596597

597598
skip.UnderRace(t, "the test times out under race")
598599

0 commit comments

Comments
 (0)