public synchronized long getNextSendingIndex() {
    // we do not use ReentrantReadWriteLock because there will be only one thread reading this field
    return 1
        + (pendingBatches.isEmpty()
            ? controller.getCurrentIndex()
            : pendingBatches.getLast().getEndIndex());
  }
Gets the first index that is not currently synchronized.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/SyncStatus.java