swuferhong commented on code in PR #2179:
URL: https://github.com/apache/fluss/pull/2179#discussion_r2778797005
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/source/reader/FlinkSourceReader.java:
##########
@@ -77,13 +88,53 @@ public FlinkSourceReader(
recordEmitter,
context.getConfiguration(),
context);
+ this.finishedKvSnapshotConsumeBuckets = new HashSet<>();
}
@Override
protected void onSplitFinished(Map<String, SourceSplitState> map) {
// do nothing
}
+ @Override
+ public List<SourceSplitBase> snapshotState(long checkpointId) {
+ Set<TableBucket> bucketsFinishedConsumeKvSnapshot = new HashSet<>();
+
+ // do not modify this state.
+ List<SourceSplitBase> sourceSplitBases =
super.snapshotState(checkpointId);
+ for (SourceSplitBase sourceSplitBase : sourceSplitBases) {
+ TableBucket tableBucket = sourceSplitBase.getTableBucket();
+ if (finishedKvSnapshotConsumeBuckets.contains(tableBucket)) {
+ continue;
+ }
+
+ if (sourceSplitBase.isHybridSnapshotLogSplit()) {
+ HybridSnapshotLogSplit hybridSnapshotLogSplit =
+ sourceSplitBase.asHybridSnapshotLogSplit();
+ if (hybridSnapshotLogSplit.isSnapshotFinished()) {
+ bucketsFinishedConsumeKvSnapshot.add(tableBucket);
+ }
+ }
+ }
+
+ // report finished kv snapshot consume event.
+ if (!bucketsFinishedConsumeKvSnapshot.isEmpty()) {
+ LOG.info(
+ "reader has finished kv snapshot read for bucket: {},
checkpoint id {}",
+ bucketsFinishedConsumeKvSnapshot,
+ checkpointId);
+
+ context.sendSourceEventToCoordinator(
Review Comment:
Link issue: https://github.com/apache/fluss/issues/2597
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]