You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/09/24 10:39:40 UTC

[GitHub] [incubator-seatunnel] ashulin commented on a diff in pull request #2865: [Imporve][Connector-V2] Imporve iceberg source connector

ashulin commented on code in PR #2865:
URL: https://github.com/apache/incubator-seatunnel/pull/2865#discussion_r979221173


##########
seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/source/enumerator/IcebergBatchSplitEnumerator.java:
##########
@@ -43,29 +45,39 @@ public IcebergBatchSplitEnumerator(@NonNull SourceSplitEnumerator.Context<Iceber
         super(context, sourceConfig, restoreState != null ?
             restoreState.getPendingSplits() : Collections.EMPTY_MAP);
         this.icebergScanContext = icebergScanContext;
+        // split enumeration is not needed during restore scenario
+        this.shouldEnumerate = restoreState == null;
     }
 
     @Override
-    public void run() {
-        super.run();
-
+    public synchronized void run() {
         Set<Integer> readers = context.registeredReaders();
-        log.debug("No more splits to assign." +
-            " Sending NoMoreSplitsEvent to reader {}.", readers);
+        if (shouldEnumerate) {
+            loadAllSplitsToPendingSplits(icebergTableLoader.loadTable());
+            assignPendingSplits(readers);
+        }
+
+        log.debug("No more splits to assign. Sending NoMoreSplitsEvent to readers {}.", readers);
         readers.forEach(context::signalNoMoreSplits);

Review Comment:
   Please judge whether to `context#signalNoMoreSplits` in `AbstractSplitEnumerator#assignPendingSplits`



-- 
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: commits-unsubscribe@seatunnel.apache.org

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