curve icon indicating copy to clipboard operation
curve copied to clipboard

[feat]curvefs: client: optimize rmdir

Open 201341 opened this issue 1 year ago • 12 comments

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

201341 avatar Jun 07 '23 02:06 201341

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.

SeanHai avatar Jun 07 '23 08:06 SeanHai

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?

201341 avatar Jun 07 '23 10:06 201341

cicheck

201341 avatar Jun 14 '23 02:06 201341

@Wine93

wuhongsong avatar Jun 19 '23 06:06 wuhongsong

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 :)

Wine93 avatar Jun 20 '23 02:06 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 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 of rmdir(), you can beautify the code and requested review from us agin :)

Got it, Looking forward to the new solution.

201341 avatar Jun 20 '23 02:06 201341

cicheck

201341 avatar Jun 25 '23 07:06 201341

@Wine93 The code is ok.

201341 avatar Jun 26 '23 02:06 201341

cicheck

201341 avatar Jul 19 '23 06:07 201341

cicheck

201341 avatar Jul 20 '23 06:07 201341

https://github.com/opencurve/curve/pull/2680

wuhongsong avatar Aug 14 '23 03:08 wuhongsong

@201341 please resolve the conflict.

Cyber-SiKu avatar Aug 22 '23 02:08 Cyber-SiKu