Photo by The Creative Exchange on Unsplash

3 Ways Cassandra Keeps Data in Sync

Marika Lam

--

There are 3 mechanisms for making sure that your data stays in sync and consistent.

  1. Read Repair
  2. Hinted Handoff
  3. Anti-Entropy Repair

Read Repair

Read Repairs compare values and updates (repairs) any out of sync. Read Repairs happen when a read is done — the coordinator node then compares the data from all the remaining replicas that own the row in the background and if they are inconsistent, issues writes to the out-of-date replicas to update the row with the most recently written values.

Read Repairs can be configured per column family and is enabled by default.

There are 2 types of read repair, foreground and background. Foreground means blocking. We complete all operations before returning to the client. Background means non-blocking. We begin the background repair operation and then return to the client before it has been completed.

Foreground (Blocking) Read Repair

Foreground read repair is always performed on queries which use a consistency level greater than ONE or LOCAL_ONE.

The coordinator asks one replica for data and the others for digests of their data. If there’s a mismatch, we resolve it by doing a data read from all replicas and then…

--

--