Skip to content

Commit 1a3a3ff

Browse files
authored
[To dev/1.3] Pipe: Exclude the tsFiles / insertNodes from transfer time metric which have not be sent (#16015) (#16016)
1 parent cb2da10 commit 1a3a3ff

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeInsertNodeTabletInsertionEvent.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ public boolean internallyDecreaseResourceReferenceCount(final String holderMessa
154154
PipeDataNodeAgent.task()
155155
.decreaseFloatingMemoryUsageInByte(pipeName, creationTime, ramBytesUsed());
156156
PipeDataNodeSinglePipeMetrics.getInstance()
157-
.decreaseInsertNodeEventCount(pipeName, creationTime, System.nanoTime() - extractTime);
157+
.decreaseInsertNodeEventCount(
158+
pipeName,
159+
creationTime,
160+
shouldReportOnCommit ? System.nanoTime() - extractTime : -1);
158161
}
159162
insertNode = null;
160163
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ public boolean internallyDecreaseResourceReferenceCount(final String holderMessa
286286
} finally {
287287
if (Objects.nonNull(pipeName)) {
288288
PipeDataNodeSinglePipeMetrics.getInstance()
289-
.decreaseTsFileEventCount(pipeName, creationTime, System.nanoTime() - extractTime);
289+
.decreaseTsFileEventCount(
290+
pipeName,
291+
creationTime,
292+
shouldReportOnCommit ? System.nanoTime() - extractTime : -1);
290293
}
291294
}
292295
}

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeSinglePipeMetrics.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ public void decreaseInsertNodeEventCount(
269269
k -> new PipeDataNodeRemainingEventAndTimeOperator(pipeName, creationTime));
270270
operator.decreaseInsertNodeEventCount();
271271

272-
operator.getInsertNodeTransferTimer().update(transferTime, TimeUnit.NANOSECONDS);
273-
PIPE_DATANODE_INSERTNODE_TRANSFER_TIME_HISTOGRAM.update(transferTime);
272+
if (transferTime > 0) {
273+
operator.getInsertNodeTransferTimer().update(transferTime, TimeUnit.NANOSECONDS);
274+
PIPE_DATANODE_INSERTNODE_TRANSFER_TIME_HISTOGRAM.update(transferTime);
275+
}
274276
}
275277

276278
public void increaseRawTabletEventCount(final String pipeName, final long creationTime) {
@@ -305,8 +307,10 @@ public void decreaseTsFileEventCount(
305307
k -> new PipeDataNodeRemainingEventAndTimeOperator(pipeName, creationTime));
306308

307309
operator.decreaseTsFileEventCount();
308-
operator.getTsFileTransferTimer().update(transferTime, TimeUnit.NANOSECONDS);
309-
PIPE_DATANODE_TSFILE_TRANSFER_TIME_HISTOGRAM.update(transferTime);
310+
if (transferTime > 0) {
311+
operator.getTsFileTransferTimer().update(transferTime, TimeUnit.NANOSECONDS);
312+
PIPE_DATANODE_TSFILE_TRANSFER_TIME_HISTOGRAM.update(transferTime);
313+
}
310314
}
311315

312316
public void increaseHeartbeatEventCount(final String pipeName, final long creationTime) {

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/event/EnrichedEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ public synchronized boolean decreaseReferenceCount(
182182
}
183183

184184
if (referenceCount.get() == 1) {
185+
if (!shouldReport) {
186+
shouldReportOnCommit = false;
187+
}
185188
// We assume that this function will not throw any exceptions.
186189
if (!internallyDecreaseResourceReferenceCount(holderMessage)) {
187190
LOGGER.warn(
188191
"resource reference count is decreased to 0, but failed to release the resource, EnrichedEvent: {}, stack trace: {}",
189192
coreReportMessage(),
190193
Thread.currentThread().getStackTrace());
191194
}
192-
if (!shouldReport) {
193-
shouldReportOnCommit = false;
194-
}
195195
PipeEventCommitManager.getInstance().commit(this, committerKey);
196196
}
197197

0 commit comments

Comments
 (0)