#include "common/config.h"
#include "include/assert.h"
+#include "include/stringify.h"
#include "common/Formatter.h"
#define dout_subsys ceph_subsys_paxos
dout(10) << __func__ << " from " << from << " to " << to << dendl;
assert(from < to);
- while (from < to) {
- dout(10) << "trim " << from << dendl;
- t->erase(get_name(), from);
- from++;
+ for (version_t v = from; v < to; ++v) {
+ dout(10) << "trim " << v << dendl;
+ t->erase(get_name(), v);
}
if (g_conf->mon_compact_on_trim) {
- dout(10) << " compacting prefix" << dendl;
- t->compact_prefix(get_name());
+ dout(10) << " compacting trimmed range" << dendl;
+ t->compact_range(get_name(), stringify(from), stringify(to));
}
}
{
dout(10) << __func__ << " from " << from << " to " << to << dendl;
assert(from != to);
- for (; from < to; from++) {
- dout(20) << __func__ << " " << from << dendl;
- t->erase(get_service_name(), from);
- string full_key = mon->store->combine_strings("full", from);
+ for (version_t v = from; v < to; ++v) {
+ dout(20) << __func__ << " " << v << dendl;
+ t->erase(get_service_name(), v);
+
+ string full_key = mon->store->combine_strings("full", v);
if (mon->store->exists(get_service_name(), full_key)) {
dout(20) << __func__ << " " << full_key << dendl;
t->erase(get_service_name(), full_key);
}
if (g_conf->mon_compact_on_trim) {
dout(20) << " compacting prefix " << get_service_name() << dendl;
- t->compact_prefix(get_service_name());
+ t->compact_range(get_service_name(), stringify(from), stringify(to));
}
}