From 97c74c5376801118e8ce86df52ad531d24f84df2 Mon Sep 17 00:00:00 2001 From: Zhao Xin Date: Tue, 30 Jun 2020 11:46:51 +0800 Subject: [PATCH] ddl, test: delete unstable code that cause test failed in ddl (#18230) * delete unstable code * change TestCommitWhenSchemaChange to testIntegrationSuite7 Co-authored-by: Lynn --- ddl/db_partition_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ddl/db_partition_test.go b/ddl/db_partition_test.go index da9375dd1d..9ed2f899d1 100644 --- a/ddl/db_partition_test.go +++ b/ddl/db_partition_test.go @@ -2317,7 +2317,7 @@ func (s *testIntegrationSuite3) TestUnsupportedPartitionManagementDDLs(c *C) { c.Assert(err, ErrorMatches, ".*alter table partition is unsupported") } -func (s *testIntegrationSuite3) TestCommitWhenSchemaChange(c *C) { +func (s *testIntegrationSuite7) TestCommitWhenSchemaChange(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec(`create table schema_change (a int, b timestamp) @@ -2338,8 +2338,10 @@ func (s *testIntegrationSuite3) TestCommitWhenSchemaChange(c *C) { tk.MustExec("insert into schema_change values (5, '2019-12-25 13:27:43')") tk.MustExec("insert into schema_change values (9, '2019-12-25 13:27:44')") atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 1) + defer func() { + atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 0) + }() _, err := tk.Se.Execute(context.Background(), "commit") - atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 0) c.Assert(domain.ErrInfoSchemaChanged.Equal(err), IsTrue) // Cover a bug that schema validator does not prevent transaction commit when @@ -2357,10 +2359,7 @@ func (s *testIntegrationSuite3) TestCommitWhenSchemaChange(c *C) { tk.MustExec("insert into nt values (1), (3), (5);") tk2.MustExec("alter table pt exchange partition p1 with table nt;") tk.MustExec("insert into nt values (7), (9);") - - atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 1) _, err = tk.Se.Execute(context.Background(), "commit") - atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 0) c.Assert(domain.ErrInfoSchemaChanged.Equal(err), IsTrue) tk.MustExec("admin check table pt") @@ -2372,9 +2371,7 @@ func (s *testIntegrationSuite3) TestCommitWhenSchemaChange(c *C) { tk.MustExec("insert into pt values (1), (3), (5);") tk2.MustExec("alter table pt exchange partition p1 with table nt;") tk.MustExec("insert into pt values (7), (9);") - atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 1) _, err = tk.Se.Execute(context.Background(), "commit") - atomic.StoreUint32(&session.SchemaChangedWithoutRetry, 0) c.Assert(domain.ErrInfoSchemaChanged.Equal(err), IsTrue) tk.MustExec("admin check table pt")