From 499098da907d91c4b50480f8abd07a3c3b55dd6e Mon Sep 17 00:00:00 2001 From: Connor1996 Date: Thu, 23 Apr 2020 14:57:15 +0800 Subject: [PATCH] add comment for proto Signed-off-by: Connor1996 --- proto/pkg/raft_cmdpb/raft_cmdpb.pb.go | 56 ++++++++++----------- proto/pkg/raft_serverpb/raft_serverpb.pb.go | 37 +++++++------- proto/proto/raft_serverpb.proto | 7 ++- 3 files changed, 53 insertions(+), 47 deletions(-) diff --git a/proto/pkg/raft_cmdpb/raft_cmdpb.pb.go b/proto/pkg/raft_cmdpb/raft_cmdpb.pb.go index 77c18097..fd1377df 100644 --- a/proto/pkg/raft_cmdpb/raft_cmdpb.pb.go +++ b/proto/pkg/raft_cmdpb/raft_cmdpb.pb.go @@ -56,7 +56,7 @@ func (x CmdType) String() string { return proto.EnumName(CmdType_name, int32(x)) } func (CmdType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{0} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{0} } type AdminCmdType int32 @@ -88,7 +88,7 @@ func (x AdminCmdType) String() string { return proto.EnumName(AdminCmdType_name, int32(x)) } func (AdminCmdType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{1} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{1} } type GetRequest struct { @@ -103,7 +103,7 @@ func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{0} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{0} } func (m *GetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -157,7 +157,7 @@ func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (*GetResponse) ProtoMessage() {} func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{1} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{1} } func (m *GetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -206,7 +206,7 @@ func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) String() string { return proto.CompactTextString(m) } func (*PutRequest) ProtoMessage() {} func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{2} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{2} } func (m *PutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -266,7 +266,7 @@ func (m *PutResponse) Reset() { *m = PutResponse{} } func (m *PutResponse) String() string { return proto.CompactTextString(m) } func (*PutResponse) ProtoMessage() {} func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{3} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{3} } func (m *PutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -307,7 +307,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{4} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{4} } func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -360,7 +360,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{5} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{5} } func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -399,7 +399,7 @@ func (m *SnapRequest) Reset() { *m = SnapRequest{} } func (m *SnapRequest) String() string { return proto.CompactTextString(m) } func (*SnapRequest) ProtoMessage() {} func (*SnapRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{6} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{6} } func (m *SnapRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -439,7 +439,7 @@ func (m *SnapResponse) Reset() { *m = SnapResponse{} } func (m *SnapResponse) String() string { return proto.CompactTextString(m) } func (*SnapResponse) ProtoMessage() {} func (*SnapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{7} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{7} } func (m *SnapResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -490,7 +490,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{8} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{8} } func (m *Request) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -569,7 +569,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{9} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{9} } func (m *Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -646,7 +646,7 @@ func (m *ChangePeerRequest) Reset() { *m = ChangePeerRequest{} } func (m *ChangePeerRequest) String() string { return proto.CompactTextString(m) } func (*ChangePeerRequest) ProtoMessage() {} func (*ChangePeerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{10} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{10} } func (m *ChangePeerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -700,7 +700,7 @@ func (m *ChangePeerResponse) Reset() { *m = ChangePeerResponse{} } func (m *ChangePeerResponse) String() string { return proto.CompactTextString(m) } func (*ChangePeerResponse) ProtoMessage() {} func (*ChangePeerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{11} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{11} } func (m *ChangePeerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -755,7 +755,7 @@ func (m *SplitRequest) Reset() { *m = SplitRequest{} } func (m *SplitRequest) String() string { return proto.CompactTextString(m) } func (*SplitRequest) ProtoMessage() {} func (*SplitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{12} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{12} } func (m *SplitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -817,7 +817,7 @@ func (m *SplitResponse) Reset() { *m = SplitResponse{} } func (m *SplitResponse) String() string { return proto.CompactTextString(m) } func (*SplitResponse) ProtoMessage() {} func (*SplitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{13} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{13} } func (m *SplitResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -865,7 +865,7 @@ func (m *CompactLogRequest) Reset() { *m = CompactLogRequest{} } func (m *CompactLogRequest) String() string { return proto.CompactTextString(m) } func (*CompactLogRequest) ProtoMessage() {} func (*CompactLogRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{14} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{14} } func (m *CompactLogRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -918,7 +918,7 @@ func (m *CompactLogResponse) Reset() { *m = CompactLogResponse{} } func (m *CompactLogResponse) String() string { return proto.CompactTextString(m) } func (*CompactLogResponse) ProtoMessage() {} func (*CompactLogResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{15} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{15} } func (m *CompactLogResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -958,7 +958,7 @@ func (m *TransferLeaderRequest) Reset() { *m = TransferLeaderRequest{} } func (m *TransferLeaderRequest) String() string { return proto.CompactTextString(m) } func (*TransferLeaderRequest) ProtoMessage() {} func (*TransferLeaderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{16} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{16} } func (m *TransferLeaderRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1004,7 +1004,7 @@ func (m *TransferLeaderResponse) Reset() { *m = TransferLeaderResponse{} func (m *TransferLeaderResponse) String() string { return proto.CompactTextString(m) } func (*TransferLeaderResponse) ProtoMessage() {} func (*TransferLeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{17} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{17} } func (m *TransferLeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1048,7 +1048,7 @@ func (m *AdminRequest) Reset() { *m = AdminRequest{} } func (m *AdminRequest) String() string { return proto.CompactTextString(m) } func (*AdminRequest) ProtoMessage() {} func (*AdminRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{18} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{18} } func (m *AdminRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1127,7 +1127,7 @@ func (m *AdminResponse) Reset() { *m = AdminResponse{} } func (m *AdminResponse) String() string { return proto.CompactTextString(m) } func (*AdminResponse) ProtoMessage() {} func (*AdminResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{19} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{19} } func (m *AdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1205,7 +1205,7 @@ func (m *RaftRequestHeader) Reset() { *m = RaftRequestHeader{} } func (m *RaftRequestHeader) String() string { return proto.CompactTextString(m) } func (*RaftRequestHeader) ProtoMessage() {} func (*RaftRequestHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{20} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{20} } func (m *RaftRequestHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1275,7 +1275,7 @@ func (m *RaftResponseHeader) Reset() { *m = RaftResponseHeader{} } func (m *RaftResponseHeader) String() string { return proto.CompactTextString(m) } func (*RaftResponseHeader) ProtoMessage() {} func (*RaftResponseHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{21} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{21} } func (m *RaftResponseHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1340,7 +1340,7 @@ func (m *RaftCmdRequest) Reset() { *m = RaftCmdRequest{} } func (m *RaftCmdRequest) String() string { return proto.CompactTextString(m) } func (*RaftCmdRequest) ProtoMessage() {} func (*RaftCmdRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{22} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{22} } func (m *RaftCmdRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1403,7 +1403,7 @@ func (m *RaftCmdResponse) Reset() { *m = RaftCmdResponse{} } func (m *RaftCmdResponse) String() string { return proto.CompactTextString(m) } func (*RaftCmdResponse) ProtoMessage() {} func (*RaftCmdResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_raft_cmdpb_7d27a800501f9188, []int{23} + return fileDescriptor_raft_cmdpb_409ff26e8ae8c248, []int{23} } func (m *RaftCmdResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -5755,9 +5755,9 @@ var ( ErrIntOverflowRaftCmdpb = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("raft_cmdpb.proto", fileDescriptor_raft_cmdpb_7d27a800501f9188) } +func init() { proto.RegisterFile("raft_cmdpb.proto", fileDescriptor_raft_cmdpb_409ff26e8ae8c248) } -var fileDescriptor_raft_cmdpb_7d27a800501f9188 = []byte{ +var fileDescriptor_raft_cmdpb_409ff26e8ae8c248 = []byte{ // 1068 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, 0x10, 0x0e, 0x45, 0xea, 0xc7, 0x43, 0x52, 0xa1, 0x37, 0x6e, 0x4c, 0x3b, 0xa8, 0xa0, 0x30, 0x45, diff --git a/proto/pkg/raft_serverpb/raft_serverpb.pb.go b/proto/pkg/raft_serverpb/raft_serverpb.pb.go index f57393ba..f6e99ba8 100644 --- a/proto/pkg/raft_serverpb/raft_serverpb.pb.go +++ b/proto/pkg/raft_serverpb/raft_serverpb.pb.go @@ -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_c9fc50483f6875a6, []int{0} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{0} } // The message sent between Raft peer, it wraps the raft meessage with some meta information. @@ -59,7 +59,7 @@ type RaftMessage struct { RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` // true means to_peer is a tombstone peer and it should remove itself. IsTombstone bool `protobuf:"varint,6,opt,name=is_tombstone,json=isTombstone,proto3" json:"is_tombstone,omitempty"` - // Region key range [start_key, end_key). + // Region key range [start_key, end_key). (Used in 3B) StartKey []byte `protobuf:"bytes,7,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` EndKey []byte `protobuf:"bytes,8,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -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_c9fc50483f6875a6, []int{0} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{0} } func (m *RaftMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,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_c9fc50483f6875a6, []int{1} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{1} } func (m *RaftLocalState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -222,7 +222,10 @@ func (m *RaftLocalState) GetLastTerm() uint64 { // 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"` + // Record the applied index of the state machine to make sure + // not apply any index twice after restart. + AppliedIndex uint64 `protobuf:"varint,1,opt,name=applied_index,json=appliedIndex,proto3" json:"applied_index,omitempty"` + // Record the index and term of the last raft log that have been truncated. (Used in 2C) TruncatedState *RaftTruncatedState `protobuf:"bytes,2,opt,name=truncated_state,json=truncatedState" json:"truncated_state,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -233,7 +236,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_c9fc50483f6875a6, []int{2} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{2} } func (m *RaftApplyState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -289,7 +292,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_c9fc50483f6875a6, []int{3} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{3} } func (m *RaftTruncatedState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -345,7 +348,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_c9fc50483f6875a6, []int{4} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{4} } func (m *RegionLocalState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -402,7 +405,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_c9fc50483f6875a6, []int{5} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{5} } func (m *StoreIdent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -459,7 +462,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_c9fc50483f6875a6, []int{6} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{6} } func (m *KeyValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,7 +519,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_c9fc50483f6875a6, []int{7} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{7} } func (m *RaftSnapshotData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -586,7 +589,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_c9fc50483f6875a6, []int{8} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{8} } func (m *SnapshotCFFile) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -647,7 +650,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_c9fc50483f6875a6, []int{9} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{9} } func (m *SnapshotMeta) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -695,7 +698,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_c9fc50483f6875a6, []int{10} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{10} } func (m *SnapshotChunk) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -748,7 +751,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_c9fc50483f6875a6, []int{11} + return fileDescriptor_raft_serverpb_9d4bf28a94e26664, []int{11} } func (m *Done) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3060,9 +3063,9 @@ var ( ErrIntOverflowRaftServerpb = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptor_raft_serverpb_c9fc50483f6875a6) } +func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptor_raft_serverpb_9d4bf28a94e26664) } -var fileDescriptor_raft_serverpb_c9fc50483f6875a6 = []byte{ +var fileDescriptor_raft_serverpb_9d4bf28a94e26664 = []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, diff --git a/proto/proto/raft_serverpb.proto b/proto/proto/raft_serverpb.proto index 5c21fb7f..2b7b340d 100644 --- a/proto/proto/raft_serverpb.proto +++ b/proto/proto/raft_serverpb.proto @@ -13,7 +13,7 @@ message RaftMessage { metapb.RegionEpoch region_epoch = 5; // true means to_peer is a tombstone peer and it should remove itself. bool is_tombstone = 6; - // Region key range [start_key, end_key). + // Region key range [start_key, end_key). (Used in 3B) bytes start_key = 7; bytes end_key = 8; } @@ -27,8 +27,11 @@ message RaftLocalState { // Used to store the persistent state for Raft state machine. message RaftApplyState { + // Record the applied index of the state machine to make sure + // not apply any index twice after restart. uint64 applied_index = 1; - RaftTruncatedState truncated_state = 2; + // Record the index and term of the last raft log that have been truncated. (Used in 2C) + RaftTruncatedState truncated_state = 2; } // The truncated state for Raft log compaction.