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

[BEAM-3646] Add Javadoc on how Teardown is best-effort #4637

Merged
merged 1 commit into from Feb 13, 2018

Conversation

tgroh
Copy link
Member

@tgroh tgroh commented Feb 8, 2018

Assumptions that Teardown will be called both in the case of an orderly
shutdown or in a non-orderly shutdown are not safe, and this assumption
can lead to pipelines which do not produce desired side effects in all
cases.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand:
    • What the pull request does
    • Why it does it
    • How it does it
    • Why this approach
  • Each commit in the pull request should have a meaningful subject line and body.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Assumptions that Teardown will be called both in the case of an orderly
shutdown or in a non-orderly shutdown are not safe, and this assumption
can lead to pipelines which do not produce desired side effects in all
cases.
@kennknowles
Copy link
Member

:lgtm:


Reviewed 2 of 2 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@kennknowles
Copy link
Member

run java gradle precommit

@kennknowles kennknowles assigned tgroh and unassigned kennknowles Feb 12, 2018
@tgroh tgroh merged commit 1488cb9 into apache:master Feb 13, 2018
* Annotation for the method to use to clean up this instance before it is discarded. No other
* method will be called after a call to the annotated method is made.
*
* <p>Note that calls to the annotated method are best effort, and may not occur for arbitrary
Copy link
Contributor

Choose a reason for hiding this comment

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

What would it cost to not make it best effort?
Basically an API which is "best effort" is quite pointless and since beam must not assume the JVM is not reused (it is by some runners) then beam should ensure the transforms can release whatever they used so enforce the call to teardown whatever happent, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is impossible to make it guaranteed, as a machine may fail at any time for any reason. Users should never depend on invocation of teardown to produce results.

Teardown being reliable when there are no failures is possible, but that's a combination of per-runner and per-harness behavior, which I've filed https://issues.apache.org/jira/browse/BEAM-3704 to enable

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok so the javadoc should mention it can be missed due to a crash but except that it is guaranteed. Any code can be dropped due to a crash like the finish bundle you recommand in this javadoc so it is quite misleading now and makes the api not that helpful from a user perspective :(.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume the purpose here is to guide the end user to use tearDown method appropriately. I think it is better to assume the user is beginner and does not know much about how the the job is executed. May be better to emphasis 'best effort' more and (say something to the effect of 'usually invoked during a orderly shutdown'), possibly remove the phrase 'may not occur for arbitrary reasons'. Just thinking aloud.. non-binding review comment.

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.

None yet

4 participants