You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by shivsantham <gi...@git.apache.org> on 2017/09/28 23:43:52 UTC

[GitHub] kafka pull request #3988: KAFKA-5967 Ineffective check of negative value in ...

GitHub user shivsantham opened a pull request:

    https://github.com/apache/kafka/pull/3988

    KAFKA-5967 Ineffective check of negative value in CompositeReadOnlyKe…

    package name: org.apache.kafka.streams.state.internals
    Minor change to approximateNumEntries() method in CompositeReadOnlyKeyValueStore class.
    
    long total = 0;
       for (ReadOnlyKeyValueStore<K, V> store : stores) {
              total += store.approximateNumEntries();
       }
    
    return total < 0 ? Long.MAX_VALUE : total;
    
    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.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shivsantham/kafka trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/3988.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3988
    
----
commit ff377759a943c7bfb89a56ad721e7ba1b3b0b24c
Author: siva santhalingam <ss...@netskope.com>
Date:   2017-09-28T23:37:47Z

    KAFKA-5967 Ineffective check of negative value in CompositeReadOnlyKeyValueStore#approximateNumEntries()
    
    long total = 0;
       for (ReadOnlyKeyValueStore<K, V> store : stores) {
              total += store.approximateNumEntries();
       }
    
    return total < 0 ? Long.MAX_VALUE : total;
    
    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.

----


---

[GitHub] kafka pull request #3988: KAFKA-5967 Ineffective check of negative value in ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/kafka/pull/3988


---