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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7fa8bec911 Add metric to track number of segments missed in 
upsert-snapshot (#12581)
7fa8bec911 is described below

commit 7fa8bec911a92929824027b049f5cd805e9a2988
Author: Pratik Tibrewal <[email protected]>
AuthorDate: Sat Mar 9 00:16:01 2024 +0530

    Add metric to track number of segments missed in upsert-snapshot (#12581)
---
 .../src/main/java/org/apache/pinot/common/metrics/ServerMeter.java  | 1 +
 .../segment/local/upsert/BasePartitionUpsertMetadataManager.java    | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMeter.java 
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMeter.java
index 53d19b96c2..c516740070 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMeter.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMeter.java
@@ -52,6 +52,7 @@ public enum ServerMeter implements AbstractMetrics.Meter {
   UPSERT_OUT_OF_ORDER("rows", false),
   DELETED_KEYS_TTL_PRIMARY_KEYS_REMOVED("rows", false),
   METADATA_TTL_PRIMARY_KEYS_REMOVED("rows", false),
+  UPSERT_MISSED_VALID_DOC_ID_SNAPSHOT_COUNT("segments", false),
   ROWS_WITH_ERRORS("rows", false),
   LLC_CONTROLLER_RESPONSE_NOT_SENT("messages", true),
   LLC_CONTROLLER_RESPONSE_COMMIT("messages", true),
diff --git 
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
 
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
index dcee1cefa4..a97bb65922 100644
--- 
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
+++ 
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
@@ -887,6 +887,12 @@ public abstract class BasePartitionUpsertMetadataManager 
implements PartitionUps
         ServerGauge.UPSERT_VALID_DOC_ID_SNAPSHOT_COUNT, numImmutableSegments);
     _serverMetrics.setValueOfPartitionGauge(_tableNameWithType, _partitionId,
         ServerGauge.UPSERT_PRIMARY_KEYS_IN_SNAPSHOT_COUNT, 
numPrimaryKeysInSnapshot);
+    int numMissedSegments = numTrackedSegments - numImmutableSegments - 
numConsumingSegments;
+    if (numMissedSegments > 0) {
+      _serverMetrics.addMeteredTableValue(_tableNameWithType, 
String.valueOf(_partitionId),
+          ServerMeter.UPSERT_MISSED_VALID_DOC_ID_SNAPSHOT_COUNT, 
numMissedSegments);
+      _logger.warn("Missed taking snapshot for {} immutable segments", 
numMissedSegments);
+    }
     _logger.info("Finished taking snapshot for {} immutable segments with {} 
primary keys (out of {} total segments, "
             + "{} are consuming segments) in {} ms", numImmutableSegments, 
numPrimaryKeysInSnapshot, numTrackedSegments,
         numConsumingSegments, System.currentTimeMillis() - startTimeMs);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to