#include "common/Clock.h"
#include "common/config.h"
#include "include/stringify.h"
-#include "include/assert.h"
+#include "include/ceph_assert.h"
#include "mon/MonOpRequest.h"
#define dout_subsys ceph_subsys_paxos
bool PaxosService::dispatch(MonOpRequestRef op)
{
- assert(op->is_type_service() || op->is_type_command());
+ ceph_assert(op->is_type_service() || op->is_type_command());
PaxosServiceMessage *m = static_cast<PaxosServiceMessage*>(op->get_req());
op->mark_event("psvc:dispatch");
} else if (r == -ECANCELED || r == -EAGAIN) {
return;
} else {
- assert(0 == "bad return value for proposal_timer");
+ ceph_abort_msg("bad return value for proposal_timer");
}
});
dout(10) << " setting proposal_timer " << do_propose
delay = 0.0;
} else {
utime_t now = ceph_clock_now();
- if ((now - paxos->last_commit_time) > g_conf->paxos_propose_interval)
- delay = (double)g_conf->paxos_min_wait;
+ if ((now - paxos->last_commit_time) > g_conf()->paxos_propose_interval)
+ delay = (double)g_conf()->paxos_min_wait;
else
- delay = (double)(g_conf->paxos_propose_interval + paxos->last_commit_time
+ delay = (double)(g_conf()->paxos_propose_interval + paxos->last_commit_time
- now);
}
return true;
void PaxosService::propose_pending()
{
dout(10) << __func__ << dendl;
- assert(have_pending);
- assert(!proposing);
- assert(mon->is_leader());
- assert(is_active());
+ ceph_assert(have_pending);
+ ceph_assert(!proposing);
+ ceph_assert(mon->is_leader());
+ ceph_assert(is_active());
if (proposal_timer) {
dout(10) << " canceling proposal_timer " << proposal_timer << dendl;
else if (r == -ECANCELED || r == -EAGAIN)
return;
else
- assert(0 == "bad return value for C_Committed");
+ ceph_abort_msg("bad return value for C_Committed");
}
};
paxos->queue_pending_finisher(new C_Committed(this));
*/
return (!latest_full ||
(latest_full <= get_trim_to()) ||
- (get_last_committed() - latest_full > (version_t)g_conf->paxos_stash_full_interval));
+ (get_last_committed() - latest_full > (version_t)g_conf()->paxos_stash_full_interval));
}
void PaxosService::restart()
return;
}
} else {
- if (!mon->is_leader()) {
- dout(7) << __func__ << " we are not the leader, hence we propose nothing!" << dendl;
- }
+ dout(7) << __func__ << " we are not the leader, hence we propose nothing!" << dendl;
}
// wake up anyone who came in while we were proposing. note that
return;
version_t to_remove = trim_to - get_first_committed();
- if (g_conf->paxos_service_trim_min > 0 &&
- to_remove < (version_t)g_conf->paxos_service_trim_min) {
+ if (g_conf()->paxos_service_trim_min > 0 &&
+ to_remove < (version_t)g_conf()->paxos_service_trim_min) {
dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove
- << " < paxos_service_trim_min " << g_conf->paxos_service_trim_min << dendl;
+ << " < paxos_service_trim_min " << g_conf()->paxos_service_trim_min << dendl;
return;
}
- if (g_conf->paxos_service_trim_max > 0 &&
- to_remove > (version_t)g_conf->paxos_service_trim_max) {
+ if (g_conf()->paxos_service_trim_max > 0 &&
+ to_remove > (version_t)g_conf()->paxos_service_trim_max) {
dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove
- << " > paxos_service_trim_max, limiting to " << g_conf->paxos_service_trim_max
+ << " > paxos_service_trim_max, limiting to " << g_conf()->paxos_service_trim_max
<< dendl;
- trim_to = get_first_committed() + g_conf->paxos_service_trim_max;
- to_remove = g_conf->paxos_service_trim_max;
+ trim_to = get_first_committed() + g_conf()->paxos_service_trim_max;
+ to_remove = g_conf()->paxos_service_trim_max;
}
dout(10) << __func__ << " trimming to " << trim_to << ", " << to_remove << " states" << dendl;
version_t from, version_t to)
{
dout(10) << __func__ << " from " << from << " to " << to << dendl;
- assert(from != to);
+ ceph_assert(from != to);
for (version_t v = from; v < to; ++v) {
dout(20) << __func__ << " " << v << dendl;
t->erase(get_service_name(), full_key);
}
}
- if (g_conf->mon_compact_on_trim) {
+ if (g_conf()->mon_compact_on_trim) {
dout(20) << " compacting prefix " << get_service_name() << dendl;
t->compact_range(get_service_name(), stringify(from - 1), stringify(to));
t->compact_range(get_service_name(),
bufferlist bl;
mon->store->get("health", service_name, bl);
if (bl.length()) {
- auto p = bl.begin();
- ::decode(health_checks, p);
+ auto p = bl.cbegin();
+ decode(health_checks, p);
}
}