diff --git a/ddl/placement_policy_test.go b/ddl/placement_policy_test.go index 35760acc635d1..48465d32a986e 100644 --- a/ddl/placement_policy_test.go +++ b/ddl/placement_policy_test.go @@ -514,9 +514,7 @@ func (s *testDBSuite6) TestAlterTablePartitionWithPlacementPolicy(c *C) { tk.MustExec("alter table t1 partition p0 " + "PRIMARY_REGION=\"cn-east-1\" " + "REGIONS=\"cn-east-1, cn-east-2\" " + - "FOLLOWERS=2 " + - "FOLLOWER_CONSTRAINTS=\"[+zone=cn-east-1]\" " + - "CONSTRAINTS=\"[+disk=ssd]\"") + "FOLLOWERS=2 ") tbl := testGetTableByName(c, tk.Se, "test", "t1") c.Assert(tbl, NotNil) @@ -528,12 +526,12 @@ func (s *testDBSuite6) TestAlterTablePartitionWithPlacementPolicy(c *C) { c.Assert(policySetting.PrimaryRegion, Equals, "cn-east-1") c.Assert(policySetting.Regions, Equals, "cn-east-1, cn-east-2") c.Assert(policySetting.Followers, Equals, uint64(2)) - c.Assert(policySetting.FollowerConstraints, Equals, "[+zone=cn-east-1]") + c.Assert(policySetting.FollowerConstraints, Equals, "") c.Assert(policySetting.Voters, Equals, uint64(0)) c.Assert(policySetting.VoterConstraints, Equals, "") c.Assert(policySetting.Learners, Equals, uint64(0)) c.Assert(policySetting.LearnerConstraints, Equals, "") - c.Assert(policySetting.Constraints, Equals, "[+disk=ssd]") + c.Assert(policySetting.Constraints, Equals, "") c.Assert(policySetting.Schedule, Equals, "") } checkFunc(ptDef.DirectPlacementOpts) @@ -543,8 +541,6 @@ func (s *testDBSuite6) TestAlterTablePartitionWithPlacementPolicy(c *C) { "PRIMARY_REGION=\"cn-east-1\" " + "REGIONS=\"cn-east-1, cn-east-2\" " + "FOLLOWERS=2 " + - "FOLLOWER_CONSTRAINTS=\"[+zone=cn-east-1]\" " + - "CONSTRAINTS=\"[+disk=ssd]\" " + "PLACEMENT POLICY=\"x\"") c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "[ddl:8240]Placement policy 'x' can't co-exist with direct placement options") @@ -563,22 +559,10 @@ func (s *testDBSuite6) TestAlterTablePartitionWithPlacementPolicy(c *C) { c.Assert(ptDef.PlacementPolicyRef.Name.L, Equals, "x") c.Assert(ptDef.PlacementPolicyRef.ID != 0, Equals, true) - // Only direct placement options should check the compatibility itself. - _, err = tk.Exec("alter table t1 partition p0 " + - "PRIMARY_REGION=\"cn-east-1\" " + - "REGIONS=\"cn-east-1, cn-east-2\" " + - "FOLLOWERS=2 " + - "FOLLOWER_CONSTRAINTS=\"[+zone=cn-east-1]\" " + - "CONSTRAINTS=\"[+disk=ssd, -zone=cn-east-1]\" ") - c.Assert(err, NotNil) - c.Assert(err.Error(), Equals, "conflicting label constraints: '-zone=cn-east-1' and '+zone=cn-east-1'") - tk.MustExec("alter table t1 partition p0 " + "PRIMARY_REGION=\"cn-east-1\" " + "REGIONS=\"cn-east-1, cn-east-2\" " + - "FOLLOWERS=2 " + - "FOLLOWER_CONSTRAINTS=\"[+zone=cn-east-1]\" " + - "CONSTRAINTS=\"[+disk=ssd]\" ") + "FOLLOWERS=2 ") ptDef = testGetPartitionDefinitionsByName(c, tk.Se, "test", "t1", "p0") c.Assert(ptDef, NotNil) @@ -588,12 +572,12 @@ func (s *testDBSuite6) TestAlterTablePartitionWithPlacementPolicy(c *C) { c.Assert(policySetting.PrimaryRegion, Equals, "cn-east-1") c.Assert(policySetting.Regions, Equals, "cn-east-1, cn-east-2") c.Assert(policySetting.Followers, Equals, uint64(2)) - c.Assert(policySetting.FollowerConstraints, Equals, "[+zone=cn-east-1]") + c.Assert(policySetting.FollowerConstraints, Equals, "") c.Assert(policySetting.Voters, Equals, uint64(0)) c.Assert(policySetting.VoterConstraints, Equals, "") c.Assert(policySetting.Learners, Equals, uint64(0)) c.Assert(policySetting.LearnerConstraints, Equals, "") - c.Assert(policySetting.Constraints, Equals, "[+disk=ssd]") + c.Assert(policySetting.Constraints, Equals, "") c.Assert(policySetting.Schedule, Equals, "") } checkFunc(ptDef.DirectPlacementOpts)