in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/impl/collector/TableShardCollector.java [188:224]
public synchronized boolean flush(boolean force, boolean async, AtomicInteger uncommittedActionCount) throws AdbClientException {
AdbClientWithDetailsException failedRecords = null;
boolean readableDone = false;
try {
if (async) {
readableDone = isActionDone();
} else {
readableDone = true;
waitActionDone();
}
} catch (AdbClientWithDetailsException e) {
readableDone = true;
failedRecords = e;
}
boolean done = false;
if (readableDone) {
if (buffer.size > 0) {
BatchState state = force ? BatchState.Force : buffer.getBatchState();
if (state != BatchState.NotEnough) {
commit(state);
}
} else {
done = true;
}
} else if (uncommittedActionCount != null) {
if (buffer.size > 0) {
uncommittedActionCount.incrementAndGet();
}
}
if (failedRecords != null) {
throw failedRecords;
}
return done;
}