Skip to content

Commit 1381de1

Browse files
committed
kvserver: deflake TestLogGrowthWhenRefreshingPendingCommands
Epic: none Release note: none
1 parent 892744f commit 1381de1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pkg/kv/kvserver/client_raft_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,10 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
18781878
raftConfig := base.RaftConfig{
18791879
// Drop the raft tick interval so the Raft group is ticked more.
18801880
RaftTickInterval: 10 * time.Millisecond,
1881+
// Suppress timeout-based elections to avoid leadership changes in ways
1882+
// this test doesn't expect. See DisablePreCampaignStoreLivenessCheck,
1883+
// which counteracts this knob's effect on leader leases.
1884+
RaftElectionTimeoutTicks: 1000000,
18811885
// Reduce the max uncommitted entry size.
18821886
RaftMaxUncommittedEntriesSize: 64 << 10, // 64 KB
18831887
// RaftProposalQuota cannot exceed RaftMaxUncommittedEntriesSize.
@@ -1886,12 +1890,6 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
18861890
RaftMaxInflightMsgs: 16,
18871891
RaftMaxSizePerMsg: 1 << 10, // 1 KB
18881892
}
1889-
// Suppress timeout-based elections to avoid leadership changes in ways this
1890-
// test doesn't expect. For leader leases, fortification itself provides us
1891-
// this guarantee.
1892-
if leaseType != roachpb.LeaseLeader {
1893-
raftConfig.RaftElectionTimeoutTicks = 1000000
1894-
}
18951893

18961894
const numServers int = 5
18971895
stickyServerArgs := make(map[int]base.TestServerArgs)
@@ -1916,6 +1914,14 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
19161914
// Refresh pending commands on every Raft group tick instead of
19171915
// every RaftReproposalTimeoutTicks.
19181916
RefreshReasonTicksPeriod: 1,
1917+
RaftTestingKnobs: &raft.TestingKnobs{
1918+
// Due to high RaftElectionTimeoutTicks, we only have one
1919+
// opportunity to campaign which should not be missed. Under
1920+
// leader leases, in a "cold" cluster, a campaign can fail due
1921+
// to missing store liveness support from the node's peers.
1922+
// Disallow this check to ensure that the campaign succeeds.
1923+
DisablePreCampaignStoreLivenessCheck: true,
1924+
},
19191925
},
19201926
},
19211927
}

0 commit comments

Comments
 (0)