MINOR: Refactor code for restoring tasks#5768
Conversation
|
Call for review @guozhangwang @bbejeck @vvcephei |
guozhangwang
left a comment
There was a problem hiding this comment.
I like this cleanup! Thanks for doing this.
This is orthogonal to the PR, but while reviewing this I found that today it seems we always try to restore a task even if the store is not loggingEabled, what will happen if loggingEnabled is false?
There was a problem hiding this comment.
Is this for testing only? If yes let's make it at the bottom of the class with comments.
There was a problem hiding this comment.
How about add the interface to RestoringTasks? And then in initializeNewTasks we can:
if (!entry.getValue().initializeStateStores()) {
log.debug("Transitioning {} {} to restoring", taskTypeName, entry.getKey());
((RestoringTasks) this).addToRestoring(entry.getValue());
} else {
transitionToRunning(entry.getValue());
}
We can also move updateRestored to that interface as well.
There was a problem hiding this comment.
I am not 100% sure about this.
The original motivation to add the method addToRestoring to AssignedTasks was to avoid the cast in initializeNewTasks -- it's fair request to get rid of this exception code and trade in a cast. Neither are nice solutions.
However, adding both methods to RestoringTasks does not improve the situation, as we still need the cast (we could also directly cast to AssignedStreamTasks instead) while we loose package private visibility and both methods are public if we add them to RestoringTasks.
Also RestoringTasks was added for a different purpose and adding more method would "drill a hole" into the API that we might not want. (The idea of RestoringTasks was to protect access to AssignedStreamsTask from StoreChangelogReader.)
Thoughts?
There was a problem hiding this comment.
I tend to agree with @mjsax regarding the change in that adding the methods to RestoringTasks we are still left with a cast.
But IMHO the trade-off is worth it when considering the interaction with the StoreChangelogReader as the StoreChangelogReader should not have exposure to AssignedStreamsTask methods, but only the methods related to restoring as presented in the RestoringTasks interface.
Either way, it's a trade-off, but again IMHO presenting the StoreChangelogReader with an interface limited to only restoring concerns makes the most sense to me.
Good question. I was looking into the code a little bit. It seems, this would not really be a problem. The task is added to (if all stores have loggingDisabled We only don't clean up |
|
Call for review @bbejeck @vvcephei Please consider and comment: #5768 (comment) |
86e6ae9 to
09fee8f
Compare
There was a problem hiding this comment.
Overall I don't have any further comments beyond what @guozhangwang has presented already. The cleanup looks good to me.
I've left my comments for #5768 (comment) in-line.
|
Can we run the EOS system tests as one last check before merging? |
|
retest this please |
+1 |
Thanks for looking into this! I think it's okay to leave it in |
|
LGTM. @mjsax please feel free to merge if the EOS system test passed as well. |
09fee8f to
6f0cef5
Compare
|
Remove the methods from |
|
Checkstyle failure: All tests passed. |
Did you run EOS system test to verify it passed? |
|
Fixed checkstyle error. Triggered system test: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/2085/ |
|
Some system tests failed because of unrelated bug. Filed #5928 to fix the system tests. Can rebase this PR after fix is merged. Build timed out. Will retrigger Jenkins after rebase. |
e7dfdbc to
94a941e
Compare
|
Rebased to pick up system test fixes from #5928. Triggered system tests again: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/2090/ |
7109bb4 to
93b7daf
Compare
|
Rebased to pick up system test fix. Re-triggered system tests: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/2097/ |
|
System test passed. Merging. |
Reviewers: Guozhang Wang <guozhang@confluent.io>, Bill Bejeck <bill@confluent.io>
Only StreamTasks can be restored. Thus, moving restoring logic into
AssignedStreamTasksclassCommitter Checklist (excluded from commit message)