capistrant commented on code in PR #18844:
URL: https://github.com/apache/druid/pull/18844#discussion_r2692077393


##########
server/src/main/java/org/apache/druid/metadata/segment/cache/HeapMemorySegmentMetadataCache.java:
##########
@@ -1106,6 +1122,89 @@ private void emitMetric(String datasource, String 
metric, long value)
     );
   }
 
+  /**
+   * Retrieves required used compaction states from the metadata store and 
resets
+   * them in the {@link IndexingStateCache}. If this is the first sync, all 
used
+   * compaction states are retrieved from the metadata store. If this is a 
delta sync,
+   * first only the fingerprints of all used compaction states are retrieved. 
Payloads are
+   * then fetched for only the fingerprints which are not present in the cache.
+   */
+  private void retrieveAndResetUsedCompactionStates()
+  {
+    final Stopwatch compactionStateSyncDuration = Stopwatch.createStarted();
+
+    // Reset the IndexingStateCache with latest compaction states
+    final Map<String, CompactionState> fingerprintToStateMap;
+    if (syncFinishTime.get() == null) {
+      fingerprintToStateMap = buildFingerprintToStateMapForFullSync();
+    } else {
+      fingerprintToStateMap = buildFingerprintToStateMapForDeltaSync();
+    }
+
+    
indexingStateCache.resetIndexingStatesForPublishedSegments(fingerprintToStateMap);
+
+    // Emit metrics for the current contents of the cache
+    indexingStateCache.getAndResetStats().forEach(this::emitMetric);
+    emitMetric(Metric.RETRIEVE_COMPACTION_STATES_DURATION_MILLIS, 
compactionStateSyncDuration.millisElapsed());
+  }
+
+  /**
+   * Retrieves all used compaction states from the metadata store and builds a

Review Comment:
   indexing states



-- 
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]

Reply via email to