Skip to content

[BEAM-5971] Prevent unwanted shutdown of UnboundedSourceWrapper#6946

Merged
mxm merged 2 commits into
apache:masterfrom
mxm:FLINK-5971
Nov 6, 2018
Merged

[BEAM-5971] Prevent unwanted shutdown of UnboundedSourceWrapper#6946
mxm merged 2 commits into
apache:masterfrom
mxm:FLINK-5971

Conversation

@mxm
Copy link
Copy Markdown
Contributor

@mxm mxm commented Nov 5, 2018

When shutdownSourcesOnFinalWatermark is set to false, sources must not be
shut down in order to enable the checkpointing to work correctly.

R: @angoenka

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status Build Status Build Status Build Status Build Status
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

When `shutdownSourcesOnFinalWatermark` is set to `false`, sources must not be
shut down in order to enable the checkpointing to work correctly.
@mxm mxm requested a review from angoenka November 5, 2018 17:30
Copy link
Copy Markdown
Contributor

@angoenka angoenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Max.
Some comments on simplification otherwise looks good.

finalizeSource();
}

private void finalizeSource() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'While' inside this method was never executed earlier as isRunning was always false when we reached here.
Shall we call this method only from the 1st if statement L205 as even not, in the other else blocks will exit only after isRunning is false.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wait is only used as sleep here. Shall we change it to sleep to make it more evident?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the bug was that the finalize code was never executed for empty readers.

Shall we call this method only from the 1st if statement L205 as even not, in the other else blocks will exit only after isRunning is false.

All if blocks will eventually execute finalizeSource, so I wouldn't call it directly in line 205 because that would additionally require a return; statement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wait is only used as sleep here. Shall we change it to sleep to make it more evident?

Yes, good idea. The object we're waiting for, can't be notified, so sleep is better here.

finalizeSource();
}

private void finalizeSource() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

We're not holding a shared lock, so Thread.sleep is the better approach for
waiting.
@mxm mxm merged commit b71eb72 into apache:master Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants