Skip to content

Commit

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

close #54760
  • Loading branch information
ti-chi-bot authored Jul 31, 2024
1 parent d60e830 commit 92e1809
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 @@ -45,7 +45,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 @@ -510,3 +510,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 @@ -591,6 +591,7 @@ func NewContext() *Context {
vars.MinPagingSize = variable.DefMinPagingSize
vars.CostModelVersion = variable.DefTiDBCostModelVer
vars.EnableChunkRPC = true
vars.EnableListTablePartition = true
vars.DivPrecisionIncrement = variable.DefDivPrecisionIncrement
if err := sctx.GetSessionVars().SetSystemVar(variable.MaxAllowedPacket, "67108864"); err != nil {
panic(err)
Expand Down

0 comments on commit 92e1809

Please sign in to comment.