mjsax commented on code in PR #16041:
URL: https://github.com/apache/kafka/pull/16041#discussion_r1613892705


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##########
@@ -169,6 +172,10 @@ private void registerMetrics() {
         iteratorDurationSensor = 
StateStoreMetrics.iteratorDurationSensor(taskId.toString(), metricsScope, 
name(), streamsMetrics);
         StateStoreMetrics.addNumOpenIteratorsGauge(taskId.toString(), 
metricsScope, name(), streamsMetrics,
                 (config, now) -> numOpenIterators.get());
+        StateStoreMetrics.addOldestOpenIteratorGauge(taskId.toString(), 
metricsScope, name(), streamsMetrics,
+                (config, now) -> openIterators.isEmpty() ? null :
+                    
openIterators.stream().mapToLong(MeteredIterator::startTimestamp).min().getAsLong()

Review Comment:
   > in particular for two Iterators with the same timestamp.
   
   Yes. We something that allows for duplicates... Not sure if there is any 
Java standard library impl... Some people implement a custom multi-set on top 
of tree-map: 
https://stackoverflow.com/questions/12565587/does-java-have-a-multiset-data-structure-like-the-one-in-c-stl
 (not sure if it better?) -- seems to be similar to what you propose with 
`ConcurrentSkipListSet`?
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to