Skip to content

Commit

Permalink
backupccl: add metamorphic test param for small engine blocks
Browse files Browse the repository at this point in the history
Uses a Pebble block size of 1 byte, to provoke bugs in time-bound
iterators.

Release note: None
  • Loading branch information
erikgrinaker committed Sep 30, 2022
1 parent 248cabd commit 06b8405
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/ccl/backupccl/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/log/eventpb"
Expand All @@ -60,6 +61,11 @@ const (
localFoo = "nodelocal://0/foo"
)

// smallEngineBlocks configures Pebble with a block size of 1 byte, to provoke
// bugs in time-bound iterators. We disable this in race builds, which can
// be too slow.
var smallEngineBlocks = !util.RaceEnabled && util.ConstantWithMetamorphicTestBool("small-engine-blocks", false)

func backupRestoreTestSetupWithParams(
t testing.TB,
clusterSize int,
Expand Down Expand Up @@ -90,6 +96,13 @@ func backupRestoreTestSetupWithParams(
}
}

if smallEngineBlocks {
if params.ServerArgs.Knobs.Store == nil {
params.ServerArgs.Knobs.Store = &kvserver.StoreTestingKnobs{}
}
params.ServerArgs.Knobs.Store.(*kvserver.StoreTestingKnobs).SmallEngineBlocks = true
}

tc = testcluster.StartTestCluster(t, clusterSize, params)
init(tc)

Expand Down Expand Up @@ -168,6 +181,14 @@ func backupRestoreTestSetupEmptyWithParams(
params.ServerArgsPerNode[i] = param
}
}

if smallEngineBlocks {
if params.ServerArgs.Knobs.Store == nil {
params.ServerArgs.Knobs.Store = &kvserver.StoreTestingKnobs{}
}
params.ServerArgs.Knobs.Store.(*kvserver.StoreTestingKnobs).SmallEngineBlocks = true
}

tc = testcluster.StartTestCluster(t, clusterSize, params)
init(tc)

Expand All @@ -192,6 +213,9 @@ func createEmptyCluster(
// Disabling the default test tenant due to test failures. More
// investigation is required. Tracked with #76378.
params.ServerArgs.DisableDefaultTestTenant = true
params.ServerArgs.Knobs.Store = &kvserver.StoreTestingKnobs{
SmallEngineBlocks: smallEngineBlocks,
}
tc := testcluster.StartTestCluster(t, clusterSize, params)

sqlDB = sqlutils.MakeSQLRunner(tc.Conns[0])
Expand Down

0 comments on commit 06b8405

Please sign in to comment.