Skip to content

Commit 2e43ba7

Browse files
committed
raft: remove test-only deps on maxApplyingEntsSize
Epic: none Release note: none
1 parent 0cbfd4a commit 2e43ba7

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

pkg/raft/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func (l *raftLog) nextCommittedEnts(allowUnstable bool) (ents []pb.Entry) {
292292
if span.Empty() {
293293
return nil
294294
}
295-
ents, err := l.slice(uint64(span.After), uint64(span.Last), l.maxApplyingEntsSize)
295+
ents, err := l.slice(uint64(span.After), uint64(span.Last), noLimit)
296296
if err != nil {
297297
l.logger.Panicf("unexpected error when getting unapplied entries (%v)", err)
298298
}

pkg/raft/node_test.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,9 @@ func TestAppendPagination(t *testing.T) {
591591
}
592592

593593
func TestCommitPagination(t *testing.T) {
594+
const maxCommittedSize = 2048
594595
s := newTestMemoryStorage(withPeers(1))
595-
cfg := newTestConfig(1, 10, 1, s)
596-
cfg.MaxCommittedSizePerReady = 2048
597-
rn, err := NewRawNode(cfg)
598-
require.NoError(t, err)
599-
596+
rn := newTestRawNode(1, 10, 1, s)
600597
require.NoError(t, rn.Campaign())
601598

602599
// Persist vote.
@@ -630,17 +627,15 @@ func TestCommitPagination(t *testing.T) {
630627
rd = rn.Ready()
631628
// TODO(pav-kv): we no longer need this test after the flow control policy is
632629
// moved up the stack.
633-
committed, err := rn.LogSnapshot().Slice(
634-
rd.Committed, uint64(rn.raft.raftLog.maxApplyingEntsSize))
630+
committed, err := rn.LogSnapshot().Slice(rd.Committed, maxCommittedSize)
635631
require.NoError(t, err)
636632
require.Len(t, committed, 2)
637633
require.NoError(t, s.Append(rd.Entries))
638634
rn.AdvanceHack(rd)
639635
rn.AckApplied(committed)
640636

641637
rd = rn.Ready()
642-
committed, err = rn.LogSnapshot().Slice(
643-
rd.Committed, uint64(rn.raft.raftLog.maxApplyingEntsSize))
638+
committed, err = rn.LogSnapshot().Slice(rd.Committed, maxCommittedSize)
644639
require.NoError(t, err)
645640
require.Len(t, committed, 1)
646641
require.NoError(t, s.Append(rd.Entries))

0 commit comments

Comments
 (0)