titan
titan copied to clipboard
The implementation of randomKey command may be slow and not safe
https://github.com/distributedio/titan/blob/97868f5d24e0c13621658fbcb712064fec59e8be/db/kv.go#L215
- 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.
- 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.