#include "PaxosService.h"
#include "common/LogEntry.h"
+#include "messages/MLog.h"
class MMonCommand;
-class MLog;
class LogMonitor : public PaxosService {
private:
MLog *ack;
C_Log(LogMonitor *p, MLog *a) : logmon(p), ack(a) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ if (ack)
+ ack->put();
+ return;
+ }
logmon->_updated_log(ack);
}
};
#include "PaxosService.h"
#include "Session.h"
+#include "messages/MMDSBeacon.h"
-class MMDSBeacon;
class MMDSGetMap;
class MMonCommand;
class MMDSLoadTargets;
C_Updated(MDSMonitor *a, MMDSBeacon *c) :
mm(a), m(c) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ if (m)
+ m->put();
+ return;
+ }
if (r >= 0)
mm->_updated(m); // success
else
#include "Session.h"
class Monitor;
-class MOSDBoot;
-class MMonCommand;
-class MPoolSnap;
-class MOSDMap;
-class MOSDFailure;
+#include "messages/MOSDBoot.h"
+#include "messages/MMonCommand.h"
+#include "messages/MOSDMap.h"
+#include "messages/MOSDFailure.h"
+#include "messages/MPoolOp.h"
/// information about a particular peer's failure reports for one osd
struct failure_reporter_t {
C_Booted(OSDMonitor *cm, MOSDBoot *m_, bool l=true) :
cmon(cm), m(m_), logit(l) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ if (m)
+ m->put();
+ return;
+ }
+
if (r >= 0)
cmon->_booted(m, logit);
else
epoch_t e;
C_ReplyMap(OSDMonitor *o, PaxosServiceMessage *mm, epoch_t ee) : osdmon(o), m(mm), e(ee) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ if (m)
+ m->put();
+ return;
+ }
osdmon->_reply_map(m, e);
}
};
C_PoolOp(OSDMonitor * osd, MPoolOp *m_, int rc, int e, bufferlist *rd=NULL) :
osdmon(osd), m(m_), replyCode(rc), epoch(e), reply_data(rd) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ if (m)
+ m->put();
+ return;
+ }
osdmon->_pool_op_reply(m, replyCode, epoch, reply_data);
}
};
epoch_t epoch;
RetryCheckOSDMap(PGMonitor *p, epoch_t e) : pgmon(p), epoch(e) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
pgmon->check_osd_map(epoch);
}
};
#include "msg/Messenger.h"
#include "common/config.h"
-class MPGStats;
-class MPGStatsAck;
+#include "messages/MPGStats.h"
+#include "messages/MPGStatsAck.h"
class MStatfs;
class MMonCommand;
class MGetPoolStats;
entity_inst_t who;
C_Stats(PGMonitor *p, MPGStats *r, MPGStatsAck *a) : pgmon(p), req(r), ack(a) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ req->put();
+ ack->put();
+ return;
+ }
pgmon->_updated_stats(req, ack);
}
};
}
}
+void Paxos::shutdown() {
+ dout(10) << __func__ << " cancel all contexts" << dendl;
+ finish_contexts(g_ceph_context, waiting_for_writeable, -ECANCELED);
+ finish_contexts(g_ceph_context, waiting_for_commit, -ECANCELED);
+ finish_contexts(g_ceph_context, waiting_for_readable, -ECANCELED);
+ finish_contexts(g_ceph_context, waiting_for_active, -ECANCELED);
+}
+
void Paxos::leader_init()
{
cancel_events();
dout(10) << "peon_init -- i am a peon" << dendl;
// no chance to write now!
- finish_contexts(g_ceph_context, waiting_for_writeable, -1);
- finish_contexts(g_ceph_context, waiting_for_commit, -1);
+ finish_contexts(g_ceph_context, waiting_for_writeable, -EAGAIN);
+ finish_contexts(g_ceph_context, waiting_for_commit, -EAGAIN);
}
void Paxos::restart()
cancel_events();
new_value.clear();
- finish_contexts(g_ceph_context, waiting_for_commit, -1);
- finish_contexts(g_ceph_context, waiting_for_active, -1);
+ finish_contexts(g_ceph_context, waiting_for_commit, -EAGAIN);
+ finish_contexts(g_ceph_context, waiting_for_active, -EAGAIN);
}
#include "include/Context.h"
#include "common/Timer.h"
+#include <errno.h>
class Monitor;
class MMonPaxos;
public:
C_CollectTimeout(Paxos *p) : paxos(p) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
paxos->collect_timeout();
}
};
public:
C_AcceptTimeout(Paxos *p) : paxos(p) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
paxos->accept_timeout();
}
};
public:
C_LeaseAckTimeout(Paxos *p) : paxos(p) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
paxos->lease_ack_timeout();
}
};
public:
C_LeaseTimeout(Paxos *p) : paxos(p) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
paxos->lease_timeout();
}
};
public:
C_LeaseRenew(Paxos *p) : paxos(p) {}
void finish(int r) {
+ if (r == -ECANCELED)
+ return;
paxos->lease_renew_timeout();
}
};
* Cancel all of Paxos' timeout/renew events.
*/
void cancel_events();
+ /**
+ * Shutdown this Paxos machine
+ */
+ void shutdown();
/**
* Generate a new Proposal Number based on @p gt
void PaxosService::shutdown()
{
paxos->cancel_events();
+ paxos->shutdown();
if (proposal_timer) {
mon->timer.cancel_event(proposal_timer);
#include "messages/PaxosServiceMessage.h"
#include "include/Context.h"
+#include <errno.h>
class Monitor;
class Paxos;
public:
C_RetryMessage(PaxosService *s, PaxosServiceMessage *m_) : svc(s), m(m_) {}
void finish(int r) {
+ if (r == -ECANCELED) {
+ m->put();
+ return;
+ }
svc->dispatch(m);
}
};
PaxosService *ps;
public:
C_Propose(PaxosService *p) : ps(p) { }
- void finish(int r) {
+ void finish(int r) {
+ if (r == -ECANCELED)
+ return;
ps->proposal_timer = 0;
ps->propose_pending();
}