Skip to content

Commit

Permalink
*: enlarge the default value of max-merge-region-size. (#8445)
Browse files Browse the repository at this point in the history
close #8484, ref tikv/tikv#17309

This pr is used to enlarge the region size from default value `96MB` to `256MB`, compatible to the requirement of the stability of large cluster.

Signed-off-by: lucasliang <[email protected]>
  • Loading branch information
LykxSassinator authored Aug 2, 2024
1 parent 95645aa commit aa85b6c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 7 additions & 4 deletions pkg/schedule/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/pd-ctl/tests/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion tools/pd-ctl/tests/region/region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <start_key> <end_key> <limit> command
Expand Down

0 comments on commit aa85b6c

Please sign in to comment.