{
auto p_iter = db->cf_handles.find(prefix);
if (p_iter == db->cf_handles.end()) {
- uint64_t cnt = db->delete_range_threshold;
+ uint64_t cnt = db->get_delete_range_threshold();
bat.SetSavePoint();
auto it = db->get_iterator(prefix);
for (it->seek_to_first(); it->valid() && (--cnt) != 0; it->next()) {
} else {
ceph_assert(p_iter->second.handles.size() >= 1);
for (auto cf : p_iter->second.handles) {
- uint64_t cnt = db->delete_range_threshold;
+ uint64_t cnt = db->get_delete_range_threshold();
bat.SetSavePoint();
auto it = db->new_shard_iterator(cf);
for (it->SeekToFirst(); it->Valid() && (--cnt) != 0; it->Next()) {
const string &start,
const string &end)
{
- ldout(db->cct, 10) << __func__ << " enter start=" << start
+ ldout(db->cct, 10) << __func__
+ << " enter prefix=" << prefix
+ << " start=" << start
<< " end=" << end << dendl;
auto p_iter = db->cf_handles.find(prefix);
+ uint64_t cnt = db->get_delete_range_threshold();
if (p_iter == db->cf_handles.end()) {
- uint64_t cnt = db->delete_range_threshold;
+ uint64_t cnt0 = cnt;
bat.SetSavePoint();
auto it = db->get_iterator(prefix);
for (it->lower_bound(start);
it->next()) {
bat.Delete(db->default_cf, combine_strings(prefix, it->key()));
}
+ ldout(db->cct, 15) << __func__ << " count = "
+ << cnt0 - cnt
+ << dendl;
if (cnt == 0) {
ldout(db->cct, 10) << __func__ << " p_iter == end(), resorting to DeleteRange"
<< dendl;
} else {
bat.PopSavePoint();
}
+ } else if (cnt == 0) {
+ ceph_assert(p_iter->second.handles.size() >= 1);
+ for (auto cf : p_iter->second.handles) {
+ ldout(db->cct, 10) << __func__ << " p_iter != end(), resorting to DeleteRange"
+ << dendl;
+ bat.DeleteRange(cf, rocksdb::Slice(start), rocksdb::Slice(end));
+ }
} else {
ceph_assert(p_iter->second.handles.size() >= 1);
for (auto cf : p_iter->second.handles) {
- uint64_t cnt = db->delete_range_threshold;
+ cnt = db->get_delete_range_threshold();
+ uint64_t cnt0 = cnt;
bat.SetSavePoint();
rocksdb::Iterator* it = db->new_shard_iterator(cf);
ceph_assert(it != nullptr);
it->Next()) {
bat.Delete(cf, it->key());
}
+ ldout(db->cct, 10) << __func__ << " count = "
+ << cnt0 - cnt
+ << dendl;
if (cnt == 0) {
ldout(db->cct, 10) << __func__ << " p_iter != end(), resorting to DeleteRange"
<< dendl;
/// compact the underlying rocksdb store
bool compact_on_mount;
bool disableWAL;
- const uint64_t delete_range_threshold;
+ uint64_t get_delete_range_threshold() const {
+ return cct->_conf.get_val<uint64_t>("rocksdb_delete_range_threshold");
+ }
+
void compact() override;
void compact_async() override {
compact_queue_stop(false),
compact_thread(this),
compact_on_mount(false),
- disableWAL(false),
- delete_range_threshold(cct->_conf.get_val<uint64_t>("rocksdb_delete_range_threshold"))
+ disableWAL(false)
{}
~RocksDBStore() override;