liveBook · Manning

CDC table

As explained in ScyllaDB in Action

A CDC table is a ScyllaDB table that stores records describing changes made to rows in a corresponding source table.

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:

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

How ScyllaDB in Action covers it

How deep it goes
Explains enabling CDC, reading generated schemas, interpreting inserts and updates, and querying stream generations; it stops short of consumer implementation.
Examples
Demonstrates Charlie Change's insertion and bio update, generated CDC rows, null unchanged fields, and stream-generation queries.
What it assumes
Assumes familiarity with ScyllaDB tables, rows, partitions, inserts, updates, and CQL queries.
What you can do after
Operate/configure CDC on a table, inspect its log, interpret row changes, and query changes by stream ID.
How it connects
Connects change data capture with source tables, partitions, stream IDs, stream generations, topology changes, and data export.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.