Skip to content

Apache Cassandra target

TwinCommit writes to Apache Cassandra with batched, idempotent upserts. Each write uses the source commit timestamp as its Cassandra write timestamp. A replayed change can therefore never overwrite a newer one, and re-applying a batch leaves the data unchanged.

Supported: Apache Cassandra 4.0, 4.1 and 5.0 · DataStax Enterprise · DataStax Astra DB · Amazon Keyspaces.

target:
type: cassandra
contact_points: [cass-a.internal, cass-b.internal]
local_dc: dc1
keyspace: replica
user: twincommit
password: ${CASSANDRA_TARGET_PASSWORD}
consistency: LOCAL_QUORUM
  • Inserts and updates become INSERT ... USING TIMESTAMP <commit-µs>. Cassandra inserts are upserts.
  • Deletes become DELETE ... USING TIMESTAMP <commit-µs>.
  • Writes for one partition are grouped into unlogged batches. No lightweight transactions (LWT) are used.

Cassandra has no multi-partition transactions, so the checkpoint is stored in a small state table in the target keyspace. It is written only after the batch is acknowledged at the configured consistency level. After a crash TwinCommit may re-send the last batch, but because writes are timestamped and idempotent the end state is identical. This gives effectively-once results.

GRANT MODIFY ON KEYSPACE replica TO twincommit;
GRANT SELECT ON KEYSPACE replica TO twincommit;
GRANT CREATE ON KEYSPACE replica TO twincommit;