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

The implementation of randomKey command may be slow and not safe #230

Open
mzygQAQ opened this issue Apr 21, 2022 · 0 comments
Open

The implementation of randomKey command may be slow and not safe #230

mzygQAQ opened this issue Apr 21, 2022 · 0 comments

Comments

@mzygQAQ
Copy link

mzygQAQ commented Apr 21, 2022

titan/db/kv.go

Line 215 in 97868f5

for iter.Valid() && iter.Key().HasPrefix(prefix) {

  1. After we generate a ranom metakey for seek, we iterator the whole keyspace and load it's all key to the memory under extreme conditions which is so slow and may cause OOM.
  2. When we iterate the keyspace , we never judge the expire time of the key, it may has expired already, so RandomKey may return a expired key, and user will get nil when use this key to lookup value.
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

No branches or pull requests

1 participant