merge master

Signed-off-by: linning <linningde25@gmail.com>
This commit is contained in:
NingLin-P 2020-03-18 17:00:09 +08:00 committed by Connor
parent 0eecd7db66
commit f24d6eb488
4 changed files with 157 additions and 151 deletions

View File

@ -2,12 +2,10 @@ package meta
import (
"github.com/Connor1996/badger"
"github.com/Connor1996/badger/y"
"github.com/pingcap-incubator/tinykv/kv/util/engine_util"
"github.com/pingcap-incubator/tinykv/proto/pkg/eraftpb"
"github.com/pingcap-incubator/tinykv/proto/pkg/metapb"
rspb "github.com/pingcap-incubator/tinykv/proto/pkg/raft_serverpb"
"github.com/pingcap/errors"
)
func GetRegionLocalState(db *badger.DB, regionId uint64) (*rspb.RegionLocalState, error) {
@ -60,6 +58,7 @@ func InitRaftLocalState(raftEngine *badger.DB, region *metapb.Region) (*rspb.Raf
if len(region.Peers) > 0 {
// new split region
raftState.LastIndex = RaftInitLogIndex
raftState.LastTerm = RaftInitLogTerm
raftState.HardState.Term = RaftInitLogTerm
raftState.HardState.Commit = RaftInitLogIndex
err = engine_util.PutMeta(raftEngine, RaftStateKey(region.Id), raftState)
@ -92,25 +91,6 @@ func InitApplyState(kvEngine *badger.DB, region *metapb.Region) (*rspb.RaftApply
return applyState, nil
}
func InitLastTerm(raftEngine *badger.DB, region *metapb.Region,
raftState *rspb.RaftLocalState, applyState *rspb.RaftApplyState) (uint64, error) {
lastIdx := raftState.LastIndex
if lastIdx == 0 {
return 0, nil
} else if lastIdx == RaftInitLogIndex {
return RaftInitLogTerm, nil
} else if lastIdx == applyState.TruncatedState.Index {
return applyState.TruncatedState.Term, nil
} else {
y.Assert(lastIdx > RaftInitLogIndex)
}
e, err := GetRaftEntry(raftEngine, region.Id, lastIdx)
if err != nil {
return 0, errors.Errorf("[region %s] entry at %d doesn't exist, may lost data.", region, lastIdx)
}
return e.Term, nil
}
func WriteRegionState(kvWB *engine_util.WriteBatch, region *metapb.Region, state rspb.PeerState) {
regionState := new(rspb.RegionLocalState)
regionState.State = state

View File

@ -31,23 +31,23 @@ type ApplySnapResult struct {
var _ raft.Storage = new(PeerStorage)
type PeerStorage struct {
// Tag which is useful for printing log
Tag string
// The underlying storage
Engines *engine_util.Engines
// Cache for the persistent states
region *metapb.Region
raftState rspb.RaftLocalState
applyState rspb.RaftApplyState // (Should be updated too when applying committed entries)
lastTerm uint64
// States for generating snapshot
snapState snap.SnapState
regionSched chan<- worker.Task
// current region information of the peer
region *metapb.Region
// current raft state of the peer
raftState rspb.RaftLocalState
// current snapshot state
snapState snap.SnapState
// regionSched used to schedule task to region worker
regionSched chan<- worker.Task
// gennerate snapshot tried count
snapTriedCnt int
// Engine include two badger instance: Raft and Kv
Engines *engine_util.Engines
// Tag used for logging
Tag string
}
// NewPeerStorage get the persist raftState from engines and return a peer storage
func NewPeerStorage(engines *engine_util.Engines, region *metapb.Region, regionSched chan<- worker.Task, tag string) (*PeerStorage, error) {
log.Debugf("%s creating storage for %s", tag, region.String())
raftState, err := meta.InitRaftLocalState(engines.Raft, region)
@ -62,16 +62,11 @@ func NewPeerStorage(engines *engine_util.Engines, region *metapb.Region, regionS
panic(fmt.Sprintf("%s unexpected raft log index: lastIndex %d < appliedIndex %d",
tag, raftState.LastIndex, applyState.AppliedIndex))
}
lastTerm, err := meta.InitLastTerm(engines.Raft, region, raftState, applyState)
if err != nil {
return nil, err
}
return &PeerStorage{
Engines: engines,
region: region,
Tag: tag,
raftState: *raftState,
lastTerm: lastTerm,
regionSched: regionSched,
}, nil
}
@ -134,8 +129,8 @@ func (ps *PeerStorage) Term(idx uint64) (uint64, error) {
if err := ps.checkRange(idx, idx+1); err != nil {
return 0, err
}
if ps.truncatedTerm() == ps.lastTerm || idx == ps.raftState.LastIndex {
return ps.lastTerm, nil
if ps.truncatedTerm() == ps.raftState.LastTerm || idx == ps.raftState.LastIndex {
return ps.raftState.LastTerm, nil
}
var entry eraftpb.Entry
if err := engine_util.GetMeta(ps.Engines.Raft, meta.RaftLogKey(ps.region.Id, idx), &entry); err != nil {
@ -180,21 +175,17 @@ func (ps *PeerStorage) Snapshot() (eraftpb.Snapshot, error) {
log.Infof("%s requesting snapshot", ps.Tag)
ps.snapTriedCnt++
ps.ScheduleGenerateSnapshot()
return snapshot, raft.ErrSnapshotTemporarilyUnavailable
}
func (ps *PeerStorage) ScheduleGenerateSnapshot() {
ch := make(chan *eraftpb.Snapshot, 1)
ps.snapState = snap.SnapState{
StateType: snap.SnapState_Generating,
Receiver: ch,
}
// schedule snapshot generate task
ps.regionSched <- &runner.RegionTaskGen{
RegionId: ps.region.GetId(),
Notifier: ch,
}
return snapshot, raft.ErrSnapshotTemporarilyUnavailable
}
func (ps *PeerStorage) isInitialized() bool {
@ -257,6 +248,8 @@ func (ps *PeerStorage) validateSnap(snap *eraftpb.Snapshot) bool {
// Return the new last index for later update. After we commit in engine, we can set last_index
// to the return one.
func (ps *PeerStorage) Append(entries []eraftpb.Entry, raftWB *engine_util.WriteBatch) error {
// Your Code Here (2B).
// TODO: Delete Start
log.Debugf("%s append %d entries", ps.Tag, len(entries))
prevLastIndex := ps.raftState.LastIndex
if len(entries) == 0 {
@ -276,8 +269,9 @@ func (ps *PeerStorage) Append(entries []eraftpb.Entry, raftWB *engine_util.Write
raftWB.DeleteMeta(meta.RaftLogKey(ps.region.Id, i))
}
ps.raftState.LastIndex = lastIndex
ps.lastTerm = lastTerm
ps.raftState.LastTerm = lastTerm
return nil
// TODO: Delete End
}
func (ps *PeerStorage) clearMeta(kvWB, raftWB *engine_util.WriteBatch) error {
@ -288,20 +282,11 @@ func (ps *PeerStorage) clearMeta(kvWB, raftWB *engine_util.WriteBatch) error {
func (ps *PeerStorage) clearExtraData(newRegion *metapb.Region) {
oldStartKey, oldEndKey := ps.region.GetStartKey(), ps.region.GetEndKey()
newStartKey, newEndKey := newRegion.GetStartKey(), newRegion.GetEndKey()
regionId := newRegion.Id
if bytes.Compare(oldStartKey, newStartKey) < 0 {
ps.regionSched <- &runner.RegionTaskDestroy{
RegionId: regionId,
StartKey: oldStartKey,
EndKey: newStartKey,
}
ps.clearRange(newRegion.Id, oldStartKey, newStartKey)
}
if bytes.Compare(newEndKey, oldEndKey) < 0 {
ps.regionSched <- &runner.RegionTaskDestroy{
RegionId: regionId,
StartKey: newEndKey,
EndKey: oldEndKey,
}
ps.clearRange(newRegion.Id, newEndKey, oldEndKey)
}
}
@ -343,11 +328,13 @@ func ClearMeta(engines *engine_util.Engines, kvWB, raftWB *engine_util.WriteBatc
}
// Apply the peer with given snapshot.
func (ps *PeerStorage) ApplySnapshot(snap *eraftpb.Snapshot, kvWB *engine_util.WriteBatch, raftWB *engine_util.WriteBatch) (*ApplySnapResult, error) {
func (ps *PeerStorage) ApplySnapshot(snapshot *eraftpb.Snapshot, kvWB *engine_util.WriteBatch, raftWB *engine_util.WriteBatch) (*ApplySnapResult, error) {
// Your Code Here (2B).
// TODO: Delete Start
log.Infof("%v begin to apply snapshot", ps.Tag)
snapData := new(rspb.RaftSnapshotData)
if err := snapData.Unmarshal(snap.Data); err != nil {
if err := snapData.Unmarshal(snapshot.Data); err != nil {
return nil, err
}
@ -360,40 +347,52 @@ func (ps *PeerStorage) ApplySnapshot(snap *eraftpb.Snapshot, kvWB *engine_util.W
if err := ps.clearMeta(kvWB, raftWB); err != nil {
return nil, err
}
ps.clearExtraData(snapData.Region)
}
ps.raftState.LastIndex = snap.Metadata.Index
ps.lastTerm = snap.Metadata.Term
ps.raftState.LastIndex = snapshot.Metadata.Index
ps.raftState.LastTerm = snapshot.Metadata.Term
applyRes := &ApplySnapResult{
PrevRegion: ps.region,
Region: snapData.Region,
}
// cleanup data before scheduling apply worker.Task
if ps.isInitialized() {
ps.clearExtraData(snapData.Region)
}
ps.region = snapData.Region
ps.applyState = rspb.RaftApplyState{
AppliedIndex: snap.Metadata.Index,
// The snapshot only contains log which index > applied index, so
// here the truncate state's (index, term) is in snapshot metadata.
TruncatedState: &rspb.RaftTruncatedState{
Index: snap.Metadata.Index,
Term: snap.Metadata.Term,
Index: snapshot.Metadata.Index,
Term: snapshot.Metadata.Term,
},
}
kvWB.SetMeta(meta.ApplyStateKey(ps.region.GetId()), &ps.applyState)
ps.ScheduleApplyingSnapshotAndWait(snapData.Region, snap.Metadata)
meta.WriteRegionState(kvWB, snapData.Region, rspb.PeerState_Normal)
ch := make(chan bool)
ps.snapState = snap.SnapState{
StateType: snap.SnapState_Applying,
}
ps.regionSched <- &runner.RegionTaskApply{
RegionId: ps.region.Id,
Notifier: ch,
SnapMeta: snapshot.Metadata,
StartKey: snapData.Region.GetStartKey(),
EndKey: snapData.Region.GetEndKey(),
}
// wait until apply finish
<-ch
log.Debugf("%v apply snapshot for region %v with state %v ok", ps.Tag, snapData.Region, ps.applyState)
return applyRes, nil
// TODO: Delete End
}
/// Save memory states to disk.
/// Do not modify ready in this function, this is a requirement to advance the ready object properly later.
func (ps *PeerStorage) SaveReadyState(ready *raft.Ready) (*ApplySnapResult, error) {
// Your Code Here (2B).
// TODO: Delete Start
kvWB, raftWB := new(engine_util.WriteBatch), new(engine_util.WriteBatch)
prevRaftState := ps.raftState
@ -423,27 +422,17 @@ func (ps *PeerStorage) SaveReadyState(ready *raft.Ready) (*ApplySnapResult, erro
kvWB.MustWriteToDB(ps.Engines.Kv)
raftWB.MustWriteToDB(ps.Engines.Raft)
return applyRes, nil
}
func (ps *PeerStorage) ScheduleApplyingSnapshotAndWait(snapRegion *metapb.Region, snapMeta *eraftpb.SnapshotMetadata) {
ch := make(chan bool)
ps.snapState = snap.SnapState{
StateType: snap.SnapState_Applying,
}
ps.regionSched <- &runner.RegionTaskApply{
RegionId: ps.region.Id,
Notifier: ch,
SnapMeta: snapMeta,
StartKey: snapRegion.GetStartKey(),
EndKey: snapRegion.GetEndKey(),
}
<-ch
// TODO: Delete End
}
func (ps *PeerStorage) ClearData() {
ps.clearRange(ps.region.GetId(), ps.region.GetStartKey(), ps.region.GetEndKey())
}
func (ps *PeerStorage) clearRange(regionID uint64, start, end []byte) {
ps.regionSched <- &runner.RegionTaskDestroy{
RegionId: ps.region.GetId(),
StartKey: ps.region.GetStartKey(),
EndKey: ps.region.GetEndKey(),
RegionId: regionID,
StartKey: start,
EndKey: end,
}
}

View File

@ -47,7 +47,7 @@ func (x PeerState) String() string {
return proto.EnumName(PeerState_name, int32(x))
}
func (PeerState) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{0}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{0}
}
// The message sent between Raft peer, it wraps the raft meessage with some meta information.
@ -71,7 +71,7 @@ func (m *RaftMessage) Reset() { *m = RaftMessage{} }
func (m *RaftMessage) String() string { return proto.CompactTextString(m) }
func (*RaftMessage) ProtoMessage() {}
func (*RaftMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{0}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{0}
}
func (m *RaftMessage) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -160,6 +160,7 @@ func (m *RaftMessage) GetEndKey() []byte {
type RaftLocalState struct {
HardState *eraftpb.HardState `protobuf:"bytes,1,opt,name=hard_state,json=hardState" json:"hard_state,omitempty"`
LastIndex uint64 `protobuf:"varint,2,opt,name=last_index,json=lastIndex,proto3" json:"last_index,omitempty"`
LastTerm uint64 `protobuf:"varint,3,opt,name=last_term,json=lastTerm,proto3" json:"last_term,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -169,7 +170,7 @@ func (m *RaftLocalState) Reset() { *m = RaftLocalState{} }
func (m *RaftLocalState) String() string { return proto.CompactTextString(m) }
func (*RaftLocalState) ProtoMessage() {}
func (*RaftLocalState) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{1}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{1}
}
func (m *RaftLocalState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -212,6 +213,13 @@ func (m *RaftLocalState) GetLastIndex() uint64 {
return 0
}
func (m *RaftLocalState) GetLastTerm() uint64 {
if m != nil {
return m.LastTerm
}
return 0
}
// Used to store the persistent state for Raft state machine.
type RaftApplyState struct {
AppliedIndex uint64 `protobuf:"varint,1,opt,name=applied_index,json=appliedIndex,proto3" json:"applied_index,omitempty"`
@ -225,7 +233,7 @@ func (m *RaftApplyState) Reset() { *m = RaftApplyState{} }
func (m *RaftApplyState) String() string { return proto.CompactTextString(m) }
func (*RaftApplyState) ProtoMessage() {}
func (*RaftApplyState) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{2}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{2}
}
func (m *RaftApplyState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -281,7 +289,7 @@ func (m *RaftTruncatedState) Reset() { *m = RaftTruncatedState{} }
func (m *RaftTruncatedState) String() string { return proto.CompactTextString(m) }
func (*RaftTruncatedState) ProtoMessage() {}
func (*RaftTruncatedState) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{3}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{3}
}
func (m *RaftTruncatedState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -337,7 +345,7 @@ func (m *RegionLocalState) Reset() { *m = RegionLocalState{} }
func (m *RegionLocalState) String() string { return proto.CompactTextString(m) }
func (*RegionLocalState) ProtoMessage() {}
func (*RegionLocalState) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{4}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{4}
}
func (m *RegionLocalState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -394,7 +402,7 @@ func (m *StoreIdent) Reset() { *m = StoreIdent{} }
func (m *StoreIdent) String() string { return proto.CompactTextString(m) }
func (*StoreIdent) ProtoMessage() {}
func (*StoreIdent) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{5}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{5}
}
func (m *StoreIdent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -451,7 +459,7 @@ func (m *KeyValue) Reset() { *m = KeyValue{} }
func (m *KeyValue) String() string { return proto.CompactTextString(m) }
func (*KeyValue) ProtoMessage() {}
func (*KeyValue) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{6}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{6}
}
func (m *KeyValue) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -508,7 +516,7 @@ func (m *RaftSnapshotData) Reset() { *m = RaftSnapshotData{} }
func (m *RaftSnapshotData) String() string { return proto.CompactTextString(m) }
func (*RaftSnapshotData) ProtoMessage() {}
func (*RaftSnapshotData) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{7}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{7}
}
func (m *RaftSnapshotData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -578,7 +586,7 @@ func (m *SnapshotCFFile) Reset() { *m = SnapshotCFFile{} }
func (m *SnapshotCFFile) String() string { return proto.CompactTextString(m) }
func (*SnapshotCFFile) ProtoMessage() {}
func (*SnapshotCFFile) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{8}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{8}
}
func (m *SnapshotCFFile) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -639,7 +647,7 @@ func (m *SnapshotMeta) Reset() { *m = SnapshotMeta{} }
func (m *SnapshotMeta) String() string { return proto.CompactTextString(m) }
func (*SnapshotMeta) ProtoMessage() {}
func (*SnapshotMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{9}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{9}
}
func (m *SnapshotMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -687,7 +695,7 @@ func (m *SnapshotChunk) Reset() { *m = SnapshotChunk{} }
func (m *SnapshotChunk) String() string { return proto.CompactTextString(m) }
func (*SnapshotChunk) ProtoMessage() {}
func (*SnapshotChunk) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{10}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{10}
}
func (m *SnapshotChunk) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -740,7 +748,7 @@ func (m *Done) Reset() { *m = Done{} }
func (m *Done) String() string { return proto.CompactTextString(m) }
func (*Done) ProtoMessage() {}
func (*Done) Descriptor() ([]byte, []int) {
return fileDescriptor_raft_serverpb_af91ddafe2dcf6b5, []int{11}
return fileDescriptor_raft_serverpb_c9fc50483f6875a6, []int{11}
}
func (m *Done) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -902,6 +910,11 @@ func (m *RaftLocalState) MarshalTo(dAtA []byte) (int, error) {
i++
i = encodeVarintRaftServerpb(dAtA, i, uint64(m.LastIndex))
}
if m.LastTerm != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintRaftServerpb(dAtA, i, uint64(m.LastTerm))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
@ -1319,6 +1332,9 @@ func (m *RaftLocalState) Size() (n int) {
if m.LastIndex != 0 {
n += 1 + sovRaftServerpb(uint64(m.LastIndex))
}
if m.LastTerm != 0 {
n += 1 + sovRaftServerpb(uint64(m.LastTerm))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@ -1868,6 +1884,25 @@ func (m *RaftLocalState) Unmarshal(dAtA []byte) error {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastTerm", wireType)
}
m.LastTerm = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRaftServerpb
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastTerm |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipRaftServerpb(dAtA[iNdEx:])
@ -3025,54 +3060,55 @@ var (
ErrIntOverflowRaftServerpb = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptor_raft_serverpb_af91ddafe2dcf6b5) }
func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptor_raft_serverpb_c9fc50483f6875a6) }
var fileDescriptor_raft_serverpb_af91ddafe2dcf6b5 = []byte{
// 736 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xf3, 0x44,
0x10, 0xfd, 0x9c, 0xa4, 0x89, 0x3d, 0x71, 0x42, 0xb4, 0x1f, 0x52, 0x4d, 0xaa, 0x46, 0xa9, 0x11,
0x55, 0x28, 0x52, 0x10, 0x01, 0x21, 0xae, 0x90, 0x80, 0x52, 0x35, 0x94, 0xa2, 0x6a, 0x53, 0x21,
0x71, 0x65, 0x6d, 0xec, 0x71, 0x63, 0xea, 0xd8, 0xd6, 0xee, 0xa6, 0x22, 0xbd, 0xe3, 0x2d, 0x78,
0x11, 0x2e, 0x78, 0x03, 0x2e, 0x79, 0x04, 0x54, 0x5e, 0x04, 0xed, 0xae, 0x9d, 0x9f, 0xb6, 0x70,
0xe5, 0xf9, 0x39, 0xb3, 0x7b, 0xe6, 0xcc, 0x78, 0xe1, 0x2d, 0x67, 0xb1, 0x0c, 0x04, 0xf2, 0x07,
0xe4, 0xc5, 0x7c, 0x5c, 0xf0, 0x5c, 0xe6, 0xa4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f, 0xbc, 0x1d, 0xa4, 0x14, 0xd0, 0xcc, 0x4b, 0xdb, 0x7e, 0x13,
0x1a, 0xe7, 0x79, 0x86, 0x67, 0xa7, 0xe0, 0x6c, 0xd6, 0x8d, 0x00, 0x34, 0x7f, 0xc8, 0xf9, 0x92,
0xa5, 0xbd, 0x37, 0xa4, 0x03, 0xce, 0xe6, 0x89, 0xe8, 0xd5, 0xbe, 0xee, 0xfd, 0xf9, 0x34, 0xb0,
0xfe, 0x7a, 0x1a, 0x58, 0x7f, 0x3f, 0x0d, 0xac, 0xdf, 0xfe, 0x19, 0xbc, 0x99, 0x37, 0xf5, 0x1b,
0xfa, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xbd, 0x6c, 0x53, 0x86, 0x05, 0x00, 0x00,
var fileDescriptor_raft_serverpb_c9fc50483f6875a6 = []byte{
// 751 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xeb, 0x44,
0x10, 0x3e, 0x4e, 0xdc, 0xc4, 0x9e, 0x38, 0x21, 0xda, 0x83, 0x74, 0x4c, 0x8e, 0x4e, 0x94, 0x1a,
0x51, 0x85, 0x22, 0x05, 0x11, 0x10, 0xe2, 0x0a, 0x09, 0x28, 0x55, 0x43, 0x29, 0xaa, 0x36, 0x15,
0x12, 0x57, 0xd6, 0xd6, 0x1e, 0x37, 0xa6, 0x8e, 0x6d, 0xed, 0x6e, 0x2a, 0xd2, 0x1b, 0xc4, 0x5b,
0xf0, 0x22, 0x5c, 0xf0, 0x06, 0x5c, 0xf2, 0x08, 0xa8, 0xbc, 0x08, 0xda, 0x5d, 0x3b, 0x3f, 0x6d,
0x39, 0x57, 0xd9, 0x99, 0xef, 0xf3, 0xec, 0x37, 0xdf, 0x4c, 0x16, 0x5e, 0x72, 0x96, 0xc8, 0x50,
0x20, 0xbf, 0x43, 0x5e,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
0xfd, 0x8a, 0xe0, 0x27, 0xe8, 0x6e, 0xa0, 0xc5, 0x2a, 0xbf, 0x25, 0x9f, 0x6d, 0x9f, 0x13, 0x63,
0xe8, 0xe0, 0x99, 0x85, 0x7e, 0xf2, 0xb0, 0x90, 0xca, 0x40, 0x33, 0x2f, 0x7d, 0x0e, 0x5a, 0x60,
0x9f, 0x14, 0x39, 0x1e, 0x1f, 0x81, 0xbb, 0x59, 0x37, 0x02, 0xd0, 0xfa, 0xa1, 0xe0, 0x4b, 0x96,
0xf5, 0x5f, 0x90, 0x2e, 0xb8, 0x9b, 0xf7, 0xa3, 0xdf, 0xf8, 0xba, 0xff, 0xd7, 0xc3, 0xd0, 0xfa,
0xfb, 0x61, 0x68, 0xfd, 0xf3, 0x30, 0xb4, 0x7e, 0xff, 0x77, 0xf8, 0xe2, 0xba, 0xa5, 0x1f, 0xd8,
0x4f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x79, 0xcc, 0xfd, 0xcf, 0xa3, 0x05, 0x00, 0x00,
}

View File

@ -22,6 +22,7 @@ message RaftMessage {
message RaftLocalState {
eraftpb.HardState hard_state = 1;
uint64 last_index = 2;
uint64 last_term = 3;
}
// Used to store the persistent state for Raft state machine.