From 22edb4fac490c311c3932308c3fd707cec9d4651 Mon Sep 17 00:00:00 2001 From: Fantasy-Jay <13631435453@163.com> Date: Mon, 11 Nov 2024 10:46:10 +0800 Subject: [PATCH] Introduce compactionDropDeletedRecordCount metric. --- .../main/java/org/apache/paimon/compact/CompactTask.java | 9 +++++++-- .../org/apache/paimon/mergetree/DropDeleteReader.java | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/compact/CompactTask.java b/paimon-core/src/main/java/org/apache/paimon/compact/CompactTask.java index 9300f80927b4..54e0100a8d34 100644 --- a/paimon-core/src/main/java/org/apache/paimon/compact/CompactTask.java +++ b/paimon-core/src/main/java/org/apache/paimon/compact/CompactTask.java @@ -64,8 +64,7 @@ public CompactResult call() throws Exception { .map(DataFileMeta::fileSize) .reduce(Long::sum) .orElse(0L)); - metricsReporter.reportDropDeletedRecordCount( - result.getDropDeletedRecordCount()); + reportDropDeletedRecordCount(result.getDropDeletedRecordCount()); } }, LOG); @@ -80,6 +79,12 @@ public CompactResult call() throws Exception { } } + private void reportDropDeletedRecordCount(long dropDeletedRecordCount) { + if (metricsReporter != null) { + metricsReporter.reportDropDeletedRecordCount(dropDeletedRecordCount); + } + } + private void decreaseCompactionsQueuedCount() { if (metricsReporter != null) { metricsReporter.decreaseCompactionsQueuedCount(); diff --git a/paimon-core/src/main/java/org/apache/paimon/mergetree/DropDeleteReader.java b/paimon-core/src/main/java/org/apache/paimon/mergetree/DropDeleteReader.java index 4faf8d33074a..927094f19de4 100644 --- a/paimon-core/src/main/java/org/apache/paimon/mergetree/DropDeleteReader.java +++ b/paimon-core/src/main/java/org/apache/paimon/mergetree/DropDeleteReader.java @@ -32,7 +32,7 @@ */ public class DropDeleteReader implements RecordReader { - private long dropDeletedRecordCount = 0L; + private long dropDeleteRecordCount = 0L; private final RecordReader reader; public DropDeleteReader(RecordReader reader) { @@ -59,7 +59,7 @@ public KeyValue next() throws IOException { if (kv.isAdd()) { return kv; } - ++dropDeletedRecordCount; + ++dropDeleteRecordCount; } } @@ -72,7 +72,7 @@ public void releaseBatch() { @Override public long skippedRecordCount() { - return dropDeletedRecordCount; + return dropDeleteRecordCount; } @Override