Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix][CDC Base] Solving the ConcurrentModificationException caused… #4877

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public void handleSourceEvent(int subtaskId, SourceEvent sourceEvent) {
(CompletedSnapshotSplitsReportEvent) sourceEvent;
List<SnapshotSplitWatermark> completedSplitWatermarks =
reportEvent.getCompletedSnapshotSplitWatermarks();
splitAssigner.onCompletedSplits(completedSplitWatermarks);
synchronized (context) {
splitAssigner.onCompletedSplits(completedSplitWatermarks);
}

// send acknowledge event
CompletedSnapshotSplitsAckEvent ackEvent =
Expand Down Expand Up @@ -153,7 +155,10 @@ private void assignSplits() {
continue;
}

Optional<SourceSplitBase> split = splitAssigner.getNext();
Optional<SourceSplitBase> split;
synchronized (context) {
split = splitAssigner.getNext();
}
if (split.isPresent()) {
final SourceSplitBase sourceSplit = split.get();
context.assignSplit(nextAwaiting, sourceSplit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public Lsn getCommitLsn() {
return Lsn.valueOf(offset.get(SourceInfo.COMMIT_LSN_KEY));
}

public Long getEventSerialNo() {
return Long.valueOf(offset.get(SourceInfo.EVENT_SERIAL_NO_KEY));
public Object getEventSerialNo() {
return offset.get(SourceInfo.EVENT_SERIAL_NO_KEY);
}

public int compareTo(Offset o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void triggerBarrier(Barrier barrier) throws Exception {
final long barrierId = barrier.getId();
Serializable snapshotState = null;
byte[] serialize = null;
// Do not modify this lock object, as it is also used in the SourceSplitEnumerator.
synchronized (enumeratorContext) {
if (barrier.snapshot()) {
snapshotState = enumerator.snapshotState(barrierId);
Expand Down