You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "herunkang2018 (via GitHub)" <gi...@apache.org> on 2024/12/01 00:49:46 UTC

Re: [PR] [FLINK-36682][mysql][mongodb] Add scan.chunk.assign.strategy to avoid OOM exception. [flink-cdc]

herunkang2018 commented on code in PR #3704:
URL: https://github.com/apache/flink-cdc/pull/3704#discussion_r1864686042


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/main/java/org/apache/flink/cdc/connectors/mongodb/source/assigners/splitters/MongoDBChunkSplitter.java:
##########
@@ -38,10 +40,15 @@ public MongoDBChunkSplitter(MongoDBSourceConfig sourceConfig) {
 
     @Override
     public Collection<SnapshotSplit> generateSplits(TableId collectionId) {
+        ArrayList<SnapshotSplit> snapshotSplits = new ArrayList<>();
         SplitContext splitContext = SplitContext.of(sourceConfig, collectionId);
         if (splitContext.isShardedCollection()) {
-            return ShardedSplitStrategy.INSTANCE.split(splitContext);
+            snapshotSplits.addAll(ShardedSplitStrategy.INSTANCE.split(splitContext));
         }
-        return SplitVectorSplitStrategy.INSTANCE.split(splitContext);
+        snapshotSplits.addAll(SplitVectorSplitStrategy.INSTANCE.split(splitContext));

Review Comment:
   Seems it will split repeatly here.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org