Skip to content

Commit

Permalink
util, schematracker: mock sctx turn on EnableListTablePartition (#54761
Browse files Browse the repository at this point in the history
…) (#54794)

close #54760
  • Loading branch information
ti-chi-bot authored Jul 22, 2024
1 parent e0332bf commit 08785b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ddl/schematracker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ go_test(
],
embed = [":schematracker"],
flaky = True,
shard_count = 14,
shard_count = 15,
deps = [
"//pkg/executor",
"//pkg/infoschema",
Expand Down
22 changes: 22 additions & 0 deletions pkg/ddl/schematracker/dm_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,25 @@ func TestModifyFromNullToNotNull(t *testing.T) {
tblInfo := mustTableByName(t, tracker, "test", "t")
require.Len(t, tblInfo.Columns, 2)
}

func TestDropListPartition(t *testing.T) {
sql := `
CREATE TABLE test.employees11 (
id INT NOT NULL,
hired DATE NOT NULL DEFAULT '1970-01-01',
store_id INT,
PRIMARY KEY (id,store_id)
)
PARTITION BY LIST (store_id) (
PARTITION pNorth VALUES IN (1, 2, 3, 4, 5),
PARTITION pEast VALUES IN (6, 7, 8, 9, 10),
PARTITION pWest VALUES IN (11, 12, 13, 14, 15),
PARTITION pCentral VALUES IN (16, 17, 18, 19, 20)
);`
tracker := schematracker.NewSchemaTracker(2)
tracker.CreateTestDB(nil)
execCreate(t, tracker, sql)

sql = "ALTER TABLE test.employees11 DROP PARTITION pEast;"
execAlter(t, tracker, sql)
}
1 change: 1 addition & 0 deletions pkg/util/mock/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ func NewContext() *Context {
vars.MinPagingSize = variable.DefMinPagingSize
vars.CostModelVersion = variable.DefTiDBCostModelVer
vars.EnableChunkRPC = true
vars.EnableListTablePartition = true
if err := sctx.GetSessionVars().SetSystemVar(variable.MaxAllowedPacket, "67108864"); err != nil {
panic(err)
}
Expand Down

0 comments on commit 08785b6

Please sign in to comment.