mcvsubbu commented on code in PR #9994:
URL: https://github.com/apache/pinot/pull/9994#discussion_r1064229032
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeTableDataManager.java:
##########
@@ -212,6 +223,58 @@ protected void doShutdown() {
if (_leaseExtender != null) {
_leaseExtender.shutDown();
}
+ // Make sure we do metric cleanup when we shut down the table.
+ _ingestionDelayTracker.shutdown();
+ }
+
+ /*
+ * Method used by LLRealtimeSegmentManagers to update their partition delays
+ *
+ * @param ingestionDelayMs Ingestion delay being reported.
+ * @param currentTimeMs Timestamp of the measure being provided, i.e. when
this delay was computed.
+ * @param partitionGroupId Partition ID for which delay is being updated.
+ */
+ public void updateIngestionDelay(long ingestionDelayMs, long currenTimeMs,
int partitionGroupId) {
+ _ingestionDelayTracker.updateIngestionDelay(ingestionDelayMs,
currenTimeMs, partitionGroupId);
+ }
+
+ /*
+ * Method to handle CONSUMING -> DROPPED segment state transitions:
+ * We stop tracking partitions whose segments are dropped.
+ *
+ * @param segmentNameStr name of segment which is transitioning state.
+ */
+ @Override
+ public void onConsumingToDropped(String segmentNameStr) {
+ LLCSegmentName segmentName = new LLCSegmentName(segmentNameStr);
+
_ingestionDelayTracker.stopTrackingPartitionIngestionDelay(segmentName.getPartitionGroupId());
+ }
+
+ /*
+ * Method to handle CONSUMING -> ONLINE segment state transitions:
+ * We mark partitions for verification against ideal state when we do not
see a consuming segment for some time
+ * for that partition. The idea is to remove the related metrics when the
partition moves from the current server.
+ *
+ * @param segmentNameStr name of segment which is transitioning state.
+ */
+ @Override
+ public void onConsumingToOnline(String segmentNameStr) {
+ LLCSegmentName segmentName = new LLCSegmentName(segmentNameStr);
+
_ingestionDelayTracker.markPartitionForVerification(segmentName.getPartitionGroupId());
+ }
+
+ /**
+ * Returns all partitionGroupIds for the partitions hosted by this server
for current table.
+ * @Note: this involves Zookeeper read and should not be used frequently due
to efficiency concerns.
+ */
+ public List<Integer> getHostedPartitionsGroupIds() {
+ ArrayList<Integer> partitionsHostedByThisServer = new ArrayList<>();
+ List<String> segments =
TableStateUtils.getOnlineSegmentsForThisInstance(_helixManager,
_tableNameWithType);
Review Comment:
When the table is newly created, it will have only consuming segments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]