Skip to content

Commit

Permalink
test: fix unstable TestPessimisticLockOnPartition (pingcap#18963)
Browse files Browse the repository at this point in the history
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
  • Loading branch information
coocood and ti-srebot authored Aug 4, 2020
1 parent bd06d23 commit 22243f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3167,6 +3167,7 @@ func (s *testSessionSuite3) TestPessimisticLockOnPartition(c *C) {
tk1.MustExec("update forupdate_on_partition set first_name='sw' where age=25")
ch <- 0
tk1.MustExec("commit")
ch <- 0
}()

// Leave 50ms for tk1 to run, tk1 should be blocked at the update operation.
Expand All @@ -3177,6 +3178,7 @@ func (s *testSessionSuite3) TestPessimisticLockOnPartition(c *C) {
// tk1 should be blocked until tk commit, check the order.
c.Assert(<-ch, Equals, int32(1))
c.Assert(<-ch, Equals, int32(0))
<-ch // wait for goroutine to quit.

// Once again...
// This time, test for the update-update conflict.
Expand All @@ -3188,6 +3190,7 @@ func (s *testSessionSuite3) TestPessimisticLockOnPartition(c *C) {
tk1.MustExec("update forupdate_on_partition set first_name = 'xxx' where age=25")
ch <- 0
tk1.MustExec("commit")
ch <- 0
}()

// Leave 50ms for tk1 to run, tk1 should be blocked at the update operation.
Expand All @@ -3198,6 +3201,7 @@ func (s *testSessionSuite3) TestPessimisticLockOnPartition(c *C) {
// tk1 should be blocked until tk commit, check the order.
c.Assert(<-ch, Equals, int32(1))
c.Assert(<-ch, Equals, int32(0))
<-ch // wait for goroutine to quit.
}

func (s *testSchemaSuite) TestTxnSize(c *C) {
Expand Down

0 comments on commit 22243f8

Please sign in to comment.