br icon indicating copy to clipboard operation
br copied to clipboard

Reduce split empty region during restoration.

Open 3pointer opened this issue 4 years ago • 2 comments

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error. restore data and check the empty region count after restore.

  2. What did you expect to see? meaningful region count.

  3. 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",   
   }
  1. What version of BR and TiDB/TiKV/PD are you using? All master

3pointer avatar Jan 25 '21 11:01 3pointer

The reason is we split regions by table rewrite rule and data rewrite rule. but these rules are duplicated.

  1. we collect the rewrite rules for each table before restoration. https://github.com/pingcap/br/blob/1a527fbbd5f4d52bf6e54917fcedcae96645d3bc/pkg/restore/util.go#L64-L80
  2. 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).

3pointer avatar Jan 25 '21 11:01 3pointer

can we just remove the table rewrite rules? seems useless.

kennytm avatar Jan 28 '21 10:01 kennytm