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

scan TrashFile and PendingDeletedSlice in status subcommand #3145

Merged
merged 18 commits into from
Jan 10, 2023

Conversation

Hexilee
Copy link
Contributor

@Hexilee Hexilee commented Jan 3, 2023

close #3088

@Hexilee Hexilee requested review from davies and SandyXSD January 3, 2023 08:50
@Hexilee Hexilee requested review from SandyXSD and davies and removed request for davies and SandyXSD January 6, 2023 07:39
pkg/meta/tkv.go Outdated

// slice refs: Kiiiiiiiissss
klen := 1 + 8 + 4
keys, err := m.scanKeys(m.fmtKey("K"))
Copy link
Contributor

Choose a reason for hiding this comment

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

use scan() to fetch values, faster than incrby(0) for every key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pkg/meta/sql.go Outdated
return errors.Wrap(err, "scan slice refs")
}
for _, ref := range refs {
if ref.Refs <= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2023

Codecov Report

Base: 55.92% // Head: 55.78% // Decreases project coverage by -0.14% ⚠️

Coverage data is based on head (9af68d7) compared to base (7bb7f6b).
Patch coverage: 10.58% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3145      +/-   ##
==========================================
- Coverage   55.92%   55.78%   -0.15%     
==========================================
  Files         141      141              
  Lines       32493    32671     +178     
==========================================
+ Hits        18172    18224      +52     
- Misses      12388    12520     +132     
+ Partials     1933     1927       -6     
Impacted Files Coverage Δ
cmd/gc.go 12.41% <0.00%> (ø)
cmd/status.go 44.55% <0.00%> (-6.59%) ⬇️
pkg/meta/base.go 63.89% <0.00%> (-2.09%) ⬇️
pkg/meta/interface.go 48.59% <ø> (ø)
pkg/meta/sql_pg.go 100.00% <ø> (ø)
pkg/meta/redis.go 66.49% <4.16%> (-1.00%) ⬇️
pkg/meta/tkv.go 71.15% <6.89%> (-0.66%) ⬇️
pkg/meta/sql.go 58.88% <32.50%> (-0.41%) ⬇️
pkg/object/sql.go 54.36% <42.85%> (-0.50%) ⬇️
pkg/object/prefix.go 76.23% <0.00%> (-3.98%) ⬇️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

go func() {
_ = m.hscan(c, m.sliceRefs(), func(keys []string) error {
for i := 0; i < len(keys); i += 2 {
pendingKeys <- keys[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

keys[i+1] is the value, we should check the value here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pkg/meta/base.go Outdated
}
if entry.Attr.Typ == TypeDirectory {
var subEntries []*Entry
if st = m.en.doReaddir(ctx, entry.Inode, 1, &subEntries, -1); st != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

The directory should be empty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why should the directory be empty? Here we won't remove the directory, just read it and push subentries into the queue.

Copy link
Contributor

Choose a reason for hiding this comment

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

The trash only has three levels, trash/directory/file or empty directory.
We should avoid the readdir for empty directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, the new implementation ignores empty directories.

cmd/status.go Show resolved Hide resolved
cmd/status.go Show resolved Hide resolved
pkg/meta/base.go Show resolved Hide resolved
pkg/meta/base.go Show resolved Hide resolved
pkg/meta/base.go Outdated Show resolved Hide resolved
@davies davies merged commit 90c71cb into main Jan 10, 2023
@davies davies deleted the scan-more-deleted-obj branch January 10, 2023 09:05
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.

scan TrashFile and PendingDeletedSlice in status subcommand
5 participants