gong commented on code in PR #5170:
URL: https://github.com/apache/inlong/pull/5170#discussion_r927265471


##########
inlong-sort/sort-connectors/hbase/src/main/java/org/apache/inlong/sort/hbase/sink/HBaseSinkFunction.java:
##########
@@ -233,39 +213,20 @@ public void invoke(T value, Context context) throws 
Exception {
         checkErrorAndRethrow();
 
         mutator.mutate(mutationConverter.convertToMutation(value));
-        rowSize++;
-        dataSize = dataSize + 
value.toString().getBytes(StandardCharsets.UTF_8).length;
+        if (metricData.getNumRecordsOut() != null) {
+            metricData.getNumRecordsOut().inc(1);
+        }
+        if (metricData.getNumRecordsOut() != null) {
+            metricData.getNumBytesOut()
+                .inc(value.toString().getBytes(StandardCharsets.UTF_8).length);
+        }
         // flush when the buffer number of mutations greater than the 
configured max size.
         if (bufferFlushMaxMutations > 0
                 && numPendingRequests.incrementAndGet() >= 
bufferFlushMaxMutations) {
-            try {
-                flush();
-                if (metricData.getNumRecordsOut() != null) {
-                    metricData.getNumRecordsOut().inc(rowSize);
-                }
-                if (metricData.getNumRecordsOut() != null) {
-                    metricData.getNumBytesOut()
-                            .inc(dataSize);
-                }
-                resetStateAfterFlush();
-            } catch (Exception e) {
-                if (metricData.getDirtyRecords() != null) {
-                    metricData.getDirtyRecords().inc(rowSize);
-                }
-                if (metricData.getDirtyBytes() != null) {
-                    metricData.getDirtyBytes().inc(dataSize);
-                }

Review Comment:
   lost write Fail records



-- 
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]

Reply via email to