Skip to content
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

Closed

Conversation

StefanRRichter
Copy link
Contributor

@StefanRRichter StefanRRichter commented Nov 3, 2016

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.

@StefanRRichter
Copy link
Contributor Author

R @aljoscha

@StefanRRichter StefanRRichter force-pushed the hotfix-has-state branch 4 times, most recently from 8e12dd7 to db3760d Compare November 4, 2016 11:19
@StefanRRichter StefanRRichter changed the title [hotfix] SubtaskState::hasState ignores raw operator state [FLINK-5019] Proper isRestored result for tasks that did not write state Nov 4, 2016
assertEquals(errMsg, subtaskState.getLegacyOperatorState(),
tdd.getTaskStateHandles().getLegacyOperatorState());

if (subtaskState.hasState()) {
Copy link
Contributor

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. 😅

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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. 😃

@aljoscha
Copy link
Contributor

aljoscha commented Nov 4, 2016

Overall, this change is very good! 👍

I had some inline comments/questions.

@StefanRRichter StefanRRichter force-pushed the hotfix-has-state branch 6 times, most recently from 19248e7 to b0fc1e2 Compare November 7, 2016 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants