_sanity_check_store();
}
+ remove_legacy_versions();
+}
+
+void Paxos::remove_legacy_versions()
+{
if (get_store()->exists(get_name(), "conversion_first")) {
- MonitorDBStore::Transaction scrub_tx;
- version_t cf = get_store()->get(get_name(), "conversion_first");
- dout(10) << __func__ << " scrub paxos from " << cf
- << " to " << first_committed << dendl;
- if (cf < first_committed)
- trim_to(&scrub_tx, cf, first_committed);
- scrub_tx.erase(get_name(), "conversion_first");
- get_store()->apply_transaction(scrub_tx);
+ MonitorDBStore::Transaction t;
+ version_t v = get_store()->get(get_name(), "conversion_first");
+ dout(10) << __func__ << " removing pre-conversion paxos states from " << v
+ << " until " << first_committed << dendl;
+ for (; v < first_committed; ++v) {
+ t.erase(get_name(), v);
+ }
+ t.erase(get_name(), "conversion_first");
+ get_store()->apply_transaction(t);
}
-
}
void Paxos::_sanity_check_store()
// get ready for a new round.
new_value.clear();
+
+ remove_legacy_versions();
}
*/
void store_state(MMonPaxos *m);
void _sanity_check_store();
+
+ /**
+ * remove legacy paxos versions from before conversion
+ */
+ void remove_legacy_versions();
+
/**
* Helper function to decode a bufferlist into a transaction and append it
* to another transaction.