Skip to content

Commit

Permalink
mocktikv: update mvcc debug api. (#6222)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored and AndreMouche committed Apr 4, 2018
1 parent bc7638d commit 6395b58
Show file tree
Hide file tree
Showing 11 changed files with 5,256 additions and 2,335 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions store/mockstore/mocktikv/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,16 @@ func (e *mvccEntry) containsStartTS(startTS uint64) bool {
func (e *mvccEntry) dumpMvccInfo() *kvrpcpb.MvccInfo {
info := &kvrpcpb.MvccInfo{}
if e.lock != nil {
info.Lock = &kvrpcpb.LockInfo{
Key: e.key,
PrimaryLock: e.lock.primary,
LockVersion: e.lock.startTS,
LockTtl: e.lock.ttl,
info.Lock = &kvrpcpb.MvccLock{
Type: e.lock.op,
StartTs: e.lock.startTS,
Primary: e.lock.primary,
ShortValue: e.lock.value,
}
}

info.Writes = make([]*kvrpcpb.WriteInfo, len(e.values))
info.Values = make([]*kvrpcpb.ValueInfo, len(e.values))
info.Writes = make([]*kvrpcpb.MvccWrite, len(e.values))
info.Values = make([]*kvrpcpb.MvccValue, len(e.values))

for id, item := range e.values {
var tp kvrpcpb.Op
Expand All @@ -385,15 +385,15 @@ func (e *mvccEntry) dumpMvccInfo() *kvrpcpb.MvccInfo {
case typeRollback:
tp = kvrpcpb.Op_Rollback
}
info.Writes[id] = &kvrpcpb.WriteInfo{
StartTs: item.startTS,
info.Writes[id] = &kvrpcpb.MvccWrite{
Type: tp,
StartTs: item.startTS,
CommitTs: item.commitTS,
}

info.Values[id] = &kvrpcpb.ValueInfo{
Value: item.value,
Ts: item.startTS,
info.Values[id] = &kvrpcpb.MvccValue{
Value: item.value,
StartTs: item.startTS,
}
}
return info
Expand Down
15 changes: 13 additions & 2 deletions store/tikv/region_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,33 @@ func (s *mockTikvGrpcServer) KvGC(context.Context, *kvrpcpb.GCRequest) (*kvrpcpb
func (s *mockTikvGrpcServer) KvDeleteRange(context.Context, *kvrpcpb.DeleteRangeRequest) (*kvrpcpb.DeleteRangeResponse, error) {
return nil, errors.New("unreachable")
}

func (s *mockTikvGrpcServer) RawGet(context.Context, *kvrpcpb.RawGetRequest) (*kvrpcpb.RawGetResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawBatchGet(context.Context, *kvrpcpb.RawBatchGetRequest) (*kvrpcpb.RawBatchGetResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawPut(context.Context, *kvrpcpb.RawPutRequest) (*kvrpcpb.RawPutResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawBatchPut(context.Context, *kvrpcpb.RawBatchPutRequest) (*kvrpcpb.RawBatchPutResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawDelete(context.Context, *kvrpcpb.RawDeleteRequest) (*kvrpcpb.RawDeleteResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawDeleteRange(context.Context, *kvrpcpb.RawDeleteRangeRequest) (*kvrpcpb.RawDeleteRangeResponse, error) {
func (s *mockTikvGrpcServer) RawBatchDelete(context.Context, *kvrpcpb.RawBatchDeleteRequest) (*kvrpcpb.RawBatchDeleteResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawScan(context.Context, *kvrpcpb.RawScanRequest) (*kvrpcpb.RawScanResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawDeleteRange(context.Context, *kvrpcpb.RawDeleteRangeRequest) (*kvrpcpb.RawDeleteRangeResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) RawBatchScan(context.Context, *kvrpcpb.RawBatchScanRequest) (*kvrpcpb.RawBatchScanResponse, error) {
return nil, errors.New("unreachable")
}
func (s *mockTikvGrpcServer) Coprocessor(context.Context, *coprocessor.Request) (*coprocessor.Response, error) {
return nil, errors.New("unreachable")
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 52 additions & 51 deletions vendor/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6395b58

Please sign in to comment.