KAFKA-16684: Remove cache in responseData#15966
KAFKA-16684: Remove cache in responseData#15966johnnychhsu wants to merge 4 commits intoapache:trunkfrom
Conversation
| responseDataTmp.put(new TopicPartition(name, partition.partitionIndex()), partition)); | ||
| } | ||
| }); | ||
| responseData = responseDataTmp; |
There was a problem hiding this comment.
This is what I do concern! The responseData could be different if the input gets changed.
There was a problem hiding this comment.
thanks for the review!
yes, the returned data should be calculated on the fly based on the input topic names
dfadc1a to
1291dd2
Compare
|
@johnnychhsu This is a bug fix, so please add test for it |
apoorvmittal10
left a comment
There was a problem hiding this comment.
LGTM! The only thing which I am not sure is that do we have any reason to cache the response for faster processing i.e. how frequently this method is called on same topicNames? If that call is too frequesnt with no change in topicNames then will it be worth to re-compute only if topicNames have changed?
The reason I say that is because the method call happens while fetching topicNames from session, which mostly will remain same.
that is a good point. Maybe the cache should be hosted by session instead of response data. the response data can be accessed by everyone, so it seems to me that is not a good choice to have cache. |
Sounds fair 👍 |
I file https://issues.apache.org/jira/browse/KAFKA-17065 to log it |
|
LGTM, I wll add test after this PR merge into trunk. |
the failed test is related to this PR. In the test case @m1a2st Could you copy the changes of this PR to another one, and please fix @johnnychhsu Sorry, I can't merge this PR as it causes the failed test. Please feel free to close this PR as @m1a2st will leverage this PR to complete it :) |
|
@chia7712, Thanks for your comments, I will open new PR for this issue. |
|
close this PR @m1a2st will file another one |
Context
The response data should change accordingly to the input, however with the current design, it will not change even if the input changes. We should remove this cache logic to avoid returning wrong data.
Jira: https://issues.apache.org/jira/browse/KAFKA-16684
Committer Checklist (excluded from commit message)