You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2017/09/25 03:34:00 UTC

[jira] [Created] (KAFKA-5967) Ineffective check of negative value in CompositeReadOnlyKeyValueStore#approximateNumEntries()

Ted Yu created KAFKA-5967:
-----------------------------

             Summary: Ineffective check of negative value in CompositeReadOnlyKeyValueStore#approximateNumEntries()
                 Key: KAFKA-5967
                 URL: https://issues.apache.org/jira/browse/KAFKA-5967
             Project: Kafka
          Issue Type: Bug
            Reporter: Ted Yu
            Priority: Minor


{code}
        long total = 0;
        for (ReadOnlyKeyValueStore<K, V> store : stores) {
            total += store.approximateNumEntries();
        }
        return total < 0 ? Long.MAX_VALUE : total;
{code}
The check for negative value seems to account for wrapping.

However, wrapping can happen within the for loop. So the check should be performed inside the loop.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)