Skip to content

Commit

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

close #54760
  • Loading branch information
ti-chi-bot authored Oct 28, 2024
1 parent b4dffe3 commit 631b63d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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 = [
"//executor",
"//infoschema",
Expand Down
22 changes: 22 additions & 0 deletions 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()
execCreate(t, tracker, sql)

sql = "ALTER TABLE test.employees11 DROP PARTITION pEast;"
execAlter(t, tracker, sql)
}
1 change: 1 addition & 0 deletions util/mock/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,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 631b63d

Please sign in to comment.