dima5rr commented on pull request #9020:
URL: https://github.com/apache/kafka/pull/9020#issuecomment-658859876


   > Hi @dima5rr , thanks for the PR! I was looking into the context of this 
ticket and noticed that we're essentially just duplicating here the logic in 
`org.apache.kafka.streams.state.internals.QueryableStoreProvider#getStore`, 
which also loops over all stores of all providers as a sanity check before even 
returning the WrappingStoreProvider, which will loop over all stores of all 
providers _again_ before returning any results.
   > 
   > Anecdotally, I think that most people would actually just query 
immediately and then discard their store reference, for example like `value = 
kafkaStreams.store("storeName", partition=2).get("key")`. In that case, this 
double-iteration is pretty expensive, and the up-front sanity check doesn't 
seem to provide any value.
   > 
   > In fact, the only value it could provide is if you _do_ plan to save the 
store reference and re-use it for multiple queries. But in that case, there 
could be a rebalance at any time, so checking up front probably doesn't help 
much no matter what the use case is.
   > 
   > What do you think about removing the loop
   > 
   > 
https://github.com/apache/kafka/blob/f699bd98c14e31f07c5a3f6ba9ce2c4b441e7fdb/streams/src/main/java/org/apache/kafka/streams/state/internals/QueryableStoreProvider.java#L59-L77
   > 
   > in favor of the one in here?
   > Of course, the short-circuit you're providing here is valuable in any case.
   > 
   > Thanks!
   > -John
   
   Agree, it can be removed


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to