Skip to content

Commit

Permalink
ddl: Fix placement policy in alter table partition by (pingcap#48631)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjonss authored Nov 21, 2023
1 parent 36e68a0 commit 058a961
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4376,6 +4376,10 @@ func (d *ddl) AlterTablePartitioning(ctx sessionctx.Context, ident ast.Ident, sp
}
newPartInfo := newMeta.Partition

if err = handlePartitionPlacement(ctx, newPartInfo); err != nil {
return errors.Trace(err)
}

if err = d.assignPartitionIDs(newPartInfo.Definitions); err != nil {
return errors.Trace(err)
}
Expand Down
3 changes: 3 additions & 0 deletions tests/integrationtest/r/partition.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
create placement policy pp1 followers=1;
create table t (a int);
alter table t partition by range (a) (partition p0 values less than (1000000), partition pMax values less than (maxvalue) placement policy pp1);
3 changes: 3 additions & 0 deletions tests/integrationtest/t/partition.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
create placement policy pp1 followers=1;
create table t (a int);
alter table t partition by range (a) (partition p0 values less than (1000000), partition pMax values less than (maxvalue) placement policy pp1);

0 comments on commit 058a961

Please sign in to comment.