Data distribution across multiple nodes
A table in CockroachDB can be partitioned, and this is discussed in Chapter 4, Geo-Partitioning, where we talk about geo-partitioning. CockroachDB stores the data in a monolithic sorted key-value store (MSKVS). Key-space is all the data you have in a given cluster, including information about its location. Key-space is divided into contiguous batches, called ranges. The MSKVS makes it easy to access any data from any node, which makes it possible for any node in the cluster to act as a gateway node, coordinating one or more data nodes while serving client requests.
The MSKVS
The MSKVS contains two categories of data, as outlined here:
- System data, which contains meta ranges, where the data of each range can be found within the cluster.
- User data, which is the actual table data.
Meta ranges
The location of ranges is maintained in two-level indexes, known as meta ranges. The first level (a.k.a. meta1
) points to the...