[
https://issues.apache.org/jira/browse/KAFKA-14276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tomasz Kaszuba updated KAFKA-14276:
-----------------------------------
Description:
I've noticed that when calling
{code:java}
stateStore.approximateNumEntries(){code}
in the "init" method of a custom Transformer/Processor it returns the number of
events in the backup topic and not the actual final compacted number that you
would get if you iterated over the store. It fully makes sense since the backup
topic might not be fully compacted but is not intuitive and can cause confusion.
{code:java}
logger.info(s"Approximate size of store " +
stateStore.approximateNumEntries()){code}
{code:java}
Using.resource(stateStore.all) { iterator =>
var count = 0
while (iterator.hasNext) {
iterator.next()
count = count + 1
}
logger.info(s"Actual size of store " + count)
} {code}
Could we change the java doc to describe this behavior of the init method?
was:
I've noticed that when calling
{code:java}
stateStore.approximateNumEntries(){code}
in the "init" method of a custom Transformer/Processor it returns the number of
events in the backup topic and not the actual final compacted number that you
would get if you iterated over the store. It fully makes sense since the backup
topic might not be fully compacted but is not intuitive and can cause confusion.
{code:java}
logger.info(s"Approximate size of store " +
stateStore.approximateNumEntries()){code}
{code:java}
Using.resource(stateStore.all) { iterator =>
var count = 0
while (iterator.hasNext) {
iterator.next()
count = count + 1
}
logger.info(s"Actual size of store " + count)
} {code}
Could we change the java doc to describe this behavior of the init method?
> Clarify java doc for ProcessorAPI init method and
> stateStore.approximateNumEntries()
> ------------------------------------------------------------------------------------
>
> Key: KAFKA-14276
> URL: https://issues.apache.org/jira/browse/KAFKA-14276
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Reporter: Tomasz Kaszuba
> Priority: Minor
>
> I've noticed that when calling
> {code:java}
> stateStore.approximateNumEntries(){code}
> in the "init" method of a custom Transformer/Processor it returns the number
> of events in the backup topic and not the actual final compacted number that
> you would get if you iterated over the store. It fully makes sense since the
> backup topic might not be fully compacted but is not intuitive and can cause
> confusion.
> {code:java}
> logger.info(s"Approximate size of store " +
> stateStore.approximateNumEntries()){code}
> {code:java}
> Using.resource(stateStore.all) { iterator =>
> var count = 0
> while (iterator.hasNext) {
> iterator.next()
> count = count + 1
> }
> logger.info(s"Actual size of store " + count)
> } {code}
> Could we change the java doc to describe this behavior of the init method?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)