Documentation — Concepts

Replication

A table can be stored in one, two or three copies, called replicates. You decide before the deployment:

alter table orders set replicates 2;

The default is one copy. You cannot change it once the table is deployed.

How the copies are written

A row is written to every copy of its partition. If a write fails on one copy while it works on another, the failed segment is marked out of date and the row is kept on the others. The statement succeeds; the answer reports the problem.

How the copies are read

A select reads a partition from a sane segment only, because an out-of-date segment may miss rows. If the data broker that serves a copy fails, SynSQL tries the next copy of the partition. With one copy, a data broker that stops makes its partitions unavailable, and statements on the table are refused with One partition of this table is unavailable.

Where the copies live

When a table has two or three copies, SynSQL puts each copy in a different rack of the datacenter (see Datacenters and racks). The rack with the most data brokers receives the first copy.

Getting back to a sane state

  • Several copies: repair table T;. Lock the table first. SynSQL exports the data from a sane segment of the same partition and imports it into the out-of-date one.
  • One copy: the data cannot be rebuilt. If you recovered the data broker with its data, alter table T set segments up; declares its segments sane again.

Choosing

One copy is the cheapest and fastest. Choose two or three if the table must stay available when a data broker or a rack fails. Note that every copy costs the same disk space.

← Partitioning  |  Datacenters & racks →