Skip to content

Commit

Permalink
revert commit 124aaa3
Browse files Browse the repository at this point in the history
The original attempt to fix this test introduced timing issues which
made this test flakey. This commit reverts all the changes to
TestStoreRangeSplitAndMergeWithGlobalReads.

Epic: none
Fixes: cockroachdb#119230

Release note: None
  • Loading branch information
andrewbaptist committed Apr 19, 2024
1 parent ed09fe2 commit 7994ae1
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions pkg/kv/kvserver/client_split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4042,17 +4042,10 @@ func TestStoreRangeSplitAndMergeWithGlobalReads(t *testing.T) {
}
return nil
}
// Set global reads.
zoneConfig := zonepb.DefaultZoneConfig()
zoneConfig.GlobalReads = proto.Bool(true)

ctx := context.Background()
s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{
Knobs: base.TestingKnobs{
Server: &server.TestingKnobs{
DefaultZoneConfigOverride: &zoneConfig,
},

Store: &kvserver.StoreTestingKnobs{
DisableMergeQueue: true,
TestingResponseFilter: respFilter,
Expand Down Expand Up @@ -4082,6 +4075,11 @@ func TestStoreRangeSplitAndMergeWithGlobalReads(t *testing.T) {
// response filter.
clockPtr.Store(s.Clock())

// Set global reads.
zoneConfig := zonepb.DefaultZoneConfig()
zoneConfig.GlobalReads = proto.Bool(true)
config.TestingSetZoneConfig(config.ObjectID(descID), zoneConfig)

// Perform a write to the system config span being watched by
// the SystemConfigProvider.
tdb.Exec(t, "CREATE TABLE foo ()")
Expand All @@ -4093,19 +4091,6 @@ func TestStoreRangeSplitAndMergeWithGlobalReads(t *testing.T) {
return nil
})

// The commit wait count is 1 due to the split above since global reads are
// set for the default config.
var splitCount = int64(1)
testutils.SucceedsSoon(t, func() error {
if splitCount != store.Metrics().CommitWaitsBeforeCommitTrigger.Count() {
return errors.Errorf("commit wait count is %d", store.Metrics().CommitWaitsBeforeCommitTrigger.Count())
}
if splitCount != atomic.LoadInt64(&splits) {
return errors.Errorf("num splits is %d", atomic.LoadInt64(&splits))
}
return nil
})

// Write to the range, which has the effect of bumping the closed timestamp.
pArgs := putArgs(descKey, []byte("foo"))
_, pErr = kv.SendWrapped(ctx, store.TestSender(), pArgs)
Expand All @@ -4116,9 +4101,8 @@ func TestStoreRangeSplitAndMergeWithGlobalReads(t *testing.T) {
splitArgs = adminSplitArgs(splitKey)
_, pErr = kv.SendWrapped(ctx, store.TestSender(), splitArgs)
require.Nil(t, pErr)
splitCount++
require.Equal(t, splitCount, store.Metrics().CommitWaitsBeforeCommitTrigger.Count())
require.Equal(t, splitCount, atomic.LoadInt64(&splits))
require.Equal(t, int64(1), store.Metrics().CommitWaitsBeforeCommitTrigger.Count())
require.Equal(t, int64(1), atomic.LoadInt64(&splits))

repl := store.LookupReplica(roachpb.RKey(splitKey))
require.Equal(t, splitKey, repl.Desc().StartKey.AsRawKey())
Expand All @@ -4127,7 +4111,7 @@ func TestStoreRangeSplitAndMergeWithGlobalReads(t *testing.T) {
mergeArgs := adminMergeArgs(descKey)
_, pErr = kv.SendWrapped(ctx, store.TestSender(), mergeArgs)
require.Nil(t, pErr)
require.Equal(t, splitCount+1, store.Metrics().CommitWaitsBeforeCommitTrigger.Count())
require.Equal(t, int64(2), store.Metrics().CommitWaitsBeforeCommitTrigger.Count())
require.Equal(t, int64(1), atomic.LoadInt64(&merges))

repl = store.LookupReplica(roachpb.RKey(splitKey))
Expand Down

0 comments on commit 7994ae1

Please sign in to comment.