Guozhang Wang created KAFKA-1616: ------------------------------------ Summary: Purgatory Size and Num.Delayed.Request metrics are incorrect Key: KAFKA-1616 URL: https://issues.apache.org/jira/browse/KAFKA-1616 Project: Kafka Issue Type: Bug Reporter: Guozhang Wang Assignee: Guozhang Wang Fix For: 0.9.0
The request purgatory used two atomic integers "watched" and "unsatisfied" to record the purgatory size ( = watched + unsatisfied) and number of delayed requests ( = unsatisfied). But due to some race conditions these two atomic integers are not updated correctly, result in incorrect metrics. Proposed solution: to have a cleaner semantics, we can define the "purgatory size" to be just the number of elements in the watched lists, and the "number of delayed requests" to be just the length of the expiry queue. And instead of using two atomic integeres we just compute the size of the lists / queue on the fly each time the metrics are pulled. This may use some more CPU cycles for these two metrics but should be minor, and the correctness is guaranteed. -- This message was sent by Atlassian JIRA (v6.2#6252)