diff --git a/store/mockstore/unistore/tikv/server.go b/store/mockstore/unistore/tikv/server.go index 14260ab991e94..f7779b51a8d69 100644 --- a/store/mockstore/unistore/tikv/server.go +++ b/store/mockstore/unistore/tikv/server.go @@ -158,7 +158,7 @@ func (req *requestCtx) finish() { } } -// KvGet implements implements the tikvpb.TikvServer interface. +// KvGet implements the tikvpb.TikvServer interface. func (svr *Server) KvGet(ctx context.Context, req *kvrpcpb.GetRequest) (*kvrpcpb.GetResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvGet") if err != nil { @@ -175,7 +175,7 @@ func (svr *Server) KvGet(ctx context.Context, req *kvrpcpb.GetRequest) (*kvrpcpb }, nil } -// KvScan implements implements the tikvpb.TikvServer interface. +// KvScan implements the tikvpb.TikvServer interface. func (svr *Server) KvScan(ctx context.Context, req *kvrpcpb.ScanRequest) (*kvrpcpb.ScanResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvScan") if err != nil { @@ -191,7 +191,7 @@ func (svr *Server) KvScan(ctx context.Context, req *kvrpcpb.ScanRequest) (*kvrpc }, nil } -// KvPessimisticLock implements implements the tikvpb.TikvServer interface. +// KvPessimisticLock implements the tikvpb.TikvServer interface. func (svr *Server) KvPessimisticLock(ctx context.Context, req *kvrpcpb.PessimisticLockRequest) (*kvrpcpb.PessimisticLockResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "PessimisticLock") if err != nil { @@ -252,7 +252,7 @@ func (svr *Server) KvPessimisticLock(ctx context.Context, req *kvrpcpb.Pessimist return resp, nil } -// KVPessimisticRollback implements implements the tikvpb.TikvServer interface. +// KVPessimisticRollback implements the tikvpb.TikvServer interface. func (svr *Server) KVPessimisticRollback(ctx context.Context, req *kvrpcpb.PessimisticRollbackRequest) (*kvrpcpb.PessimisticRollbackResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "PessimisticRollback") if err != nil { @@ -268,7 +268,7 @@ func (svr *Server) KVPessimisticRollback(ctx context.Context, req *kvrpcpb.Pessi return resp, nil } -// KvTxnHeartBeat implements implements the tikvpb.TikvServer interface. +// KvTxnHeartBeat implements the tikvpb.TikvServer interface. func (svr *Server) KvTxnHeartBeat(ctx context.Context, req *kvrpcpb.TxnHeartBeatRequest) (*kvrpcpb.TxnHeartBeatResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "TxnHeartBeat") if err != nil { @@ -284,7 +284,7 @@ func (svr *Server) KvTxnHeartBeat(ctx context.Context, req *kvrpcpb.TxnHeartBeat return resp, nil } -// KvCheckTxnStatus implements implements the tikvpb.TikvServer interface. +// KvCheckTxnStatus implements the tikvpb.TikvServer interface. func (svr *Server) KvCheckTxnStatus(ctx context.Context, req *kvrpcpb.CheckTxnStatusRequest) (*kvrpcpb.CheckTxnStatusResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvCheckTxnStatus") if err != nil { @@ -309,7 +309,7 @@ func (svr *Server) KvCheckTxnStatus(ctx context.Context, req *kvrpcpb.CheckTxnSt return resp, nil } -// KvCheckSecondaryLocks implements implements the tikvpb.TikvServer interface. +// KvCheckSecondaryLocks implements the tikvpb.TikvServer interface. func (svr *Server) KvCheckSecondaryLocks(ctx context.Context, req *kvrpcpb.CheckSecondaryLocksRequest) (*kvrpcpb.CheckSecondaryLocksResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvCheckSecondaryLocks") if err != nil { @@ -330,7 +330,7 @@ func (svr *Server) KvCheckSecondaryLocks(ctx context.Context, req *kvrpcpb.Check return resp, nil } -// KvPrewrite implements implements the tikvpb.TikvServer interface. +// KvPrewrite implements the tikvpb.TikvServer interface. func (svr *Server) KvPrewrite(ctx context.Context, req *kvrpcpb.PrewriteRequest) (*kvrpcpb.PrewriteResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvPrewrite") if err != nil { @@ -352,7 +352,7 @@ func (svr *Server) KvPrewrite(ctx context.Context, req *kvrpcpb.PrewriteRequest) return resp, nil } -// KvCommit implements implements the tikvpb.TikvServer interface. +// KvCommit implements the tikvpb.TikvServer interface. func (svr *Server) KvCommit(ctx context.Context, req *kvrpcpb.CommitRequest) (*kvrpcpb.CommitResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvCommit") if err != nil { @@ -370,19 +370,19 @@ func (svr *Server) KvCommit(ctx context.Context, req *kvrpcpb.CommitRequest) (*k return resp, nil } -// RawGetKeyTTL implements implements the tikvpb.TikvServer interface. +// RawGetKeyTTL implements the tikvpb.TikvServer interface. func (svr *Server) RawGetKeyTTL(ctx context.Context, req *kvrpcpb.RawGetKeyTTLRequest) (*kvrpcpb.RawGetKeyTTLResponse, error) { // TODO return &kvrpcpb.RawGetKeyTTLResponse{}, nil } -// KvImport implements implements the tikvpb.TikvServer interface. +// KvImport implements the tikvpb.TikvServer interface. func (svr *Server) KvImport(context.Context, *kvrpcpb.ImportRequest) (*kvrpcpb.ImportResponse, error) { // TODO return &kvrpcpb.ImportResponse{}, nil } -// KvCleanup implements implements the tikvpb.TikvServer interface. +// KvCleanup implements the tikvpb.TikvServer interface. func (svr *Server) KvCleanup(ctx context.Context, req *kvrpcpb.CleanupRequest) (*kvrpcpb.CleanupResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvCleanup") if err != nil { @@ -403,7 +403,7 @@ func (svr *Server) KvCleanup(ctx context.Context, req *kvrpcpb.CleanupRequest) ( return resp, nil } -// KvBatchGet implements implements the tikvpb.TikvServer interface. +// KvBatchGet implements the tikvpb.TikvServer interface. func (svr *Server) KvBatchGet(ctx context.Context, req *kvrpcpb.BatchGetRequest) (*kvrpcpb.BatchGetResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvBatchGet") if err != nil { @@ -419,7 +419,7 @@ func (svr *Server) KvBatchGet(ctx context.Context, req *kvrpcpb.BatchGetRequest) }, nil } -// KvBatchRollback implements implements the tikvpb.TikvServer interface. +// KvBatchRollback implements the tikvpb.TikvServer interface. func (svr *Server) KvBatchRollback(ctx context.Context, req *kvrpcpb.BatchRollbackRequest) (*kvrpcpb.BatchRollbackResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvBatchRollback") if err != nil { @@ -435,7 +435,7 @@ func (svr *Server) KvBatchRollback(ctx context.Context, req *kvrpcpb.BatchRollba return resp, nil } -// KvScanLock implements implements the tikvpb.TikvServer interface. +// KvScanLock implements the tikvpb.TikvServer interface. func (svr *Server) KvScanLock(ctx context.Context, req *kvrpcpb.ScanLockRequest) (*kvrpcpb.ScanLockResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvScanLock") if err != nil { @@ -450,7 +450,7 @@ func (svr *Server) KvScanLock(ctx context.Context, req *kvrpcpb.ScanLockRequest) return &kvrpcpb.ScanLockResponse{Error: convertToKeyError(err), Locks: locks}, nil } -// KvResolveLock implements implements the tikvpb.TikvServer interface. +// KvResolveLock implements the tikvpb.TikvServer interface. func (svr *Server) KvResolveLock(ctx context.Context, req *kvrpcpb.ResolveLockRequest) (*kvrpcpb.ResolveLockResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvResolveLock") if err != nil { @@ -478,7 +478,7 @@ func (svr *Server) KvResolveLock(ctx context.Context, req *kvrpcpb.ResolveLockRe return resp, nil } -// KvGC implements implements the tikvpb.TikvServer interface. +// KvGC implements the tikvpb.TikvServer interface. func (svr *Server) KvGC(ctx context.Context, req *kvrpcpb.GCRequest) (*kvrpcpb.GCResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvGC") if err != nil { @@ -489,7 +489,7 @@ func (svr *Server) KvGC(ctx context.Context, req *kvrpcpb.GCRequest) (*kvrpcpb.G return &kvrpcpb.GCResponse{}, nil } -// KvDeleteRange implements implements the tikvpb.TikvServer interface. +// KvDeleteRange implements the tikvpb.TikvServer interface. func (svr *Server) KvDeleteRange(ctx context.Context, req *kvrpcpb.DeleteRangeRequest) (*kvrpcpb.DeleteRangeResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "KvDeleteRange") if err != nil { @@ -508,54 +508,54 @@ func (svr *Server) KvDeleteRange(ctx context.Context, req *kvrpcpb.DeleteRangeRe // RawKV commands. -// RawGet implements implements the tikvpb.TikvServer interface. +// RawGet implements the tikvpb.TikvServer interface. func (svr *Server) RawGet(context.Context, *kvrpcpb.RawGetRequest) (*kvrpcpb.RawGetResponse, error) { return &kvrpcpb.RawGetResponse{}, nil } -// RawPut implements implements the tikvpb.TikvServer interface. +// RawPut implements the tikvpb.TikvServer interface. func (svr *Server) RawPut(context.Context, *kvrpcpb.RawPutRequest) (*kvrpcpb.RawPutResponse, error) { return &kvrpcpb.RawPutResponse{}, nil } -// RawDelete implements implements the tikvpb.TikvServer interface. +// RawDelete implements the tikvpb.TikvServer interface. func (svr *Server) RawDelete(context.Context, *kvrpcpb.RawDeleteRequest) (*kvrpcpb.RawDeleteResponse, error) { return &kvrpcpb.RawDeleteResponse{}, nil } -// RawScan implements implements the tikvpb.TikvServer interface. +// RawScan implements the tikvpb.TikvServer interface. func (svr *Server) RawScan(context.Context, *kvrpcpb.RawScanRequest) (*kvrpcpb.RawScanResponse, error) { return &kvrpcpb.RawScanResponse{}, nil } -// RawBatchDelete implements implements the tikvpb.TikvServer interface. +// RawBatchDelete implements the tikvpb.TikvServer interface. func (svr *Server) RawBatchDelete(context.Context, *kvrpcpb.RawBatchDeleteRequest) (*kvrpcpb.RawBatchDeleteResponse, error) { return &kvrpcpb.RawBatchDeleteResponse{}, nil } -// RawBatchGet implements implements the tikvpb.TikvServer interface. +// RawBatchGet implements the tikvpb.TikvServer interface. func (svr *Server) RawBatchGet(context.Context, *kvrpcpb.RawBatchGetRequest) (*kvrpcpb.RawBatchGetResponse, error) { return &kvrpcpb.RawBatchGetResponse{}, nil } -// RawBatchPut implements implements the tikvpb.TikvServer interface. +// RawBatchPut implements the tikvpb.TikvServer interface. func (svr *Server) RawBatchPut(context.Context, *kvrpcpb.RawBatchPutRequest) (*kvrpcpb.RawBatchPutResponse, error) { return &kvrpcpb.RawBatchPutResponse{}, nil } -// RawBatchScan implements implements the tikvpb.TikvServer interface. +// RawBatchScan implements the tikvpb.TikvServer interface. func (svr *Server) RawBatchScan(context.Context, *kvrpcpb.RawBatchScanRequest) (*kvrpcpb.RawBatchScanResponse, error) { return &kvrpcpb.RawBatchScanResponse{}, nil } -// RawDeleteRange implements implements the tikvpb.TikvServer interface. +// RawDeleteRange implements the tikvpb.TikvServer interface. func (svr *Server) RawDeleteRange(context.Context, *kvrpcpb.RawDeleteRangeRequest) (*kvrpcpb.RawDeleteRangeResponse, error) { return &kvrpcpb.RawDeleteRangeResponse{}, nil } // SQL push down commands. -// Coprocessor implements implements the tikvpb.TikvServer interface. +// Coprocessor implements the tikvpb.TikvServer interface. func (svr *Server) Coprocessor(_ context.Context, req *coprocessor.Request) (*coprocessor.Response, error) { reqCtx, err := newRequestCtx(svr, req.Context, "Coprocessor") if err != nil { @@ -568,7 +568,7 @@ func (svr *Server) Coprocessor(_ context.Context, req *coprocessor.Request) (*co return cophandler.HandleCopRequest(reqCtx.getDBReader(), svr.mvccStore.lockStore, req), nil } -// CoprocessorStream implements implements the tikvpb.TikvServer interface. +// CoprocessorStream implements the tikvpb.TikvServer interface. func (svr *Server) CoprocessorStream(*coprocessor.Request, tikvpb.Tikv_CoprocessorStreamServer) error { // TODO return nil @@ -584,7 +584,7 @@ func (regionError *RegionError) Error() string { return regionError.err.Message } -// BatchCoprocessor implements implements the tikvpb.TikvServer interface. +// BatchCoprocessor implements the tikvpb.TikvServer interface. func (svr *Server) BatchCoprocessor(req *coprocessor.BatchRequest, batchCopServer tikvpb.Tikv_BatchCoprocessorServer) error { reqCtxs := make([]*requestCtx, 0, len(req.Regions)) defer func() { @@ -628,7 +628,7 @@ func (svr *Server) BatchCoprocessor(req *coprocessor.BatchRequest, batchCopServe return nil } -// RawCoprocessor implements implements the tikvpb.TikvServer interface. +// RawCoprocessor implements the tikvpb.TikvServer interface. func (svr *Server) RawCoprocessor(context.Context, *kvrpcpb.RawCoprocessorRequest) (*kvrpcpb.RawCoprocessorResponse, error) { panic("unimplemented") } @@ -710,7 +710,7 @@ func (svr *Server) executeMPPDispatch(ctx context.Context, req *mpp.DispatchTask return nil } -// DispatchMPPTaskWithStoreID implements implements the tikvpb.TikvServer interface. +// DispatchMPPTaskWithStoreID implements the tikvpb.TikvServer interface. func (svr *Server) DispatchMPPTaskWithStoreID(ctx context.Context, req *mpp.DispatchTaskRequest, storeID uint64) (*mpp.DispatchTaskResponse, error) { mppHandler, err := svr.CreateMPPTaskHandler(req.Meta, storeID) if err != nil { @@ -728,12 +728,12 @@ func (svr *Server) DispatchMPPTaskWithStoreID(ctx context.Context, req *mpp.Disp return resp, nil } -// CancelMPPTask implements implements the tikvpb.TikvServer interface. +// CancelMPPTask implements the tikvpb.TikvServer interface. func (svr *Server) CancelMPPTask(_ context.Context, _ *mpp.CancelTaskRequest) (*mpp.CancelTaskResponse, error) { panic("todo") } -// GetMPPTaskHandler implements implements the tikvpb.TikvServer interface. +// GetMPPTaskHandler implements the tikvpb.TikvServer interface. func (svr *Server) GetMPPTaskHandler(taskID int64, storeID uint64) (*cophandler.MPPTaskHandler, error) { if mrm, ok := svr.regionManager.(*MockRegionManager); ok { set := mrm.getMPPTaskSet(storeID) @@ -750,7 +750,7 @@ func (svr *Server) GetMPPTaskHandler(taskID int64, storeID uint64) (*cophandler. return nil, errors.New("Only mock region mgr supports get mpp task") } -// RemoveMPPTaskHandler implements implements the tikvpb.TikvServer interface. +// RemoveMPPTaskHandler implements the tikvpb.TikvServer interface. func (svr *Server) RemoveMPPTaskHandler(taskID int64, storeID uint64) error { if mrm, ok := svr.regionManager.(*MockRegionManager); ok { err := mrm.removeMPPTaskHandler(taskID, storeID) @@ -759,7 +759,7 @@ func (svr *Server) RemoveMPPTaskHandler(taskID int64, storeID uint64) error { return errors.New("Only mock region mgr supports remove mpp task") } -// CreateMPPTaskHandler implements implements the tikvpb.TikvServer interface. +// CreateMPPTaskHandler implements the tikvpb.TikvServer interface. func (svr *Server) CreateMPPTaskHandler(meta *mpp.TaskMeta, storeID uint64) (*cophandler.MPPTaskHandler, error) { if mrm, ok := svr.regionManager.(*MockRegionManager); ok { set := mrm.getMPPTaskSet(storeID) @@ -782,12 +782,12 @@ func (svr *Server) CreateMPPTaskHandler(meta *mpp.TaskMeta, storeID uint64) (*co return nil, errors.New("Only mock region mgr supports get mpp task") } -// EstablishMPPConnection implements implements the tikvpb.TikvServer interface. +// EstablishMPPConnection implements the tikvpb.TikvServer interface. func (svr *Server) EstablishMPPConnection(*mpp.EstablishMPPConnectionRequest, tikvpb.Tikv_EstablishMPPConnectionServer) error { panic("todo") } -// EstablishMPPConnectionWithStoreID implements implements the tikvpb.TikvServer interface. +// EstablishMPPConnectionWithStoreID implements the tikvpb.TikvServer interface. func (svr *Server) EstablishMPPConnectionWithStoreID(req *mpp.EstablishMPPConnectionRequest, server tikvpb.Tikv_EstablishMPPConnectionServer, storeID uint64) error { var ( mppHandler *cophandler.MPPTaskHandler @@ -840,24 +840,24 @@ func (svr *Server) EstablishMPPConnectionWithStoreID(req *mpp.EstablishMPPConnec // Raft commands (tikv <-> tikv). -// Raft implements implements the tikvpb.TikvServer interface. +// Raft implements the tikvpb.TikvServer interface. func (svr *Server) Raft(stream tikvpb.Tikv_RaftServer) error { return svr.innerServer.Raft(stream) } -// Snapshot implements implements the tikvpb.TikvServer interface. +// Snapshot implements the tikvpb.TikvServer interface. func (svr *Server) Snapshot(stream tikvpb.Tikv_SnapshotServer) error { return svr.innerServer.Snapshot(stream) } -// BatchRaft implements implements the tikvpb.TikvServer interface. +// BatchRaft implements the tikvpb.TikvServer interface. func (svr *Server) BatchRaft(stream tikvpb.Tikv_BatchRaftServer) error { return svr.innerServer.BatchRaft(stream) } // Region commands. -// SplitRegion implements implements the tikvpb.TikvServer interface. +// SplitRegion implements the tikvpb.TikvServer interface. func (svr *Server) SplitRegion(ctx context.Context, req *kvrpcpb.SplitRegionRequest) (*kvrpcpb.SplitRegionResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "SplitRegion") if err != nil { @@ -872,7 +872,7 @@ func (svr *Server) Compact(ctx context.Context, req *kvrpcpb.CompactRequest) (*k panic("unimplemented") } -// ReadIndex implements implements the tikvpb.TikvServer interface. +// ReadIndex implements the tikvpb.TikvServer interface. func (svr *Server) ReadIndex(context.Context, *kvrpcpb.ReadIndexRequest) (*kvrpcpb.ReadIndexResponse, error) { // TODO: return &kvrpcpb.ReadIndexResponse{}, nil @@ -880,7 +880,7 @@ func (svr *Server) ReadIndex(context.Context, *kvrpcpb.ReadIndexRequest) (*kvrpc // transaction debugger commands. -// MvccGetByKey implements implements the tikvpb.TikvServer interface. +// MvccGetByKey implements the tikvpb.TikvServer interface. func (svr *Server) MvccGetByKey(ctx context.Context, req *kvrpcpb.MvccGetByKeyRequest) (*kvrpcpb.MvccGetByKeyResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "MvccGetByKey") if err != nil { @@ -899,7 +899,7 @@ func (svr *Server) MvccGetByKey(ctx context.Context, req *kvrpcpb.MvccGetByKeyRe return resp, nil } -// MvccGetByStartTs implements implements the tikvpb.TikvServer interface. +// MvccGetByStartTs implements the tikvpb.TikvServer interface. func (svr *Server) MvccGetByStartTs(ctx context.Context, req *kvrpcpb.MvccGetByStartTsRequest) (*kvrpcpb.MvccGetByStartTsResponse, error) { reqCtx, err := newRequestCtx(svr, req.Context, "MvccGetByStartTs") if err != nil { @@ -919,7 +919,7 @@ func (svr *Server) MvccGetByStartTs(ctx context.Context, req *kvrpcpb.MvccGetByS return resp, nil } -// UnsafeDestroyRange implements implements the tikvpb.TikvServer interface. +// UnsafeDestroyRange implements the tikvpb.TikvServer interface. func (svr *Server) UnsafeDestroyRange(ctx context.Context, req *kvrpcpb.UnsafeDestroyRangeRequest) (*kvrpcpb.UnsafeDestroyRangeResponse, error) { start, end := req.GetStartKey(), req.GetEndKey() svr.mvccStore.DeleteFileInRange(start, end) @@ -959,32 +959,32 @@ func (svr *Server) Detect(stream deadlockPb.Deadlock_DetectServer) error { return nil } -// CheckLockObserver implements implements the tikvpb.TikvServer interface. +// CheckLockObserver implements the tikvpb.TikvServer interface. func (svr *Server) CheckLockObserver(context.Context, *kvrpcpb.CheckLockObserverRequest) (*kvrpcpb.CheckLockObserverResponse, error) { // TODO: implement Observer return &kvrpcpb.CheckLockObserverResponse{IsClean: true}, nil } -// PhysicalScanLock implements implements the tikvpb.TikvServer interface. +// PhysicalScanLock implements the tikvpb.TikvServer interface. func (svr *Server) PhysicalScanLock(ctx context.Context, req *kvrpcpb.PhysicalScanLockRequest) (*kvrpcpb.PhysicalScanLockResponse, error) { resp := &kvrpcpb.PhysicalScanLockResponse{} resp.Locks = svr.mvccStore.PhysicalScanLock(req.StartKey, req.MaxTs, int(req.Limit)) return resp, nil } -// RegisterLockObserver implements implements the tikvpb.TikvServer interface. +// RegisterLockObserver implements the tikvpb.TikvServer interface. func (svr *Server) RegisterLockObserver(context.Context, *kvrpcpb.RegisterLockObserverRequest) (*kvrpcpb.RegisterLockObserverResponse, error) { // TODO: implement Observer return &kvrpcpb.RegisterLockObserverResponse{}, nil } -// RemoveLockObserver implements implements the tikvpb.TikvServer interface. +// RemoveLockObserver implements the tikvpb.TikvServer interface. func (svr *Server) RemoveLockObserver(context.Context, *kvrpcpb.RemoveLockObserverRequest) (*kvrpcpb.RemoveLockObserverResponse, error) { // TODO: implement Observer return &kvrpcpb.RemoveLockObserverResponse{}, nil } -// CheckLeader implements implements the tikvpb.TikvServer interface. +// CheckLeader implements the tikvpb.TikvServer interface. func (svr *Server) CheckLeader(context.Context, *kvrpcpb.CheckLeaderRequest) (*kvrpcpb.CheckLeaderResponse, error) { panic("unimplemented") } @@ -1004,7 +1004,7 @@ func (svr *Server) GetLockWaitInfo(context.Context, *kvrpcpb.GetLockWaitInfoRequ panic("unimplemented") } -// RawChecksum implements implements the tikvpb.TikvServer interface. +// RawChecksum implements the tikvpb.TikvServer interface. func (svr *Server) RawChecksum(context.Context, *kvrpcpb.RawChecksumRequest) (*kvrpcpb.RawChecksumResponse, error) { panic("unimplemented") }