Skip to content

Commit

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

close #54760
  • Loading branch information
ti-chi-bot authored Aug 28, 2024
1 parent 14a1cb0 commit d5c96a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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 @@ -485,6 +485,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 d5c96a0

Please sign in to comment.