Skip to content

Commit 680026e

Browse files
XNX02SteveYurongSu
andauthored
Pipe: Prevent Duplicate Time Usage Reporting on Close in PipeTsFileToTabletsMetrics (#15220)
Co-authored-by: Steve Yurong Su <rong@apache.org>
1 parent 630a3d2 commit 680026e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/TsFileInsertionEventParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public abstract class TsFileInsertionEventParser implements AutoCloseable {
5353
protected final PipeInsertionEvent sourceEvent; // used to report progress
5454

5555
protected final long initialTimeNano = System.nanoTime();
56+
protected boolean timeUsageReported = false;
5657

5758
protected final PipeMemoryBlock allocatedMemoryBlockForTablet;
5859

@@ -95,10 +96,11 @@ protected TsFileInsertionEventParser(
9596
@Override
9697
public void close() {
9798
try {
98-
if (pipeName != null) {
99+
if (pipeName != null && !timeUsageReported) {
99100
PipeTsFileToTabletsMetrics.getInstance()
100101
.recordTsFileToTabletTime(
101102
pipeName + "_" + creationTime, System.nanoTime() - initialTimeNano);
103+
timeUsageReported = true;
102104
}
103105
} catch (final Exception e) {
104106
LOGGER.warn("Failed to report time usage for parsing tsfile for pipe {}", pipeName, e);

0 commit comments

Comments
 (0)