kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KAFKA-5967) Ineffective check of negative value in CompositeReadOnlyKeyValueStore#approximateNumEntries()
Date Thu, 28 Sep 2017 23:44:00 GMT

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

ASF GitHub Bot commented on KAFKA-5967:
---------------------------------------

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 <ssanthalingam@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.

----


> 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
>              Labels: beginner, newbie
>
> {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)

Mime
View raw message