Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dockershim: check if f.Sync() returns an error and surface it#52125

Merged
k8s-github-robot merged 1 commit into
kubernetes:masterfrom
yujuhong:fix-file-sync
Sep 13, 2017
Merged

dockershim: check if f.Sync() returns an error and surface it#52125
k8s-github-robot merged 1 commit into
kubernetes:masterfrom
yujuhong:fix-file-sync

Conversation

@yujuhong
Copy link
Copy Markdown
Contributor

@yujuhong yujuhong commented Sep 7, 2017

dockershim: check the error when syncing the checkpoint.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 7, 2017
@yujuhong yujuhong added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Sep 7, 2017
@k8s-github-robot k8s-github-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 7, 2017
@yujuhong yujuhong added kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 7, 2017
@yujuhong
Copy link
Copy Markdown
Contributor Author

yujuhong commented Sep 7, 2017

/approve no-issue

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 7, 2017
f.Sync()
if err == nil {
// Only sync if the Write completed successfully.
err = f.Sync()
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.

Is there a reason for hiding old errors behind new errors? If it's so control flow makes it to f.Close(), perhaps defer is better?

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.

This function surfaces the errors in the following order:

  1. write error
  2. sync error
  3. close error

If (1) is non-nil, return (1). If (2) is non-nil, return (2), etc.
This follows the existing flow and convention in ioutil.WriteFile()

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.

Ah, I see. SG.

@freehan
Copy link
Copy Markdown
Contributor

freehan commented Sep 12, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2017
@k8s-github-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, yujuhong

Associated issue requirement bypassed by: yujuhong

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@yujuhong yujuhong added this to the v1.8 milestone Sep 12, 2017
@k8s-github-robot
Copy link
Copy Markdown

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link
Copy Markdown

Automatic merge from submit-queue (batch tested with PRs 52339, 52343, 52125, 52360, 52301)

@k8s-github-robot k8s-github-robot merged commit c6a9b1e into kubernetes:master Sep 13, 2017
@yujuhong yujuhong deleted the fix-file-sync branch January 14, 2019 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants