yunqingmoswu commented on code in PR #6577:
URL: https://github.com/apache/inlong/pull/6577#discussion_r1028902104
##########
inlong-sort/sort-connectors/hbase/src/main/java/org/apache/inlong/sort/hbase/sink/HBaseSinkFunction.java:
##########
@@ -225,34 +216,48 @@ private org.apache.hadoop.conf.Configuration
prepareRuntimeConfiguration() throw
private void checkErrorAndRethrow() {
Throwable cause = failureThrowable.get();
if (cause != null) {
- throw new RuntimeException("An error occurred in HBaseSink.",
cause);
+ LOG.error("An error occurred in HBaseSink.", cause);
+ failureThrowable.compareAndSet(cause, null);
}
}
@SuppressWarnings("rawtypes")
@Override
- public void invoke(T value, Context context) throws Exception {
+ public void invoke(T value, Context context) {
checkErrorAndRethrow();
+ try {
+ mutator.mutate(mutationConverter.convertToMutation(value));
+ rowSize++;
+ dataSize = dataSize +
value.toString().getBytes(StandardCharsets.UTF_8).length;
+ } catch (Exception e) {
+ if (sinkMetricData != null) {
+ sinkMetricData.invokeDirty(1,
value.toString().getBytes(StandardCharsets.UTF_8).length);
Review Comment:
It is necessary to decide whether to throw an exception based on whether
dirty data is tolerated.
--
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]