Consulting a TiKV question: Does TiKV region support merging?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 咨询个 tikv的问题:tikv region 支持合并不 ?

| username: TiDBer_6QlGixpC

As the title suggests, I have been studying PD recently. When looking at the code, I only saw the code related to splitting regions pd/server/cluster/cluster_worker.go at bbd3bdb56f80faddda222cb63628c5007fd330bd · tikv/pd · GitHub, but I didn’t see the code for merging regions, which makes me a bit confused.

| username: tidb菜鸟一只 | Original post link

Support merging, with merge region enabled by default.

| username: zhanggame1 | Original post link

I haven’t looked at the code, but the official documentation mentions merging, supporting the merging of regions from multiple tables.

| username: 江湖故人 | Original post link

Regions support merging, and merging and splitting are managed by PD.

split-merge-interval
max-merge-region-size
max-merge-region-keys
When a newly split Region exists for a time exceeding the value of the configuration item split-merge-interval (default 1h), and if it simultaneously meets the conditions of being smaller than max-merge-region-size/max-merge-region-keys, merging will be triggered.

| username: TiDBer_6QlGixpC | Original post link

Oh, let me take another look at the code. Is this part of the code implemented in TiKV?

| username: 江湖故人 | Original post link

It should be PD scheduling.

| username: TiDBer_6QlGixpC | Original post link

Thank you, everyone. I found the code related to merge region.

| username: dba远航 | Original post link

It must support merging.

| username: 烂番薯0 | Original post link

It can be merged.

| username: TiDBer_aaO4sU46 | Original post link

Support merging

| username: redgame | Original post link

Enable merge region by default