scylladb / scylladb/scylla-cdc-java

Wrong matching of delta and postimage rows in batches in POST_IMAGE mode

Open
#7 0 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

replicator
Dominant language
Java
Stars
32
Forks
23
Avg merge
2d 6h
Merged PRs (30d)
3

Description

The POST_IMAGE mode of replicator when it encounters a INSERT or UPDATE CDC log row, it "suspends" replication of such row, instead waiting for POST_IMAGE row. When it finds a matching POST_IMAGE row it performs the insert/update with the data in POST_IMAGE row.

However, matching the delta row and postimage row is not done correctly for batches (of more than 1 operation). The matching is done by remembering the last operation type (its handler) for a stream id. But if there was a batch:

INSERT
UPDATE
POST_IMAGE
POST_IMAGE

then the first POST_IMAGE will match to the UPDATE, not the INSERT. The state should probably remember a queue of operation handlers, not only the last one:

https://github.com/scylladb/scylla-cdc-java/blob/avelanarius-changes/scylla-cdc-replicator/src/main/java/com/scylladb/cdc/replicator/operations/postimage/PostImageState.java

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.