8000 Fix naivediffdriver timestamp precision bug by tonistiigi · Pull Request #27209 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix naivediffdriver timestamp precision bug #27209

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

Merged
merged 1 commit into from
Oct 10, 2016

Conversation

tonistiigi
Copy link
Member

Fixes #21555

This hack was suggested as a fix 6 months ago and as no better options have been brought up I suggest we merge it. At least temporarily.

Note that this doesn't sleep between every layer, only if there is a chance of this bug happening(very fast write in the beginning of a full second).

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

@@ -44,6 +44,7 @@ func NewNaiveDiffDriver(driver ProtoDriver, uidMaps, gidMaps []idtools.IDMap) Dr
// Diff produces an archive of the changes between the specified
// layer and its parent layer which may be "".
func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) {
startTime := time.Now()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd propose to use time.Now().Truncate(time.Second) here and startTime.Add(time.Second).Sub(time.Now()) in sleep. It looks more understandable to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the sleep-between-layers branch from 858d71f to d1a8305 Compare October 7, 2016 20:52
@LK4D4
Copy link
Contributor
LK4D4 commented Oct 7, 2016

LGTM

1 similar comment
@mlaventure
Copy link
Contributor

LGTM

@mlaventure mlaventure merged commit 7ba3154 into moby:master Oct 10, 2016
@thaJeztah thaJeztah added this to the 1.13.0 milestone Oct 10, 2016
Copy link
@xproax xproax left a comment

Choose a reason for hiding this comment

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

💯

@@ -44,6 +44,7 @@ func NewNaiveDiffDriver(driver ProtoDriver, uidMaps, gidMaps []idtools.IDMap) Dr
// Diff produces an archive of the changes between the specified
// layer and its parent layer which may be "".
func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) {
startTime := time.Now()
Copy link

Choose a reason for hiding this comment

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

liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
cherry-pick from: moby#27209

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Lei Jitang <leijitang@huawei.com>
(cherry picked from commit d1a8305)
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.

Image layer contents are unstable
6 participants
0