Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: zyguan <zhongyangguan@gmail.com>
  • Loading branch information
zyguan committed Mar 23, 2023
1 parent b5554a2 commit d2a220d
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions tests/realtikvtest/pessimistictest/pessimistic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2816,71 +2816,7 @@ func TestAsyncCommitCalTSFail(t *testing.T) {
tk2.MustExec("commit")
}

<<<<<<< HEAD
func TestChangeLockToPut(t *testing.T) {
=======
func TestAsyncCommitAndForeignKey(t *testing.T) {
defer config.RestoreFunc()()
config.UpdateGlobal(func(conf *config.Config) {
conf.TiKVClient.AsyncCommit.SafeWindow = time.Second
conf.TiKVClient.AsyncCommit.AllowedClockDrift = 0
})
store := realtikvtest.CreateMockStoreAndSetup(t)
tk := createAsyncCommitTestKit(t, store)
tk.MustExec("drop table if exists t_parent, t_child")
tk.MustExec("create table t_parent (id int primary key)")
tk.MustExec("create table t_child (id int primary key, pid int, foreign key (pid) references t_parent(id) on delete cascade on update cascade)")
tk.MustExec("insert into t_parent values (1),(2),(3),(4)")
tk.MustExec("insert into t_child values (1,1),(2,2),(3,3)")
tk.MustExec("set tidb_enable_1pc = true")
tk.MustExec("begin pessimistic")
tk.MustExec("delete from t_parent where id in (1,4)")
tk.MustExec("update t_parent set id=22 where id=2")
tk.MustExec("commit")
tk.MustQuery("select * from t_parent order by id").Check(testkit.Rows("3", "22"))
tk.MustQuery("select * from t_child order by id").Check(testkit.Rows("2 22", "3 3"))
}

func TestTransactionIsolationAndForeignKey(t *testing.T) {
if !*realtikvtest.WithRealTiKV {
t.Skip("The test only support test with tikv.")
}
store := realtikvtest.CreateMockStoreAndSetup(t)
tk := testkit.NewTestKit(t, store)
tk2 := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk2.MustExec("use test")
tk.MustExec("drop table if exists t1,t2")
tk.MustExec("create table t1 (id int primary key)")
tk.MustExec("create table t2 (id int primary key, pid int, foreign key (pid) references t1(id) on delete cascade on update cascade)")
tk.MustExec("insert into t1 values (1)")
tk.MustExec("set tx_isolation = 'READ-COMMITTED'")
tk.MustExec("begin pessimistic")
tk.MustExec("insert into t2 values (1,1)")
tk.MustGetDBError("insert into t2 values (2,2)", plannercore.ErrNoReferencedRow2)
tk2.MustExec("insert into t1 values (2)")
tk.MustQuery("select * from t1").Check(testkit.Rows("1", "2"))
tk.MustExec("insert into t2 values (2,2)")
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
tk2.MustExec("delete from t1 where id=2")
}()
time.Sleep(time.Millisecond * 10)
tk.MustExec("commit")
wg.Wait()
tk.MustQuery("select * from t1").Check(testkit.Rows("1"))
tk.MustQuery("select * from t2").Check(testkit.Rows("1 1"))
tk2.MustExec("delete from t1 where id=1")
tk.MustQuery("select * from t1").Check(testkit.Rows())
tk.MustQuery("select * from t2").Check(testkit.Rows())
tk.MustExec("admin check table t1")
tk.MustExec("admin check table t2")
}

func TestIssue28011(t *testing.T) {
>>>>>>> 273763b51e8 (executor: revert #25730 to fix #28011 (#42488))
store := realtikvtest.CreateMockStoreAndSetup(t)

tk := testkit.NewTestKit(t, store)
Expand Down

0 comments on commit d2a220d

Please sign in to comment.