beryllw commented on code in PR #3856:
URL: https://github.com/apache/flink-cdc/pull/3856#discussion_r1964738198


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base/src/main/java/org/apache/flink/cdc/connectors/base/source/assigner/splitter/JdbcSourceChunkSplitter.java:
##########
@@ -470,7 +470,13 @@ private List<ChunkRange> splitEvenlySizedChunks(
             }
         }
         // add the ending split
-        splits.add(ChunkRange.of(chunkStart, null));
+        // assign ending split first, both the largest and smallest unbounded 
chunks are completed
+        // in the first two splits
+        if (sourceConfig.isAssignEndingChunkFirst()) {
+            splits.add(0, ChunkRange.of(chunkStart, null));

Review Comment:
   Considering the use of `System.arraycopy` for performance, I noticed that 
the `ArrayList` function `add(int index, E element)` is implemented as follows 
and already uses `System.arraycopy` internally. Is there anything else I need 
to change?
   
   ```java
   /**
    * Inserts the specified element at the specified position in this
    * list. Shifts the element currently at that position (if any) and
    * any subsequent elements to the right (adds one to their indices).
    *
    * @param index index at which the specified element is to be inserted
    * @param element element to be inserted
    * @throws IndexOutOfBoundsException {@inheritDoc}
    */
   public void add(int index, E element) {
       rangeCheckForAdd(index);
   
       ensureCapacityInternal(size + 1);  // Increments modCount!!
       System.arraycopy(elementData, index, elementData, index + 1,
                        size - index);
       elementData[index] = element;
       size++;
   }
   ```



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

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

Reply via email to