From 47ca87d972c6ca696d77d336d4221eacb87bbb78 Mon Sep 17 00:00:00 2001 From: Andrew Baptist Date: Fri, 19 Apr 2024 10:00:32 -0400 Subject: [PATCH] revert test change from 124aaa3b00349f4240c3a078301686c2d8883eda 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: #119230 Release note: None --- pkg/kv/kvserver/client_split_test.go | 32 +++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/pkg/kv/kvserver/client_split_test.go b/pkg/kv/kvserver/client_split_test.go index 53ab78f3f48b..288186f24be8 100644 --- a/pkg/kv/kvserver/client_split_test.go +++ b/pkg/kv/kvserver/client_split_test.go @@ -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, @@ -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 ()") @@ -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) @@ -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()) @@ -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))