Skip to content

Commit

Permalink
Revert "address comments"
Browse files Browse the repository at this point in the history
This reverts commit c661abe.
  • Loading branch information
windtalker committed Mar 12, 2021
1 parent 2ecaf80 commit ab4daa7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
30 changes: 24 additions & 6 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,18 @@ func (s *testIntegrationSerialSuite) TestJoinNotSupportedByTiFlash(c *C) {
tk.MustExec("analyze table table_1")

// Create virtual tiflash replica info.
tb := testkit.TestGetTableByName(c, tk.Se, "test", "table_1")
err := domain.GetDomain(tk.Se).DDL().UpdateTableReplicaInfo(tk.Se, tb.Meta().ID, true)
c.Assert(err, IsNil)
dom := domain.GetDomain(tk.Se)
is := dom.InfoSchema()
db, exists := is.SchemaByName(model.NewCIStr("test"))
c.Assert(exists, IsTrue)
for _, tblInfo := range db.Tables {
if tblInfo.Name.L == "table_1" {
tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{
Count: 1,
Available: true,
}
}
}

tk.MustExec("set @@session.tidb_isolation_read_engines = 'tiflash'")
tk.MustExec("set @@session.tidb_allow_mpp = 1")
Expand Down Expand Up @@ -626,9 +635,18 @@ func (s *testIntegrationSerialSuite) TestMPPNotSupportedInNewCollation(c *C) {
tk.MustExec("analyze table table_1")

// Create virtual tiflash replica info.
tb := testkit.TestGetTableByName(c, tk.Se, "test", "table_1")
err := domain.GetDomain(tk.Se).DDL().UpdateTableReplicaInfo(tk.Se, tb.Meta().ID, true)
c.Assert(err, IsNil)
dom := domain.GetDomain(tk.Se)
is := dom.InfoSchema()
db, exists := is.SchemaByName(model.NewCIStr("test"))
c.Assert(exists, IsTrue)
for _, tblInfo := range db.Tables {
if tblInfo.Name.L == "table_1" {
tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{
Count: 1,
Available: true,
}
}
}

collate.SetNewCollationEnabledForTest(true)
tk.MustExec("set @@session.tidb_isolation_read_engines = 'tiflash'")
Expand Down
13 changes: 0 additions & 13 deletions util/testkit/testkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import (
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/session"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/sqlexec"
"github.com/pingcap/tidb/util/testutil"
Expand Down Expand Up @@ -369,14 +367,3 @@ func WithPruneMode(tk *TestKit, mode variable.PartitionPruneMode, f func()) {
tk.MustExec("set global tidb_partition_prune_mode=`" + string(mode) + "`")
f()
}

// TestGetTableByName get the table info by name, will assert error if not found
func TestGetTableByName(c *check.C, ctx sessionctx.Context, db, table string) table.Table {
dom := domain.GetDomain(ctx)
// Make sure the table schema is the new schema.
err := dom.Reload()
c.Assert(err, check.IsNil)
tbl, err := dom.InfoSchema().TableByName(model.NewCIStr(db), model.NewCIStr(table))
c.Assert(err, check.IsNil)
return tbl
}

0 comments on commit ab4daa7

Please sign in to comment.