chia7712 commented on code in PR #20060:
URL: https://github.com/apache/kafka/pull/20060#discussion_r2176169707


##########
streams/src/main/java/org/apache/kafka/streams/internals/metrics/OpenIterators.java:
##########
@@ -50,24 +48,22 @@ public OpenIterators(final TaskId taskId,
 
     public void add(final MeteredIterator iterator) {
         openIterators.add(iterator);
-        numOpenIterators.increment();
 
-        if (numOpenIterators.intValue() == 1) {
+        if (openIterators.size() == 1) {

Review Comment:
   Sorry for the unclear comment. Please see the following example
   
   ```java
           var openIterators = new OpenIterators();
           var iterator = new MeteredIterator(1000L);
           openIterators.add(iterator);
           openIterators.add(iterator);
   ```
   
   The second `openIterators.add(iterator)` did not invoke 
`StateStoreMetrics.addOldestOpenIteratorGauge` before, but it does now. 
However, this should be fine, since 
`StateStoreMetrics.addOldestOpenIteratorGauge` does not create new metrics in 
this scenario.



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