@@ -1878,6 +1878,10 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
1878
1878
raftConfig := base.RaftConfig {
1879
1879
// Drop the raft tick interval so the Raft group is ticked more.
1880
1880
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 ,
1881
1885
// Reduce the max uncommitted entry size.
1882
1886
RaftMaxUncommittedEntriesSize : 64 << 10 , // 64 KB
1883
1887
// RaftProposalQuota cannot exceed RaftMaxUncommittedEntriesSize.
@@ -1886,12 +1890,6 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
1886
1890
RaftMaxInflightMsgs : 16 ,
1887
1891
RaftMaxSizePerMsg : 1 << 10 , // 1 KB
1888
1892
}
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
- }
1895
1893
1896
1894
const numServers int = 5
1897
1895
stickyServerArgs := make (map [int ]base.TestServerArgs )
@@ -1916,6 +1914,14 @@ func TestLogGrowthWhenRefreshingPendingCommands(t *testing.T) {
1916
1914
// Refresh pending commands on every Raft group tick instead of
1917
1915
// every RaftReproposalTimeoutTicks.
1918
1916
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
+ },
1919
1925
},
1920
1926
},
1921
1927
}
0 commit comments