scylladb / scylladb/scylla-cdc-java
Always use prepared statements for replication
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 32
- Forks
- 23
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
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).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scylla-cdc-replicator/src/main/java/com/scylladb/cdc/replicator/ReplicatorConsumer.java at lines 71-83, then trace how CDC map updates are currently written. Use the issue's prepared-statement and batch example as the target; done means replication consistently uses prepared statements and binds the added, removed, and replaced values as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100