Skip to content

Improve atomic delete#3233

Closed
Ace-Tang wants to merge 1 commit intocontainerd:masterfrom
Ace-Tang:atomic
Closed

Improve atomic delete#3233
Ace-Tang wants to merge 1 commit intocontainerd:masterfrom
Ace-Tang:atomic

Conversation

@Ace-Tang
Copy link
Copy Markdown
Contributor

skip hidden directories in load task, and return soon if path not exist
in atomicDelete

Signed-off-by: Ace-Tang [email protected]

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 19, 2019

Codecov Report

Merging #3233 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3233   +/-   ##
=======================================
  Coverage   44.63%   44.63%           
=======================================
  Files         113      113           
  Lines       12161    12161           
=======================================
  Hits         5428     5428           
  Misses       5898     5898           
  Partials      835      835
Flag Coverage Δ
#linux 48.65% <ø> (ø) ⬆️
#windows 39.86% <ø> (ø) ⬆️

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 2d780a7...778c5c9. Read the comment docs.

Comment thread runtime/v1/linux/runtime.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.

Should we try deleting hidden directory?

Copy link
Copy Markdown
Contributor Author

@Ace-Tang Ace-Tang Apr 22, 2019

Choose a reason for hiding this comment

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

Not sure, but the current logic is if we remove hidden directory, it can not found bundle, since bundle become xxx/.id, container name become hidden, it can not removed again

Comment thread runtime/v1/linux/bundle.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 can just check for IsNotExist on rename instead of making an extra stat call.

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.

Also think this way, the current way can avoid doing RemoveAll

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.

can we handle this error on the os.Rename?

@Ace-Tang
Copy link
Copy Markdown
Contributor Author

Actually I am not find where to get namespace directory hidden 😕

for _, namespace := range dir {
if !namespace.IsDir() {
continue
}
name := namespace.Name()
// skip hidden directories
if len(name) > 0 && name[0] == '.' {
continue
}

@Ace-Tang
Copy link
Copy Markdown
Contributor Author

@crosbymichael , I still get 2 questions:

  1. do we expect to clean up hidden directory in bundle, I am not sure what I add is correct
  2. where do we make namespace directory be hidden

skip hidden directories in load task, and return soon if path not exist
in atomicDelete

Signed-off-by: Ace-Tang <[email protected]>
!os.IsNotExist(err) {
return err
}
return os.RemoveAll(atomicPath)
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 would need to skip this if Rename does not succeed

Comment thread runtime/v2/bundle.go
!os.IsNotExist(err) {
return err
}
return os.RemoveAll(atomicPath)
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.

same here

crosbymichael pushed a commit to crosbymichael/containerd that referenced this pull request May 20, 2019
skip hidden directories in load task, and return soon if path not exist
in atomicDelete

carry of containerd#3233

Closes containerd#3233

Signed-off-by: Ace-Tang <[email protected]>
Signed-off-by: Michael Crosby <[email protected]>
tussennet pushed a commit to tussennet/containerd that referenced this pull request Sep 11, 2020
skip hidden directories in load task, and return soon if path not exist
in atomicDelete

carry of containerd#3233

Closes containerd#3233

Signed-off-by: Ace-Tang <[email protected]>
Signed-off-by: Michael Crosby <[email protected]>
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.

5 participants