TyrantLucifer commented on code in PR #3557:
URL:
https://github.com/apache/incubator-seatunnel/pull/3557#discussion_r1031152226
##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/sink/IoTDBSinkClient.java:
##########
@@ -144,30 +148,31 @@ synchronized void flush() throws IOException {
try {
if (batchRecords.getTypesList().isEmpty()) {
session.insertRecords(batchRecords.getDeviceIds(),
- batchRecords.getTimestamps(),
- batchRecords.getMeasurementsList(),
- batchRecords.getStringValuesList());
+ batchRecords.getTimestamps(),
+ batchRecords.getMeasurementsList(),
+ batchRecords.getStringValuesList());
} else {
session.insertRecords(batchRecords.getDeviceIds(),
- batchRecords.getTimestamps(),
- batchRecords.getMeasurementsList(),
- batchRecords.getTypesList(),
- batchRecords.getValuesList());
+ batchRecords.getTimestamps(),
+ batchRecords.getMeasurementsList(),
+ batchRecords.getTypesList(),
+ batchRecords.getValuesList());
}
} catch (IoTDBConnectionException | StatementExecutionException e)
{
log.error("Writing records to IoTDB failed, retry times = {}",
i, e);
if (i >= sinkConfig.getMaxRetries()) {
- throw new IOException("Writing records to IoTDB failed.",
e);
+ throw new
IotdbConnectorException(IotdbConnectorErrorCode.WRITING_RECORDS_FAILED,
+ "Writing records to IoTDB failed.", e);
}
try {
long backoff =
Math.min(sinkConfig.getRetryBackoffMultiplierMs() * i,
- sinkConfig.getMaxRetryBackoffMs());
+ sinkConfig.getMaxRetryBackoffMs());
Thread.sleep(backoff);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
- throw new IOException(
- "Unable to flush; interrupted while doing another
attempt.", e);
+ throw new
IotdbConnectorException(IotdbConnectorErrorCode.FLUSH_RECORDS_FAILED,
Review Comment:
CommonErrorCode.FLUSH_DATA_FAILED is better
##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/sink/IoTDBSinkClient.java:
##########
@@ -177,17 +182,18 @@ synchronized void flush() throws IOException {
private void checkFlushException() {
if (flushException != null) {
- throw new RuntimeException("Writing records to IoTDB failed.",
flushException);
+ throw new
IotdbConnectorException(IotdbConnectorErrorCode.WRITING_RECORDS_FAILED,
Review Comment:
CommonErrorCode.FLUSH_DATA_FAILED is better
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]