diff --git a/conf/config.toml b/conf/config.toml index 438d2c857a5..0c4acf5fd8c 100644 --- a/conf/config.toml +++ b/conf/config.toml @@ -111,9 +111,9 @@ [schedule] ## Controls the size limit of Region Merge. -# max-merge-region-size = 20 +# max-merge-region-size = 54 ## Specifies the upper limit of the Region Merge key. -# max-merge-region-keys = 200000 +# max-merge-region-keys = 540000 ## Controls the time interval between the split and merge operations on the same Region. # split-merge-interval = "1h" ## When PD fails to receive the heartbeat from a store after the specified period of time, diff --git a/pkg/schedule/config/config.go b/pkg/schedule/config/config.go index 5a67a547483..d35f7ac6383 100644 --- a/pkg/schedule/config/config.go +++ b/pkg/schedule/config/config.go @@ -27,10 +27,13 @@ import ( const ( // DefaultMaxReplicas is the default number of replicas for each region. - DefaultMaxReplicas = 3 - defaultMaxSnapshotCount = 64 - defaultMaxPendingPeerCount = 64 - defaultMaxMergeRegionSize = 20 + DefaultMaxReplicas = 3 + defaultMaxSnapshotCount = 64 + defaultMaxPendingPeerCount = 64 + // defaultMaxMergeRegionSize is the default maximum size of region when regions can be merged. + // After https://github.com/tikv/tikv/issues/17309, the default value is enlarged from 20 to 54, + // to make it compatible with the default value of region size of tikv. + defaultMaxMergeRegionSize = 54 defaultLeaderScheduleLimit = 4 defaultRegionScheduleLimit = 2048 defaultWitnessScheduleLimit = 4 diff --git a/tools/pd-ctl/tests/config/config_test.go b/tools/pd-ctl/tests/config/config_test.go index 2a9f7bb2353..f3c261e1f49 100644 --- a/tools/pd-ctl/tests/config/config_test.go +++ b/tools/pd-ctl/tests/config/config_test.go @@ -181,9 +181,11 @@ func (suite *configTestSuite) checkConfig(cluster *pdTests.TestCluster) { scheduleConfig.MaxMergeRegionKeys = scheduleConfig.GetMaxMergeRegionKeys() re.Equal(scheduleConfig, &scheduleCfg) - re.Equal(20, int(svr.GetScheduleConfig().MaxMergeRegionSize)) + // After https://github.com/tikv/tikv/issues/17309, the default value is enlarged from 20 to 54, + // to make it compatible with the default value of region size of tikv. + re.Equal(54, int(svr.GetScheduleConfig().MaxMergeRegionSize)) re.Equal(0, int(svr.GetScheduleConfig().MaxMergeRegionKeys)) - re.Equal(20*10000, int(svr.GetScheduleConfig().GetMaxMergeRegionKeys())) + re.Equal(54*10000, int(svr.GetScheduleConfig().GetMaxMergeRegionKeys())) // set max-merge-region-size to 40MB args = []string{"-u", pdAddr, "config", "set", "max-merge-region-size", "40"} diff --git a/tools/pd-ctl/tests/region/region_test.go b/tools/pd-ctl/tests/region/region_test.go index afffba411bc..49f1eaa0a58 100644 --- a/tools/pd-ctl/tests/region/region_test.go +++ b/tools/pd-ctl/tests/region/region_test.go @@ -142,7 +142,7 @@ func TestRegion(t *testing.T) { // region check empty-region command {[]string{"region", "check", "empty-region"}, []*core.RegionInfo{r1}}, // region check undersized-region command - {[]string{"region", "check", "undersized-region"}, []*core.RegionInfo{r1, r4}}, + {[]string{"region", "check", "undersized-region"}, []*core.RegionInfo{r1, r3, r4}}, // region check oversized-region command {[]string{"region", "check", "oversized-region"}, []*core.RegionInfo{r2}}, // region keys --format=raw command