br
br copied to clipboard
Reduce split empty region during restoration.
Please answer these questions before submitting your issue. Thanks!
-
What did you do? If possible, provide a recipe for reproducing the error. restore data and check the empty region count after restore.
-
What did you expect to see? meaningful region count.
-
What did you see instead? some empty regions shouldn't exist. for example
{
"id": 44,
"start_key": "7480000000000000FF2B00000000000000F8",
"end_key": "7480000000000000FF2F00000000000000F8",
}
{
"id": 46,
"start_key": "7480000000000000FF2F00000000000000F8",
"end_key": "7480000000000000FF2F5F720000000000FA",
}
- What version of BR and TiDB/TiKV/PD are you using? All master
The reason is we split regions by table rewrite rule and data rewrite rule. but these rules are duplicated.
- we collect the rewrite rules for each table before restoration. https://github.com/pingcap/br/blob/1a527fbbd5f4d52bf6e54917fcedcae96645d3bc/pkg/restore/util.go#L64-L80
- we collect the split keys for these rules https://github.com/pingcap/br/blob/006480b87ee371a985c9bbaa477ff13b2c6ebe2e/pkg/restore/split.go#L279-L284.
so, BR will generate two more empty regions for each table
[.., t_47_), [t_47_, t_47_r).
can we just remove the table rewrite rules? seems useless.