-
Notifications
You must be signed in to change notification settings - Fork 997
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
Conversation
…to scanPendingFiles Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
pkg/meta/tkv.go
Outdated
|
||
// slice refs: Kiiiiiiiissss | ||
klen := 1 + 8 + 4 | ||
keys, err := m.scanKeys(m.fmtKey("K")) |
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.
use scan() to fetch values, faster than incrby(0)
for every key
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.
Done
pkg/meta/sql.go
Outdated
return errors.Wrap(err, "scan slice refs") | ||
} | ||
for _, ref := range refs { | ||
if ref.Refs <= 0 { |
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.
no need
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.
Removed
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Codecov ReportBase: 55.92% // Head: 55.78% // Decreases project coverage by
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
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. |
pkg/meta/redis.go
Outdated
go func() { | ||
_ = m.hscan(c, m.sliceRefs(), func(keys []string) error { | ||
for i := 0; i < len(keys); i += 2 { | ||
pendingKeys <- keys[i] |
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.
keys[i+1] is the value, we should check the value here
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.
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 { |
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.
The directory should be empty
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.
Why should the directory be empty? Here we won't remove the directory, just read it and push subentries into the queue.
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.
The trash only has three levels, trash/directory/file or empty directory.
We should avoid the readdir
for empty directory.
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.
Fixed, the new implementation ignores empty directories.
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
Signed-off-by: xixi <[email protected]>
close #3088