You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Tomasz Kaszuba (Jira)" <ji...@apache.org> on 2022/10/04 07:40:00 UTC

[jira] [Created] (KAFKA-14276) Clarify java doc for ProcessorAPI init method and stateStore.approximateNumEntries()

Tomasz Kaszuba created KAFKA-14276:
--------------------------------------

             Summary: 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


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)