diff --git a/go.mod b/go.mod index cda0a8de747ec..c5098f5ba74eb 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/pingcap/errors v0.11.4 github.com/pingcap/failpoint v0.0.0-20190422094118-d8535965f59b github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e - github.com/pingcap/kvproto v0.0.0-20190517030054-ff2e03f6fdfe + github.com/pingcap/kvproto v0.0.0-20190528074401-b942b3f4108f github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596 github.com/pingcap/parser v0.0.0-20190603120328-7cb252e677b5 github.com/pingcap/pd v0.0.0-20190424024702-bd1e2496a669 diff --git a/go.sum b/go.sum index 9f659ea46b5c6..d090160a1e011 100644 --- a/go.sum +++ b/go.sum @@ -160,8 +160,8 @@ github.com/pingcap/gofail v0.0.0-20181217135706-6a951c1e42c3/go.mod h1:DazNTg0PT github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e h1:P73/4dPCL96rGrobssy1nVy2VaVpNCuLpCbr+FEaTA8= github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw= github.com/pingcap/kvproto v0.0.0-20190327032727-3d8cb3a30d5d/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= -github.com/pingcap/kvproto v0.0.0-20190517030054-ff2e03f6fdfe h1:hs1Y4RTsPg0DOEGanGxaXG/2iqewWNY6/GVLkFnZMaU= -github.com/pingcap/kvproto v0.0.0-20190517030054-ff2e03f6fdfe/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= +github.com/pingcap/kvproto v0.0.0-20190528074401-b942b3f4108f h1:EXZvZmZl+n4PGSRD8fykjHGzXS8QarWYx7KgIBBa7rg= +github.com/pingcap/kvproto v0.0.0-20190528074401-b942b3f4108f/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= github.com/pingcap/log v0.0.0-20190214045112-b37da76f67a7/go.mod h1:xsfkWVaFVV5B8e1K9seWfyJWFrIhbtUTAD8NV1Pq3+w= github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596 h1:t2OQTpPJnrPDGlvA+3FwJptMTt6MEPdzK1Wt99oaefQ= github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go index 7f62263b1bfba..1f1de71f66b1e 100644 --- a/store/tikv/2pc.go +++ b/store/tikv/2pc.go @@ -476,6 +476,7 @@ func (c *twoPhaseCommitter) buildPrewriteRequest(batch batchKeys) *tikvrpc.Reque StartVersion: c.startTS, LockTtl: c.lockTTL, IsPessimisticLock: isPessimisticLock, + ForUpdateTs: c.forUpdateTS, }, Context: pb.Context{ Priority: c.priority, @@ -616,6 +617,9 @@ func (c *twoPhaseCommitter) pessimisticLockSingleBatch(bo *Backoffer, batch batc } return errors.Trace(conditionPair.Err()) } + if deadlock := keyErr.Deadlock; deadlock != nil { + return errors.New("deadlock") + } // Extract lock from key error lock, err1 := extractLockFromKeyErr(keyErr) diff --git a/store/tikv/2pc_test.go b/store/tikv/2pc_test.go index 42f4c5f0cfdd0..e85192bd3acae 100644 --- a/store/tikv/2pc_test.go +++ b/store/tikv/2pc_test.go @@ -450,9 +450,11 @@ func (s *testCommitterSuite) TestPessimisticPrewriteRequest(c *C) { c.Assert(err, IsNil) commiter, err := newTwoPhaseCommitterWithInit(txn, 0) c.Assert(err, IsNil) + commiter.forUpdateTS = 100 var batch batchKeys batch.keys = append(batch.keys, []byte("t1")) batch.region = RegionVerID{1, 1, 1} req := commiter.buildPrewriteRequest(batch) c.Assert(len(req.Prewrite.IsPessimisticLock), Greater, 0) + c.Assert(req.Prewrite.ForUpdateTs, Equals, uint64(100)) }