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 <[email protected]>
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.
----
---