curve
curve copied to clipboard
[feat]curvefs: client: optimize rmdir
What problem does this PR solve?
when rmdir, it uses ListDentry to check if dir is empty, which cost to mush.
Issue Number: #xxx
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List
- [x] Relevant documentation/comments is changed or added
- [x] I acknowledge that all my contributions will be made under the project's license
Currently, the statistical information recorded in xattr is updated to the metaserver asynchronously. In the scenario where the client exits abnormally, the recorded information may be inaccurate. It is not suitable to use this in the scenario where the deletion directory is judged to be empty and has strong consistency requirements.
Currently, the statistical information recorded in xattr is updated to the metaserver asynchronously. In the scenario where the client exits abnormally, the recorded information may be inaccurate. It is not suitable to use this in the scenario where the deletion directory is judged to be empty and has strong consistency requirements.
Yes, I forget the xattr is updated asynchronously, But the dentryCacheManager method Listdentry is too heavy for rmdir, maybe we should add one method IsEmpty which call Listdentry once?
cicheck
@Wine93
Hi @201341, thank you for your contribute, there is a bit complex for readdir()
, we cannot directly limit the entries of the directory cache even if there are many entries due to the performance considerations, but it's a pretty good solution for rmdir()
, you can add a RPC which maybe named CheckDirEmpty()
to check whether the directory is empty, and we also have a solution to solve how to read the large directory, we will publish the new version in the near future.
Thank you for your contribute again, it helps us to improve the performance of rmdir()
, you can beautify the code and requested review from us again :)
Hi @201341, thank you for your contribute, there is a bit complex for
readdir()
, we cannot directly limit the entries of the directory cache even if there are many entries due to the performance considerations, but it's a pretty good solution forrmdir()
, you can add a RPC which maybe namedCheckDirEmpty()
to check wether the directory is empty, and we also have a solution to solve how to read the large directory, we will publish the new version in the near future. Thank you for your contribute again, it helps us to improve the performance ofrmdir()
, you can beautify the code and requested review from us agin :)
Got it, Looking forward to the new solution.
cicheck
@Wine93 The code is ok.
cicheck
cicheck
https://github.com/opencurve/curve/pull/2680
@201341 please resolve the conflict.