-
Notifications
You must be signed in to change notification settings - Fork 1.1k
meta/sql: optimizate the rmr emptyDir #6457
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6457 +/- ##
===========================================
+ Coverage 22.29% 55.55% +33.26%
===========================================
Files 30 167 +137
Lines 20446 51389 +30943
===========================================
+ Hits 4558 28551 +23993
- Misses 15377 19728 +4351
- Partials 511 3110 +2599 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pkg/meta/sql.go
Outdated
|
|
||
| info := entryInfo{e: e, trash: trash} | ||
| n := node{Inode: e.Inode} | ||
| ok, err := s.ForUpdate().Get(&n) |
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.
合并查询
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.
可以合并的sql语句都处理下,有挺大提升空间
7b43edb to
f7335ae
Compare
f7335ae to
8676dc8
Compare
Signed-off-by: jiefenghuang <[email protected]>
| q := s.Table(&edge{}) | ||
| for i, e := range edges { | ||
| if i == 0 { | ||
| q = q.Where("(parent = ? AND name = ?)", e.Parent, e.Name) |
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.
语句不会超出?可以换成简单的pair对
| } | ||
|
|
||
| seen := make(map[Ino]uint32) | ||
| for i := range entryInfos { |
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.
只有真正删除才需要更新nlink
How about this PR
New low-level doEmptyDir interface, to batch delete files, can optimize metadata operations.
Test Reslut:


Delete a directory with 10,000 empty files
Multilevel directory deletion test(About 11,000 directories and 110,000 files)

