CDC - All columns in delete operations

Hey guys,

We are using CDC on some scylladb tables to capture the operations that take place.
A doubt arose regarding the log of delete operations, is it possible to configure so that delete operations fill all columns with data from before deletion? Currently only primary key columns are populated with information in the CDC log table

The docs says that you can configure CDC to receive the previous values like: CREATE TABLE ks.t (pk int, ck int, v1 int, v2 map<int, int>, PRIMARY KEY (pk, ck)) WITH cdc = {‘enabled’: true, ‘preimage’: ‘full’};

However: "Preimage rows are only created for rows modified using inserts, updates, or row deletes. They are not created for range deletes or partition deletes. "

More info here:

Hi Marcus,

as Dor said - you can try enabling preimages, which will show you the state of the row from before the deletion (but preimages don’t appear for range/partition deletions).

Note however that preimages/postimages have downsides which you should consider before enabling them:

  • they incur additional performance penalty, as they require a read-before-write and they appear as an additional row in the CDC log table in addition to the “delta” row,
  • they don’t work well with concurrent writes to the same row as described in this section: Preimages and postimages | ScyllaDB Docs

If you use only delta rows (which appear when you enable CDC without any additional options such as ‘preimage’), you won’t get previous data; you’ll only get the applied difference (“delta”) which, in case of deletions, is described by the primary key and cdc$operation column with the appropriate value.

1 Like

Thank you @Dor_Laor and @kbr !!

Now it’s working!! :pray:t2:

1 Like