Add osd_rocksdb_iterator_bounds_enabled config option to allow rocksdb iterator bounds to be disabled.
Also includes minor refactoring to shorten code associated with IteratorBounds initialization in bluestore.
Signed-off-by: Cory Snyder <csnyder@iland.com>
default: 1
flags:
- runtime
+- name: osd_rocksdb_iterator_bounds_enabled
+ desc: Whether omap iterator bounds are applied to rocksdb iterator ReadOptions
+ type: bool
+ level: dev
+ default: true
+ with_legacy: true
iterate_upper_bound(make_slice(bounds.upper_bound))
{
auto options = rocksdb::ReadOptions();
- if (bounds.lower_bound) {
- options.iterate_lower_bound = &iterate_lower_bound;
- }
- if (bounds.upper_bound) {
- options.iterate_upper_bound = &iterate_upper_bound;
+ if (db->cct->_conf->osd_rocksdb_iterator_bounds_enabled) {
+ if (bounds.lower_bound) {
+ options.iterate_lower_bound = &iterate_lower_bound;
+ }
+ if (bounds.upper_bound) {
+ options.iterate_upper_bound = &iterate_upper_bound;
+ }
}
dbiter = db->db->NewIterator(options, cf);
}
{
iters.reserve(shards.size());
auto options = rocksdb::ReadOptions();
- if (bounds.lower_bound) {
- options.iterate_lower_bound = &iterate_lower_bound;
- }
- if (bounds.upper_bound) {
- options.iterate_upper_bound = &iterate_upper_bound;
+ if (db->cct->_conf->osd_rocksdb_iterator_bounds_enabled) {
+ if (bounds.lower_bound) {
+ options.iterate_lower_bound = &iterate_lower_bound;
+ }
+ if (bounds.upper_bound) {
+ options.iterate_upper_bound = &iterate_upper_bound;
+ }
}
for (auto& s : shards) {
iters.push_back(db->db->NewIterator(options, s));
rocksdb::ColumnFamilyHandle* cf = nullptr;
if (cf_it->second.handles.size() == 1) {
cf = cf_it->second.handles[0];
- } else {
+ } else if (cct->_conf->osd_rocksdb_iterator_bounds_enabled) {
cf = get_cf_handle(prefix, bounds);
}
if (cf) {
rocksdb::ReadOptions options = rocksdb::ReadOptions();
if (opts & ITERATOR_NOCACHE)
options.fill_cache=false;
- if (bounds.lower_bound) {
- options.iterate_lower_bound = &iterate_lower_bound;
- }
- if (bounds.upper_bound) {
- options.iterate_upper_bound = &iterate_upper_bound;
+ if (db->cct->_conf->osd_rocksdb_iterator_bounds_enabled) {
+ if (bounds.lower_bound) {
+ options.iterate_lower_bound = &iterate_lower_bound;
+ }
+ if (bounds.upper_bound) {
+ options.iterate_upper_bound = &iterate_upper_bound;
+ }
}
dbiter = db->db->NewIterator(options, cf);
}
string head, tail;
o->get_omap_header(&head);
o->get_omap_tail(&tail);
- auto bounds = KeyValueDB::IteratorBounds();
- bounds.lower_bound = head;
- bounds.upper_bound = tail;
- KeyValueDB::Iterator it = db->get_iterator(prefix, 0, std::move(bounds));
+ KeyValueDB::Iterator it = db->get_iterator(prefix, 0, KeyValueDB::IteratorBounds{head, tail});
it->lower_bound(head);
while (it->valid()) {
if (it->key() == head) {
string head, tail;
o->get_omap_key(string(), &head);
o->get_omap_tail(&tail);
- auto bounds = KeyValueDB::IteratorBounds();
- bounds.lower_bound = head;
- bounds.upper_bound = tail;
- KeyValueDB::Iterator it = db->get_iterator(prefix, 0, std::move(bounds));
+ KeyValueDB::Iterator it = db->get_iterator(prefix, 0, KeyValueDB::IteratorBounds{head, tail});
it->lower_bound(head);
while (it->valid()) {
if (it->key() >= tail) {
string head, tail;
oldo->get_omap_header(&head);
oldo->get_omap_tail(&tail);
- auto bounds = KeyValueDB::IteratorBounds();
- bounds.lower_bound = head;
- bounds.upper_bound = tail;
- KeyValueDB::Iterator it = db->get_iterator(prefix, 0, std::move(bounds));
+ KeyValueDB::Iterator it = db->get_iterator(prefix, 0, KeyValueDB::IteratorBounds{head, tail});
it->lower_bound(head);
while (it->valid()) {
if (it->key() >= tail) {