I wanna use TiKV for a project but I’d like to know how TiDB ensures that each table it creates in TiKV is associated to a specific region ?
TiDB’s documentation says
split-table configuration option is enabled by default. When it is enabled, a separate Region is created for each newly created table
How can I guarantee that when I create a certain predicate like /peterpetrelli/t1/col1/… it ends in a specific region. I would even want everything that starts with /peterpetrelli/ to end up in the same region(s) and not be shared by keys starting with other prefixes. How would I do it with TiKV ?
I don’t think you can do that. You can’t control the region in that way. The only thing you can do is to use pdctl to manually split the region PD Control User Guide | PingCAP Docs
operator add split-region 1 --policy=scan // Split Region 1 into two Regions in halves, based on accurate scan value
Or use split region statement to control the regions in a Table. Split Region | PingCAP Docs
Okay, I think we’re saying the same thing, so I can mimic what TiDB is doing. I see that on table creation it ensures that the region that is supposed to host the data for that new table is split using
SplitRecordRegion. The question I have is could this region be merged with another region hosting another table at a later time ? For example if there are not a lot of inserts in that table will TiKV merge it with another region ? I would like to avoid it …