KAFKA-20603 : Replace MemoryLRUCache restoring flag with restore lifecycle hooks#22366
KAFKA-20603 : Replace MemoryLRUCache restoring flag with restore lifecycle hooks#22366muralibasani wants to merge 2 commits into
Conversation
|
Thanks for the PR. |
| // visible for testing | ||
| RecordBatchingStateRestoreCallback restoreCallback() { | ||
| return restoreCallback; | ||
| } |
There was a problem hiding this comment.
imo this is anti pattern, and we shouldn't test so low level functions. "Test behavior, not implementation"
@UladzislauBlok thanks for the review. is actually addressed by a simple try finally inside MemoryLRUCache, then the flag becomes exception safe and it is not sub-optimal anymore imo. But currently only MemoryLRUCache reads this flag, so the new design proposed does not justify it. If we have another consumer/store needs this flag, design gets justified. For now, if we want to keep it simple, we can revert this design choice and introduce a try/finally here Let me know. |
Ref : https://issues.apache.org/jira/browse/KAFKA-20603
Only refactoring.
Replace MemoryLRUCache
restoringflag withonRestoreStart/onRestoreEndlifecycle hooks on internalRecordBatchingStateRestoreCallback