Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: add DisableRaftLogQueue to StoreTestingKnobs #39160

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pkg/storage/raft_log_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,11 @@ func TestSnapshotLogTruncationConstraints(t *testing.T) {
func TestTruncateLog(t *testing.T) {
defer leaktest.AfterTest(t)()
tc := testContext{}
cfg := TestStoreConfig(nil)
cfg.TestingKnobs.DisableRaftLogQueue = true
stopper := stop.NewStopper()
defer stopper.Stop(context.TODO())
tc.Start(t, stopper)
tc.repl.store.SetRaftLogQueueActive(false)
tc.StartWithStoreConfig(t, stopper, cfg)

// Populate the log with 10 entries. Save the LastIndex after each write.
var indexes []uint64
Expand Down Expand Up @@ -887,10 +888,11 @@ func TestTruncateLogRecompute(t *testing.T) {
tc := testContext{
engine: eng,
}
cfg := TestStoreConfig(nil)
cfg.TestingKnobs.DisableRaftLogQueue = true
stopper := stop.NewStopper()
defer stopper.Stop(context.TODO())
tc.Start(t, stopper)
tc.repl.store.SetRaftLogQueueActive(false)
tc.StartWithStoreConfig(t, stopper, cfg)

key := roachpb.Key("a")
repl := tc.store.LookupReplica(keys.MustAddr(key))
Expand Down
11 changes: 6 additions & 5 deletions pkg/storage/replica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1285,10 +1285,10 @@ func TestReplicaTSCacheLowWaterOnLease(t *testing.T) {
tc := testContext{manualClock: hlc.NewManualClock(123)}
cfg := TestStoreConfig(hlc.NewClock(tc.manualClock.UnixNano, time.Nanosecond))
cfg.TestingKnobs.DisableAutomaticLeaseRenewal = true
// Disable raft log truncation which confuses this test.
cfg.TestingKnobs.DisableRaftLogQueue = true
tc.StartWithStoreConfig(t, stopper, cfg)

// Disable raft log truncation which confuses this test.
tc.store.SetRaftLogQueueActive(false)
secondReplica, err := tc.addBogusReplicaToRangeDesc(context.TODO())
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -6624,10 +6624,10 @@ func TestEntries(t *testing.T) {
// Disable ticks to avoid quiescence, which can result in empty
// entries being proposed and causing the test to flake.
cfg.RaftTickInterval = math.MaxInt32
cfg.TestingKnobs.DisableRaftLogQueue = true
stopper := stop.NewStopper()
defer stopper.Stop(context.TODO())
tc.StartWithStoreConfig(t, stopper, cfg)
tc.repl.store.SetRaftLogQueueActive(false)

repl := tc.repl
rangeID := repl.RangeID
Expand Down Expand Up @@ -6774,10 +6774,11 @@ func TestEntries(t *testing.T) {
func TestTerm(t *testing.T) {
defer leaktest.AfterTest(t)()
tc := testContext{}
tsc := TestStoreConfig(nil)
tsc.TestingKnobs.DisableRaftLogQueue = true
stopper := stop.NewStopper()
defer stopper.Stop(context.TODO())
tc.Start(t, stopper)
tc.repl.store.SetRaftLogQueueActive(false)
tc.StartWithStoreConfig(t, stopper, tsc)

repl := tc.repl
rangeID := repl.RangeID
Expand Down
3 changes: 3 additions & 0 deletions pkg/storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,9 @@ func NewStore(
if cfg.TestingKnobs.DisableMergeQueue {
s.setMergeQueueActive(false)
}
if cfg.TestingKnobs.DisableRaftLogQueue {
s.setRaftLogQueueActive(false)
}
if cfg.TestingKnobs.DisableReplicaGCQueue {
s.setReplicaGCQueueActive(false)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/storage/testing_knobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ type StoreTestingKnobs struct {
DisableGCQueue bool
// DisableMergeQueue disables the merge queue.
DisableMergeQueue bool
// DisableReplicateQueue disables the raft log queue.
DisableRaftLogQueue bool
// DisableReplicaGCQueue disables the replica GC queue.
DisableReplicaGCQueue bool
// DisableReplicateQueue disables the replication queue.
Expand Down