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

Fix migration diffid atomic write #20372

Merged
merged 1 commit into from Feb 17, 2016
Merged

Conversation

tonistiigi
Copy link
Member

Fixes #20267

From the #20267 debug info it seems that empty diffid file was created during the calculation phase. This makes sure that if calculation is cancelled it can not leave a layer in a broken state. There is also added validation that we don't create broken image configurations but error out if a layer diffid is not a valid digest.

cc @dmcgowan @aaronlehmann

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

Fixes moby#20267

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@@ -160,7 +160,12 @@ func calculateLayerChecksum(graphDir, id string, ls checksumCalculator) error {
return err
}

if err := ioutil.WriteFile(filepath.Join(graphDir, id, migrationDiffIDFileName), []byte(diffID), 0600); err != nil {
tmpFile := filepath.Join(graphDir, id, migrationDiffIDFileName+".tmp")
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should use an extension like .migrate to make it clearer where a stray file came from.

Copy link
Member Author

Choose a reason for hiding this comment

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

All these files already have .migration- prefix

@aaronlehmann
Copy link
Contributor

LGTM

@tonistiigi tonistiigi added this to the 1.10.2 milestone Feb 16, 2016
@dmcgowan
Copy link
Member

LGTM

@thaJeztah
Copy link
Member

LGTM

@thaJeztah
Copy link
Member

WindowsTP4 https://jenkins.dockerproject.org/job/Docker-PRs-WoW-TP4/1138/console 😢

fatal: unable to access 'https://github.com/docker/docker.git/': transfer closed with outstanding read data remaining
21:52:38 + ec=128
21:52:38 + set +x

@cpuguy83
Copy link
Member

LGTM

calavera added a commit that referenced this pull request Feb 17, 2016
@calavera calavera merged commit 61aa025 into moby:master Feb 17, 2016
@calavera calavera deleted the fix-empty-diffid branch February 17, 2016 23:03
@tiborvass tiborvass mentioned this pull request Feb 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants