This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 680026eefea Pipe: Prevent Duplicate Time Usage Reporting on Close in 
PipeTsFileToTabletsMetrics (#15220)
680026eefea is described below

commit 680026eefea9fa934c4e6c5dcd085b24730c9ed4
Author: nanxiang xia <[email protected]>
AuthorDate: Fri Mar 28 16:57:06 2025 +0800

    Pipe: Prevent Duplicate Time Usage Reporting on Close in 
PipeTsFileToTabletsMetrics (#15220)
    
    Co-authored-by: Steve Yurong Su <[email protected]>
---
 .../pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java
index 4d38e196e27..57616533b80 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java
@@ -53,6 +53,7 @@ public abstract class TsFileInsertionEventParser implements 
AutoCloseable {
   protected final PipeInsertionEvent sourceEvent; // used to report progress
 
   protected final long initialTimeNano = System.nanoTime();
+  protected boolean timeUsageReported = false;
 
   protected final PipeMemoryBlock allocatedMemoryBlockForTablet;
 
@@ -95,10 +96,11 @@ public abstract class TsFileInsertionEventParser implements 
AutoCloseable {
   @Override
   public void close() {
     try {
-      if (pipeName != null) {
+      if (pipeName != null && !timeUsageReported) {
         PipeTsFileToTabletsMetrics.getInstance()
             .recordTsFileToTabletTime(
                 pipeName + "_" + creationTime, System.nanoTime() - 
initialTimeNano);
+        timeUsageReported = true;
       }
     } catch (final Exception e) {
       LOGGER.warn("Failed to report time usage for parsing tsfile for pipe 
{}", pipeName, e);

Reply via email to