We want to trim old states even if there is no update activity. For
example, if a long-running rebalance finishes all osdmap updates will
stop and we won't trim out old maps to free space.
Instead, trim at the same time as tick(). Remove the trim during
propose_pending() to force all trims through this path and avoid
introducing a new and rarely-exercised behavior.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p) {
(*p)->tick();
+ (*p)->maybe_trim();
}
// trim sessions
MonitorDBStore::Transaction t;
bufferlist bl;
- update_trim();
if (should_stash_full())
encode_full(&t);
- if (should_trim()) {
- encode_trim(&t);
- }
-
encode_pending(&t);
have_pending = false;
finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
}
+void PaxosService::maybe_trim()
+{
+ if (is_writeable() && should_trim()) {
+ dout(10) << __func__ << " trimming" << dendl;
+
+ MonitorDBStore::Transaction t;
+ encode_trim(&t);
+ bufferlist bl;
+ t.encode(bl);
+
+ paxos->propose_new_value(bl, new C_Committed(this));
+ }
+}
+
bool PaxosService::should_trim()
{
if (!service_should_trim())
*/
virtual void tick() {}
+ /**
+ * called at same interval as tick. consider a trim.
+ */
+ void maybe_trim();
+
/**
* Get health information
*