Skip to content

refactor: avoid unnecessary parent creating in Redis service #692

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

Merged
merged 3 commits into from
Sep 17, 2022

Conversation

ClSlaid
Copy link
Contributor

@ClSlaid ClSlaid commented Sep 17, 2022

Signed-off-by: ClSlaid [email protected]

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

To maintain a consensus directory tree, the Redis service will create all parent directories from down to top. This takes the time complexity of $O(n)$ for files with a depth of $n$ directories.

But usually, after a period of warming up, most files will be created under a relatively short additional depth, growing from existing parent directories. Because no metadata of parent directories will be changed, this could be skipped.

This PR will save the time wasted on redundant parent directory creations.

Pros

  • saving time wasted on redundant creations

Cons

  • taking additional time (much depending on network TTL) checking on the warming up period

@ClSlaid ClSlaid changed the title refactor: avoid unnecessary parent creating refactor: avoid unnecessary parent creating in Redis service Sep 17, 2022
@ClSlaid ClSlaid merged commit d571285 into apache:main Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant