Skip to content
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 @@ -49,8 +49,8 @@
import javax.annotation.Nullable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -247,7 +247,7 @@ public Iterator<SourceRecords> pollSplitRecords() throws InterruptedException {
boolean reachBinlogEnd = false;
SourceRecord lowWatermark = null;
SourceRecord highWatermark = null;
Map<Struct, SourceRecord> snapshotRecords = new HashMap<>();
Map<Struct, SourceRecord> snapshotRecords = new LinkedHashMap<>();
while (!reachBinlogEnd) {
checkReadException();
List<DataChangeEvent> batch = queue.poll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public List<MySqlSplit> snapshotState(long checkpointId) {

@Override
protected void onSplitFinished(Map<String, MySqlSplitState> finishedSplitIds) {
boolean requestNextSplit = true;
for (MySqlSplitState mySqlSplitState : finishedSplitIds.values()) {
MySqlSplit mySqlSplit = mySqlSplitState.toMySqlSplit();
if (mySqlSplit.isBinlogSplit()) {
Expand All @@ -154,12 +155,17 @@ protected void onSplitFinished(Map<String, MySqlSplitState> finishedSplitIds) {
mySqlSourceReaderContext.resetStopBinlogSplitReader();
suspendedBinlogSplit = toSuspendedBinlogSplit(mySqlSplit.asBinlogSplit());
context.sendSourceEventToCoordinator(new SuspendBinlogReaderAckEvent());
// do not request next split when the reader is suspended, the suspended reader will
// automatically request the next split after it has been wakeup
requestNextSplit = false;
} else {
finishedUnackedSplits.put(mySqlSplit.splitId(), mySqlSplit.asSnapshotSplit());
}
}
reportFinishedSnapshotSplitsIfNeed();
context.sendSplitRequest();
if (requestNextSplit) {
context.sendSplitRequest();
}
}

@Override
Expand Down