[ 
https://issues.apache.org/jira/browse/KAFKA-20902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18103582#comment-18103582
 ] 

Suman Pal commented on KAFKA-20902:
-----------------------------------

Hi [~jess], I’ve locally reproduced this issue using UT and am working on a fix 
(total comparator with a per-iterator sequence id, as suggested in the ticket). 
Assigning this to myself, will open a PR soon for review.

> Streams metered stores: oldest-iterator-open-since-ms can be wrong when two 
> iterators open in the same millisecond
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-20902
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20902
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Jess Jin
>            Priority: Minor
>
> {{openIterators}} is a {{ConcurrentSkipListSet}} keyed only by 
> {{startTimestamp()}} (ms resolution). Two iterators opened in the same 
> millisecond compare equal, so the second {{add()}} is a silent no-op and a 
> {{remove()}} on close can evict the still-open one — the 
> {{oldest-iterator-open-since-ms}} gauge then under-reports (may skip a 
> still-open iterator or return 0). {{num-open-iterators}} is unaffected 
> (separate {{LongAdder}}); iterators still close correctly, so it's a 
> metric-accuracy issue, not a leak. Affects all metered store wrappers. *Fix:* 
> make the comparator total (tie-break on a per-iterator sequence id). Found in 
> PR [#22975|https://github.com/apache/kafka/pull/22975] review 
> [{{r3730260330}}|https://github.com/apache/kafka/pull/22975#discussion_r3730260330].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to