@@ -94,7 +94,12 @@ func (s *testMockTiKVSuite) mustGetRC(c *C, key string, ts uint64, expect string
9494}
9595
9696func (s * testMockTiKVSuite ) mustPutOK (c * C , key , value string , startTS , commitTS uint64 ) {
97- errs := s .store .Prewrite (putMutations (key , value ), []byte (key ), startTS , 0 )
97+ req := & kvrpcpb.PrewriteRequest {
98+ Mutations : putMutations (key , value ),
99+ PrimaryLock : []byte (key ),
100+ StartVersion : startTS ,
101+ }
102+ errs := s .store .Prewrite (req )
98103 for _ , err := range errs {
99104 c .Assert (err , IsNil )
100105 }
@@ -109,7 +114,12 @@ func (s *testMockTiKVSuite) mustDeleteOK(c *C, key string, startTS, commitTS uin
109114 Key : []byte (key ),
110115 },
111116 }
112- errs := s .store .Prewrite (mutations , []byte (key ), startTS , 0 )
117+ req := & kvrpcpb.PrewriteRequest {
118+ Mutations : mutations ,
119+ PrimaryLock : []byte (key ),
120+ StartVersion : startTS ,
121+ }
122+ errs := s .store .Prewrite (req )
113123 for _ , err := range errs {
114124 c .Assert (err , IsNil )
115125 }
@@ -146,7 +156,12 @@ func (s *testMockTiKVSuite) mustRangeReverseScanOK(c *C, start, end string, limi
146156}
147157
148158func (s * testMockTiKVSuite ) mustPrewriteOK (c * C , mutations []* kvrpcpb.Mutation , primary string , startTS uint64 ) {
149- errs := s .store .Prewrite (mutations , []byte (primary ), startTS , 0 )
159+ req := & kvrpcpb.PrewriteRequest {
160+ Mutations : mutations ,
161+ PrimaryLock : []byte (primary ),
162+ StartVersion : startTS ,
163+ }
164+ errs := s .store .Prewrite (req )
150165 for _ , err := range errs {
151166 c .Assert (err , IsNil )
152167 }
@@ -412,7 +427,12 @@ func (s *testMockTiKVSuite) TestCommitConflict(c *C) {
412427 // A prewrite.
413428 s .mustPrewriteOK (c , putMutations ("x" , "A" ), "x" , 5 )
414429 // B prewrite and find A's lock.
415- errs := s .store .Prewrite (putMutations ("x" , "B" ), []byte ("x" ), 10 , 0 )
430+ req := & kvrpcpb.PrewriteRequest {
431+ Mutations : putMutations ("x" , "B" ),
432+ PrimaryLock : []byte ("x" ),
433+ StartVersion : 10 ,
434+ }
435+ errs := s .store .Prewrite (req )
416436 c .Assert (errs [0 ], NotNil )
417437 // B find rollback A because A exist too long.
418438 s .mustRollbackOK (c , [][]byte {[]byte ("x" )}, 5 )
@@ -470,17 +490,27 @@ func (s *testMockTiKVSuite) TestBatchResolveLock(c *C) {
470490
471491func (s * testMockTiKVSuite ) TestRollbackAndWriteConflict (c * C ) {
472492 s .mustPutOK (c , "test" , "test" , 1 , 3 )
473-
474- errs := s .store .Prewrite (putMutations ("lock" , "lock" , "test" , "test1" ), []byte ("test" ), 2 , 2 )
493+ req := & kvrpcpb.PrewriteRequest {
494+ Mutations : putMutations ("lock" , "lock" , "test" , "test1" ),
495+ PrimaryLock : []byte ("test" ),
496+ StartVersion : 2 ,
497+ LockTtl : 2 ,
498+ }
499+ errs := s .store .Prewrite (req )
475500 s .mustWriteWriteConflict (c , errs , 1 )
476501
477502 s .mustPutOK (c , "test" , "test2" , 5 , 8 )
478503
479504 // simulate `getTxnStatus` for txn 2.
480505 err := s .store .Cleanup ([]byte ("test" ), 2 )
481506 c .Assert (err , IsNil )
482-
483- errs = s .store .Prewrite (putMutations ("test" , "test3" ), []byte ("test" ), 6 , 1 )
507+ req = & kvrpcpb.PrewriteRequest {
508+ Mutations : putMutations ("test" , "test3" ),
509+ PrimaryLock : []byte ("test" ),
510+ StartVersion : 6 ,
511+ LockTtl : 1 ,
512+ }
513+ errs = s .store .Prewrite (req )
484514 s .mustWriteWriteConflict (c , errs , 0 )
485515}
486516
0 commit comments