-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-5019] Proper isRestored result for tasks that did not write state #2746
Conversation
8e12dd7
to
db3760d
Compare
assertEquals(errMsg, subtaskState.getLegacyOperatorState(), | ||
tdd.getTaskStateHandles().getLegacyOperatorState()); | ||
|
||
if (subtaskState.hasState()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check can actually be replaced by subtaskState.getLegacyOperatorState()
and if you do that there is no place in the code that calls SubtaskState.hasState()
, making it obsolete.
Please correct me if I'm wrong. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't run a find-usage, but if that is true then I agree to your proposal :)
" has been taken and the current maximum parallelism (" + | ||
executionJobVertex.getMaxParallelism() + ") changed. This " + | ||
"is currently not supported."); | ||
if (executionJobVertex == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no change to the code, right? Just changing the three-way if to a two-way if with a continue
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code should do the same, I just found the if-nesting was a little deep and checking the preconditions first makes it more readable imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I thought. I just wanted to double check because Github makes it look very scary. 😃
Overall, this change is very good! 👍 I had some inline comments/questions. |
19248e7
to
b0fc1e2
Compare
b0fc1e2
to
43e234c
Compare
When a subtask is restored from a checkpoint that does not contain any state (e.g. because the subtask did not write state in the previous run), the result of
StateInitializationContext::isRestored
will incorrectly return false.This PR ensures that empty state is reflected in a checkpoint and that true is returned from the method on restore, independent from the presence of state.
Furthermore,
SubtaskState::hasState
ignored raw operator state and returned false even if there was raw operator state. PR includes a unit test to catch this problem.