A CDC table stores records describing changes made to rows in a corresponding ScyllaDB source table. It records change history rather than the complete state of each row. section 12.1.2 section 12.3
Tracking an author change
After CDC is enabled on the authors table, inserting Charlie Change creates a CDC record containing his name and bio. Updating only his bio creates another record where name is null, because that statement did not change the name. Reconstructing the author requires ingesting both changes in order. section 12.1.2
Use CDC tables with these rules:
- Enable CDC per source table; ScyllaDB creates the corresponding CDC log table. section 12.1.2
- Query by CDC stream ID, which groups changes for a partition and provides ordering. section 12.1.2 section 12.3
- Account for multiple stream generations after cluster-topology changes such as adding a node. section 12.1.2 section 12.3
cqlsh:reviews> DESCRIBE reviews;
...
CREATE TABLE reviews.authors_scylla_cdc_log ( #1
"cdc$stream_id" blob,
"cdc$time" timeuuid,
"cdc$batch_seq_no" int,
bio text, #2
"cdc$deleted_bio" boolean, #3
"cdc$deleted_elements_image" frozen<set<smallint>>,
"cdc$deleted_image" boolean,
"cdc$deleted_name" boolean,
"cdc$end_of_batch" boolean,
"cdc$operation" tinyint,
"cdc$ttl" bigint,
id timeuuid,
image frozen<image>,
name text,
PRIMARY KEY ("cdc$stream_id", "cdc$time", "cdc$batch_seq_no") #4
) WITH CLUSTERING ORDER BY ("cdc$time" ASC, "cdc$batch_seq_no" ASC)
...
Inspect the generated CQL schema to see stream, time, batch, operation, deletion, TTL, and source-row columns. section 12.1.2
