Hisoka-X commented on code in PR #7233:
URL: https://github.com/apache/seatunnel/pull/7233#discussion_r1684170539


##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceSplitEnumerator.java:
##########
@@ -194,19 +195,26 @@ public void addSplitsBack(List<KafkaSourceSplit> splits, 
int subtaskId) {
                                     .filter(Objects::nonNull)
                                     .collect(Collectors.toList()),
                             OffsetSpec.latest());
-            splits.forEach(
-                    split -> {
-                        split.setStartOffset(split.getEndOffset() + 1);
-                        
split.setEndOffset(listOffsets.get(split.getTopicPartition()));
-                    });
-            return splits.stream()
-                    
.collect(Collectors.toMap(KafkaSourceSplit::getTopicPartition, split -> split));
+            return resetOffset(splits, listOffsets);
         } catch (Exception e) {
             throw new KafkaConnectorException(
                     
KafkaConnectorErrorCode.ADD_SPLIT_BACK_TO_ENUMERATOR_FAILED, e);
         }
     }
 
+    @VisibleForTesting
+    protected static Map<TopicPartition, KafkaSourceSplit> resetOffset(
+            List<KafkaSourceSplit> splits, Map<TopicPartition, Long> 
listOffsets) {
+        splits.forEach(
+                split -> {
+                    split.setStartOffset(split.getEndOffset() + 1);
+                    
split.setEndOffset(listOffsets.get(split.getTopicPartition()));
+                    split.setRecover(true);

Review Comment:
   why not just remove current `split` from `assignedSplit` map? Then we can 
re-assgin it normally.



-- 
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-unsubscr...@seatunnel.apache.org

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

Reply via email to