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
Conversation
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
LGTM |
LGTM |
LGTM |
WindowsTP4 https://jenkins.dockerproject.org/job/Docker-PRs-WoW-TP4/1138/console 😢
|
LGTM |
Fix migration diffid atomic write
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