How does CDC work under the hood? Covers an example of what happens in the DB on different operations to allow CDC.
Down to the nitty-gritty just a small example of
what happens when you’re using this
Assuming that we have a very, very simple table
we create a table and we turn on CDC, in this case we have a primary key, we
have a clustering key, we have two values and we enabled CDC and we also add that
we want the pre-image
now we do two inserts
you can see we’re inserting two CQL rows
that share the same primary key, so we get two update records in the CDC
again there’s no pre-image because nothing existed previously, it’s just
two inserts
now we modify it, we update the table one of the CQL rows, then we get the
pre-image that only includes the value that we’re
changing so again we try to limit the change log
to make sure that it has as low impact as possible on
performance and you get the change
and to explain it we’re setting the value 3
and we don’t have a TTL, that’s what that tuple there means
if we do a delete, it’s sort of the same thing
we’re deleting one of the values, we’re not deleting the row, we’re setting a
value to NULL so we get a pre-image for the column
that’s affected and then we get a delete delta
for a row delete we get a pre-image and the values that exist and then we
get a delete record for the row of course
the delete record for a row doesn’t contain any deltas for the columns
because gone
whereas the partition delete we only get the delete of the partition, there’s no
pre-image here.