in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/impl/collector/TableShardCollector.java [92:124]
private void commit(BatchState state) throws AdbClientException {
LOGGER.debug("commit {} rows, {} bytes, state {} ", buffer.getRecords().size(), buffer.getByteSize(), state);
//System.out.println(String.format("commit %d rows, %d bytes, state %s ", buffer.getRecords().size(), buffer.getByteSize(), state));
activeAction = new PutAction(buffer.getRecords(), buffer.getByteSize(), buffer.getMode(), state);
try {
while (!pool.submit(activeAction)) {
}
activeActionByteSize = activeAction.getByteSize();
} catch (Exception e) {
activeAction.getFuture().completeExceptionally(e);
if (activeAction.getRecordList() != null) {
for (Record record : activeAction.getRecordList()) {
if (record.getPutFutures() != null) {
for (CompletableFuture<Void> future : record.getPutFutures()) {
if (!future.isDone()) {
future.completeExceptionally(e);
}
}
}
}
}
if (!(e instanceof AdbClientException)) {
throw new AdbClientException(ExceptionCode.INTERNAL_ERROR, "", e);
} else {
throw e;
}
} finally {
buffer.clear();
// currentTableSchema = tableSchema in buffer.
currentTableSchema = null;
}
}