You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/11/22 06:20:30 UTC

[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #6577: [INLONG-6574][Sort] Add dirty data metric for HBase

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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org