You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can always use prepared statements. Sometimes we may need to use a batch statement, but still.
Example prepared statement that can handle any non-frozen map update:
begin unlogged batch
update ks.t set v = v + :added, v = v - :removed where pk = :pk and ck = :ck;
update ks.t set v = :replaced where pk = :pk and ck = :ck;
apply batch
bind the markers as needed: :added from the CDC v column, :removed from cdc$deleted_elements_v, :replaced from cdc$deleted_v (bind null if it got deleted, leave unset otherwise).
The text was updated successfully, but these errors were encountered:
In general, I think that a batch of 2 can solve every case:
for cdc$operation = 1 (update):
one update for adding and removing elements from non-frozen collections and setting non-frozen UDT fields; also ensure to use scylla_timeuuid_list_index for non-frozen lists, ALWAYS!
one update for everything else: setting other fields, and setting non-frozen collections to null if cdc$deleted_X is True
for cdc$operation = 2 (insert):
one update for setting non-frozen list elements using scylla_timeuuid_list_index
one insert for everything else: creating the row marker, replacing non-frozen collections (including lists: we then combine setting to null with the above update to obtain the new list), replacing all other types of fields
scylla-cdc-java/scylla-cdc-replicator/src/main/java/com/scylladb/cdc/replicator/ReplicatorConsumer.java
Lines 71 to 83 in 2426500
We can always use prepared statements. Sometimes we may need to use a batch statement, but still.
Example prepared statement that can handle any non-frozen map update:
bind the markers as needed:
:added
from the CDCv
column,:removed
fromcdc$deleted_elements_v
,:replaced
fromcdc$deleted_v
(bindnull
if it got deleted, leave unset otherwise).The text was updated successfully, but these errors were encountered: