@@ -12,7 +12,7 @@ import (
12
12
"testing"
13
13
14
14
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
15
- "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverpb "
15
+ "github.com/cockroachdb/cockroach/pkg/kv/kvserver/logstore "
16
16
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/print"
17
17
"github.com/cockroachdb/cockroach/pkg/raft/raftpb"
18
18
"github.com/cockroachdb/cockroach/pkg/roachpb"
@@ -64,20 +64,20 @@ func TestSynthesizeHardState(t *testing.T) {
64
64
tHS := raftpb.HardState {Term : 2 , Vote : 3 , Commit : 4 , Lead : 5 , LeadEpoch : 6 }
65
65
66
66
testCases := []struct {
67
- TruncTerm kvpb.RaftTerm
68
- RaftAppliedIndex kvpb.RaftIndex
69
- OldHS * raftpb.HardState
70
- NewHS raftpb.HardState
71
- Err string
67
+ AppliedTerm kvpb.RaftTerm
68
+ AppliedIndex kvpb.RaftIndex
69
+ OldHS * raftpb.HardState
70
+ NewHS raftpb.HardState
71
+ Err string
72
72
}{
73
- {OldHS : nil , TruncTerm : 42 , RaftAppliedIndex : 24 , NewHS : raftpb.HardState {Term : 42 , Vote : 0 , Commit : 24 }},
73
+ {OldHS : nil , AppliedTerm : 42 , AppliedIndex : 24 , NewHS : raftpb.HardState {Term : 42 , Vote : 0 , Commit : 24 }},
74
74
// Can't wind back the committed index of the new HardState.
75
- {OldHS : & tHS , RaftAppliedIndex : kvpb .RaftIndex (tHS .Commit - 1 ), Err : "can't decrease HardState.Commit" },
76
- {OldHS : & tHS , RaftAppliedIndex : kvpb .RaftIndex (tHS .Commit ), NewHS : tHS },
77
- {OldHS : & tHS , RaftAppliedIndex : kvpb .RaftIndex (tHS .Commit + 1 ), NewHS : raftpb.HardState {Term : tHS .Term , Vote : 3 , Commit : tHS .Commit + 1 , Lead : 5 , LeadEpoch : 6 }},
75
+ {OldHS : & tHS , AppliedIndex : kvpb .RaftIndex (tHS .Commit - 1 ), Err : "can't decrease HardState.Commit" },
76
+ {OldHS : & tHS , AppliedIndex : kvpb .RaftIndex (tHS .Commit ), NewHS : tHS },
77
+ {OldHS : & tHS , AppliedIndex : kvpb .RaftIndex (tHS .Commit + 1 ), NewHS : raftpb.HardState {Term : tHS .Term , Vote : 3 , Commit : tHS .Commit + 1 , Lead : 5 , LeadEpoch : 6 }},
78
78
// Higher Term is picked up, but Vote, Lead, and LeadEpoch aren't carried
79
79
// over when the term changes.
80
- {OldHS : & tHS , RaftAppliedIndex : kvpb .RaftIndex (tHS .Commit ), TruncTerm : 11 , NewHS : raftpb.HardState {Term : 11 , Vote : 0 , Commit : tHS .Commit , Lead : 0 }},
80
+ {OldHS : & tHS , AppliedIndex : kvpb .RaftIndex (tHS .Commit ), AppliedTerm : 11 , NewHS : raftpb.HardState {Term : 11 , Vote : 0 , Commit : tHS .Commit , Lead : 0 }},
81
81
}
82
82
83
83
for i , test := range testCases {
@@ -97,9 +97,8 @@ func TestSynthesizeHardState(t *testing.T) {
97
97
t .Fatal (err )
98
98
}
99
99
100
- err = rsl .SynthesizeHardState (
101
- context .Background (), batch , oldHS , kvserverpb.RaftTruncatedState {Term : test .TruncTerm }, test .RaftAppliedIndex ,
102
- )
100
+ err = rsl .SynthesizeHardState (context .Background (), batch , oldHS ,
101
+ logstore.EntryID {Index : test .AppliedIndex , Term : test .AppliedTerm })
103
102
if ! testutils .IsError (err , test .Err ) {
104
103
t .Fatalf ("%d: expected %q got %v" , i , test .Err , err )
105
104
} else if err != nil {
0 commit comments