Key-Range Partitions

This post was originally published on this site

Martin Fowler

Often it can be difficult to know what the suitable split points are upfront.In these instances, we can implement auto-splitting.

Here, the coordinator will create only one partition with a key range which includes all the key space.

Each partition can be configured with a fixed maximum size. A background task then runs on each cluster node to track the size of the partitions. When a partition reaches its maximum size, it’s split into two partitions, each one being approximately half the size of the original.

Calculating partition size and Finding the middle key

Getting the size of the partition and finding the middle key is dependent on what storage engines are being used. A simple way of dong this can be to just scan through the entire partition to calculate its size. TiKV initially used this approach. To be able to split the tablet, the

To read the full article click on the 'post' link at the top.