Skip to content

Update metadata interfaces for containers and leases#3668

Merged
estesp merged 1 commit intocontainerd:masterfrom
dmcgowan:fix-metadata-dirty
Sep 24, 2019
Merged

Update metadata interfaces for containers and leases#3668
estesp merged 1 commit intocontainerd:masterfrom
dmcgowan:fix-metadata-dirty

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

Add more thorough dirty checking across all types which may be deleted and hold references. This ensures that lease and container deletion will trigger a GC. Additionally it will prevent an image deletion from triggering a content store GC when no content is removed (such as images with multiple names).

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 20, 2019

Build succeeded.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Sep 20, 2019

Codecov Report

Merging #3668 into master will increase coverage by 0.1%.
The diff coverage is 59.58%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3668     +/-   ##
========================================
+ Coverage      42%   42.1%   +0.1%     
========================================
  Files         129     129             
  Lines       14275   14307     +32     
========================================
+ Hits         5996    6024     +28     
- Misses       7379    7383      +4     
  Partials      900     900
Flag Coverage Δ
#linux 45.61% <62.86%> (+0.09%) ⬆️
#windows 37.05% <59.23%> (+0.14%) ⬆️
Impacted Files Coverage Δ
metadata/content.go 44.42% <0%> (+0.06%) ⬆️
runtime/v2/manager.go 4.76% <0%> (+0.06%) ⬆️
metadata/images.go 57.41% <100%> (-0.17%) ⬇️
metadata/snapshot.go 47.81% <100%> (-0.1%) ⬇️
metadata/containers.go 49.84% <58.26%> (+1.87%) ⬆️
metadata/leases.go 53.09% <61.59%> (+1.84%) ⬆️
metadata/db.go 65.76% <66.66%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1af133f...0b224ac. Read the comment docs.

Comment thread metadata/leases.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it seems that it is better to update dirty field after Delete successfully

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This delete will return nil if the key doesn't exist, so then is it better to check whether the key exists before deleting?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that the dirty should be set if the bkt is not nil.

Comment thread metadata/images.go Outdated
@fuweid
Copy link
Copy Markdown
Member

fuweid commented Sep 20, 2019

The change looks great !

@crosbymichael
Copy link
Copy Markdown
Member

Nice, I was looking at these services the other day and wondering why they took the database directly

Comment thread metadata/containers.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we're loosing err result from DeleteBucket here. Since DeleteBucket is wrapped with if, it's errresult is visible inside that if block.
And this return err captured from NamespaceRequired return and will always be nil here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, you are right! I didn't even notice that, the code was wrong before. I don't think there is any chance for that err to be set so it was never seen, but still very wrong. Updating.

Add more thorough dirty checking across all types which
may be deleted and hold references.

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan dmcgowan added this to the 1.3 milestone Sep 23, 2019
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 23, 2019

Build succeeded.

Copy link
Copy Markdown
Member

@mxpv mxpv left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

nice one!

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp merged commit 9c10bf8 into containerd:master Sep 24, 2019
@dmcgowan dmcgowan deleted the fix-metadata-dirty branch March 23, 2022 22:26
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.

6 participants