Skip to content

Commit

Permalink
fix loss data as described in DBZ-7915 issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
lamhv committed Jun 2, 2024
1 parent deda87c commit 9049971
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
PubsubMessage message = buildPubSubMessage(record);

deliveries.add(publisher.publish(message));

committer.markProcessed(record);
}
List<String> messageIds;
try {
Expand All @@ -247,7 +245,14 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
throw new DebeziumException(e);
}
LOGGER.trace("Sent messages with ids: {}", messageIds);

LOGGER.trace("Marking {} records as processed.", records.size());
for (ChangeEvent<Object, Object> record : records) {
committer.markProcessed(record);
}

committer.markBatchFinished();
LOGGER.trace("Batch marked finished");
}

private PubsubMessage buildPubSubMessage(ChangeEvent<Object, Object> record) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
PubsubMessage message = buildPubSubMessage(record);

deliveries.add(publisher.publish(message));
committer.markProcessed(record);
}
List<String> messageIds;
try {
Expand All @@ -142,7 +141,14 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
throw new DebeziumException(e);
}
LOGGER.trace("Sent messages with ids: {}", messageIds);

LOGGER.trace("Marking {} records as processed.", records.size());
for (ChangeEvent<Object, Object> record : records) {
committer.markProcessed(record);
}

committer.markBatchFinished();
LOGGER.trace("Batch marked finished");
}

private PubsubMessage buildPubSubMessage(ChangeEvent<Object, Object> record) {
Expand Down

0 comments on commit 9049971

Please sign in to comment.