-
Notifications
You must be signed in to change notification settings - Fork 211
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
[kvdb-rocksdb] adds num_keys()
#285
Conversation
Uses `"rocksdb.estimate-num-keys"` to get an estimate of the number of keys in a database (see https://github.com/facebook/rocksdb/wiki/RocksDB-FAQ#failure-recovery).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it makes sense to add it to the kvdb
trait?
That's what I did in the other PR but I think I'd like to see a use case outside rocksdb first. Databases vary a lot when it comes to precision and performance of counting the records so not sure it's something we should abstract over. E.g. the memory db impl would likely not be an estimate, and who knows how lmdb works in this area? |
* master: Update benchmark code to latest changes on master (#284)
Co-Authored-By: Andronik Ordian <write@reusable.software>
Some(ref cfs) => { | ||
let cf = cfs.cf(col as usize); | ||
match cfs.db.property_int_value_cf(cf, ESTIMATE_NUM_KEYS) { | ||
Ok(estimate) => Ok(estimate.unwrap_or_default()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I'm not sure that I follow the propagation of errors here.
If no db exist => Ok(0)
Ok(None) => only happens on bad &str?!
Err(e) => parsing of number failed or something else?
according to https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L654-L689 "rocksdb.estimate-num-keys" will succeed so I see no problem with but some errors/Option::None
might get swallowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation in the changelog should be fixed except that it looks good,
Uses
"rocksdb.estimate-num-keys"
to get an estimate of the number of keys in a database (see https://github.com/facebook/rocksdb/wiki/RocksDB-FAQ#failure-recovery).