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

Introduce a fast unlink function for rmr feature #5443

Open
anysql opened this issue Dec 26, 2024 · 3 comments
Open

Introduce a fast unlink function for rmr feature #5443

anysql opened this issue Dec 26, 2024 · 3 comments
Labels
kind/feature New feature or request

Comments

@anysql
Copy link
Contributor

anysql commented Dec 26, 2024

What would you like to be added:

Just check the source code, the rmr will call "Unlink" function for file deletion, it will update the parent directory attributes (nlink/mtime etc) and statistics (quota limits) for each file. Since we are going to drop the directory, there is no need for these extra steps, at least we can consider a batch pipeline mode for less network roundtrips.

Why is this needed:

Improve the rmr performance, may be 2x or more faster.

@anysql anysql added the kind/feature New feature or request label Dec 26, 2024
@davies
Copy link
Contributor

davies commented Jan 23, 2025

We should update the quota, and skip some of operations on parent.

@anysql
Copy link
Contributor Author

anysql commented Feb 5, 2025

For Unlink operation, parent node is not always updated, reduce operations does not help much.

If we skip checking the following two steps for rmr emptyDir operation, no need to get the parent node info (save a roundtrip), which can improve the rmr performance by 10% (local test from 1737.7/s to 1955.1/s).

                    if (pn.Flags&FlagAppend) != 0 || (pn.Flags&FlagImmutable) != 0 {
                            return syscall.EPERM
                    }

                    if ctx.Uid() != 0 && pn.Mode&01000 != 0 && ctx.Uid() != pn.Uid && ctx.Uid() != n.Uid {
                            return syscall.EACCES
                    }

@anysql
Copy link
Contributor Author

anysql commented Feb 6, 2025

If we pass the edge info from emptyDir to skip the query of edge info, and also skip the xattr delete (usually empty).

The throughput can improved to 2326.2/s in local test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants