version_t latest_ver = store.get("monmap", "last_committed");
if (store.exists("monmap", latest_ver)) {
int err = store.get("monmap", latest_ver, bl);
- assert(err == 0);
- assert(bl.length() > 0);
+ ceph_assert(err == 0);
+ ceph_assert(bl.length() > 0);
dout(10) << __func__ << " read last committed monmap ver "
<< latest_ver << dendl;
return 0;
dout(10) << __func__ << " detected aborted sync" << dendl;
if (store.exists("mon_sync", "latest_monmap")) {
int err = store.get("mon_sync", "latest_monmap", bl);
- assert(err == 0);
- assert(bl.length() > 0);
+ ceph_assert(err == 0);
+ ceph_assert(bl.length() > 0);
dout(10) << __func__ << " read backup monmap" << dendl;
return 0;
}
if (store.exists("mkfs", "monmap")) {
dout(10) << __func__ << " found mkfs monmap" << dendl;
int err = store.get("mkfs", "monmap", bl);
- assert(err == 0);
- assert(bl.length() > 0);
+ ceph_assert(err == 0);
+ ceph_assert(bl.length() > 0);
return 0;
}
<< g_conf()->mon_data << "': " << cpp_strerror(r) << dendl;
exit(1);
}
- assert(r == 0);
+ ceph_assert(r == 0);
Monitor mon(g_ceph_context, g_conf()->name.get_id(), &store, 0, 0, &monmap);
r = mon.mkfs(osdmapbl);
void AuthMonitor::get_initial_keyring(KeyRing *keyring)
{
dout(10) << __func__ << dendl;
- assert(keyring != nullptr);
+ ceph_assert(keyring != nullptr);
bufferlist bl;
int ret = mon->store->get("mkfs", "keyring", bl);
return;
}
// fail hard only if there's an error we're not expecting to see
- assert(ret == 0);
+ ceph_assert(ret == 0);
auto p = bl.cbegin();
decode(*keyring, p);
void _generate_bootstrap_keys(
list<pair<EntityName,EntityAuth> >* auth_lst)
{
- assert(auth_lst != nullptr);
+ ceph_assert(auth_lst != nullptr);
map<string,map<string,bufferlist> > bootstrap = {
{ "admin", {
void AuthMonitor::create_initial_keys(KeyRing *keyring)
{
dout(10) << __func__ << " with keyring" << dendl;
- assert(keyring != nullptr);
+ ceph_assert(keyring != nullptr);
list<pair<EntityName,EntityAuth> > auth_lst;
_generate_bootstrap_keys(&auth_lst);
// initialize rotating keys
last_rotating_ver = 0;
check_rotate();
- assert(pending_auth.size() == 1);
+ ceph_assert(pending_auth.size() == 1);
if (mon->is_keyring_required()) {
KeyRing keyring;
version_t keys_ver = mon->key_server.get_ver();
if (version == keys_ver)
return;
- assert(version > keys_ver);
+ ceph_assert(version > keys_ver);
version_t latest_full = get_version_latest_full();
if ((latest_full > 0) && (latest_full > keys_ver)) {
bufferlist latest_bl;
int err = get_version_full(latest_full, latest_bl);
- assert(err == 0);
- assert(latest_bl.length() != 0);
+ ceph_assert(err == 0);
+ ceph_assert(latest_bl.length() != 0);
dout(7) << __func__ << " loading summary e " << latest_full << dendl;
dout(7) << __func__ << " latest length " << latest_bl.length() << dendl;
auto p = latest_bl.cbegin();
while (version > keys_ver) {
bufferlist bl;
int ret = get_version(keys_ver+1, bl);
- assert(ret == 0);
- assert(bl.length());
+ ceph_assert(ret == 0);
+ ceph_assert(bl.length());
// reset if we are moving to initial state. we will normally have
// keys in here temporarily for bootstrapping that we need to
void AuthMonitor::increase_max_global_id()
{
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
max_global_id += g_conf()->mon_globalid_prealloc;
dout(10) << "increasing max_global_id to " << max_global_id << dendl;
return;
dout(10) << __func__ << " auth v " << version << dendl;
- assert(get_last_committed() == version);
+ ceph_assert(get_last_committed() == version);
bufferlist full_bl;
Mutex::Locker l(mon->key_server.get_lock());
return true;
}
- assert(!paxos_writable);
+ ceph_assert(!paxos_writable);
return false;
}
}
return -EINVAL;
}
int err = add_entity(p->first, p->second);
- assert(err == 0);
+ ceph_assert(err == 0);
}
return 0;
}
EntityName& lockbox_entity,
stringstream& ss)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
dout(10) << __func__ << " id " << id << " uuid " << uuid << dendl;
const EntityName& cephx_entity,
const EntityName& lockbox_entity)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
dout(10) << __func__ << " cephx " << cephx_entity
<< " lockbox " << lockbox_entity << dendl;
}
int err = _create_auth(cephx_entity.auth, cephx_secret, cephx_caps);
- assert(0 == err);
+ ceph_assert(0 == err);
bool cephx_is_idempotent = false, lockbox_is_idempotent = false;
err = exists_and_matches_entity(cephx_entity, true, ss);
if (err < 0) {
return err;
}
- assert(0 == err);
+ ceph_assert(0 == err);
cephx_is_idempotent = true;
}
if (has_lockbox) {
err = _create_auth(lockbox_entity.auth, lockbox_secret, lockbox_caps);
- assert(err == 0);
+ ceph_assert(err == 0);
err = exists_and_matches_entity(lockbox_entity, true, ss);
if (err != -ENOENT) {
if (err < 0) {
return err;
}
- assert(0 == err);
+ ceph_assert(0 == err);
lockbox_is_idempotent = true;
}
}
const auth_entity_t& lockbox_entity,
bool has_lockbox)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
dout(10) << __func__ << " cephx " << cephx_entity.name
<< " lockbox ";
if (!cephx_exists) {
int err = add_entity(cephx_entity.name, cephx_entity.auth);
- assert(0 == err);
+ ceph_assert(0 == err);
}
if (has_lockbox &&
!mon->key_server.contains(lockbox_entity.name)) {
int err = add_entity(lockbox_entity.name, lockbox_entity.auth);
- assert(0 == err);
+ ceph_assert(0 == err);
}
// given we have paxos plugged, this will not result in a proposal
goto done;
}
// no-op.
- assert(err == 0);
+ ceph_assert(err == 0);
goto done;
}
err = 0;
new_inc.caps = new_caps;
err = add_entity(auth_inc.name, new_inc);
- assert(err == 0);
+ ceph_assert(err == 0);
ss << "added key for " << auth_inc.name;
getline(ss, rs);
bool AuthMonitor::_upgrade_format_to_dumpling()
{
dout(1) << __func__ << " upgrading from format 0 to 1" << dendl;
- assert(format_version == 0);
+ ceph_assert(format_version == 0);
bool changed = false;
map<EntityName, EntityAuth>::iterator p;
bool AuthMonitor::_upgrade_format_to_luminous()
{
dout(1) << __func__ << " upgrading from format 1 to 2" << dendl;
- assert(format_version == 1);
+ ceph_assert(format_version == 1);
bool changed = false;
map<EntityName, EntityAuth>::iterator p;
// ceph-create-keys)
EntityName bootstrap_mgr_name;
int r = bootstrap_mgr_name.from_str("client.bootstrap-mgr");
- assert(r);
+ ceph_assert(r);
if (!mon->key_server.contains(bootstrap_mgr_name)) {
EntityName name = bootstrap_mgr_name;
bool AuthMonitor::_upgrade_format_to_mimic()
{
dout(1) << __func__ << " upgrading from format 2 to 3" << dendl;
- assert(format_version == 2);
+ ceph_assert(format_version == 2);
list<pair<EntityName,EntityAuth> > auth_lst;
_generate_bootstrap_keys(&auth_lst);
continue;
}
int err = add_entity(p.first, p.second);
- assert(err == 0);
+ ceph_assert(err == 0);
changed = true;
}
__u32 _type;
decode(_type, bl);
inc_type = (IncType)_type;
- assert(inc_type >= GLOBAL_ID && inc_type <= AUTH_DATA);
+ ceph_assert(inc_type >= GLOBAL_ID && inc_type <= AUTH_DATA);
if (_type == GLOBAL_ID) {
decode(max_global_id, bl);
} else {
#include "common/errno.h"
#include "include/stringify.h"
-#include "include/assert.h" // re-clobber assert()
+#include "include/assert.h" // re-clobber ceph_assert()
#define dout_subsys ceph_subsys_mon
#undef dout_prefix
#define dout_prefix _prefix(_dout, mon, this)
bool ConfigKeyService::service_dispatch(MonOpRequestRef op)
{
Message *m = op->get_req();
- assert(m != NULL);
+ ceph_assert(m != NULL);
dout(10) << __func__ << " " << *m << dendl;
if (!in_quorum()) {
return false;
}
- assert(m->get_type() == MSG_MON_COMMAND);
+ ceph_assert(m->get_type() == MSG_MON_COMMAND);
MMonCommand *cmd = static_cast<MMonCommand*>(m);
- assert(!cmd->cmd.empty());
+ ceph_assert(!cmd->cmd.empty());
int ret = 0;
stringstream ss;
if (prefix == "config-key get") {
ret = store_get(key, rdata);
if (ret < 0) {
- assert(!rdata.length());
+ ceph_assert(!rdata.length());
ss << "error obtaining '" << key << "': " << cpp_strerror(ret);
goto out;
}
const uuid_d& uuid,
const string& dmcrypt_key)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
string dmcrypt_key_prefix = _get_dmcrypt_prefix(uuid, "luks");
bufferlist dmcrypt_key_value;
err = 0;
goto reply;
}
- assert(num > 0);
- assert((version_t)num < version);
+ ceph_assert(num > 0);
+ ceph_assert((version_t)num < version);
for (int64_t v = version; v > num; --v) {
ConfigChangeSet ch;
load_changeset(v, &ch);
void Elector::bump_epoch(epoch_t e)
{
dout(10) << "bump_epoch " << epoch << " to " << e << dendl;
- assert(epoch <= e);
+ ceph_assert(epoch <= e);
epoch = e;
auto t(std::make_shared<MonitorDBStore::Transaction>());
t->put(Monitor::MONITOR_NAME, "election_epoch", epoch);
auto t(std::make_shared<MonitorDBStore::Transaction>());
t->put(Monitor::MONITOR_NAME, "election_writeable_test", rand());
int r = mon->store->apply_transaction(t);
- assert(r >= 0);
+ ceph_assert(r >= 0);
}
electing_me = true;
acked_me[mon->rank].cluster_features = CEPH_FEATURES_ALL;
cancel_timer();
- assert(epoch % 2 == 1); // election
+ ceph_assert(epoch % 2 == 1); // election
bump_epoch(epoch+1); // is over!
// tell everyone!
dout(5) << "handle_propose from " << m->get_source() << dendl;
int from = m->get_source().num();
- assert(m->epoch % 2 == 1); // election
+ ceph_assert(m->epoch % 2 == 1); // election
uint64_t required_features = mon->get_required_features();
mon_feature_t required_mon_features = mon->get_required_mon_features();
if (mon->rank < from) {
// i would win over them.
if (leader_acked >= 0) { // we already acked someone
- assert(leader_acked < from); // and they still win, of course
+ ceph_assert(leader_acked < from); // and they still win, of course
dout(5) << "no, we already acked " << leader_acked << dendl;
} else {
// wait, i should win!
dout(5) << "handle_ack from " << m->get_source() << dendl;
int from = m->get_source().num();
- assert(m->epoch % 2 == 1); // election
+ ceph_assert(m->epoch % 2 == 1); // election
if (m->epoch > epoch) {
dout(5) << "woah, that's a newer epoch, i must have rebooted. bumping and re-starting!" << dendl;
bump_epoch(m->epoch);
start();
return;
}
- assert(m->epoch == epoch);
+ ceph_assert(m->epoch == epoch);
uint64_t required_features = mon->get_required_features();
if ((required_features ^ m->get_connection()->get_features()) &
required_features) {
}
} else {
// ignore, i'm deferring already.
- assert(leader_acked >= 0);
+ ceph_assert(leader_acked >= 0);
}
}
<< dendl;
int from = m->get_source().num();
- assert(from < mon->rank);
- assert(m->epoch % 2 == 0);
+ ceph_assert(from < mon->rank);
+ ceph_assert(m->epoch % 2 == 0);
leader_acked = -1;
cancel_timer();
// stash leader's commands
- assert(m->sharing_bl.length());
+ ceph_assert(m->sharing_bl.length());
vector<MonCommand> new_cmds;
auto bi = m->sharing_bl.cbegin();
MonCommand::decode_vector(new_cmds, bi);
void Elector::dispatch(MonOpRequestRef op)
{
op->mark_event("elector:dispatch");
- assert(op->is_type_election());
+ ceph_assert(op->is_type_election());
switch (op->get_req()->get_type()) {
const cmdmap_t& cmdmap,
std::stringstream &ss) override
{
- assert(m_paxos->is_plugged());
+ ceph_assert(m_paxos->is_plugged());
string metadata_name;
cmd_getval_throws(g_ceph_context, cmdmap, "metadata", metadata_name);
}
pg_pool_t const *data_pool = mon->osdmon()->osdmap.get_pg_pool(data);
- assert(data_pool != NULL); // Checked it existed above
+ ceph_assert(data_pool != NULL); // Checked it existed above
pg_pool_t const *metadata_pool = mon->osdmon()->osdmap.get_pg_pool(metadata);
- assert(metadata_pool != NULL); // Checked it existed above
+ ceph_assert(metadata_pool != NULL); // Checked it existed above
int r = _check_pool(mon->osdmon()->osdmap, data, false, force, &ss);
if (r < 0) {
const cmdmap_t& cmdmap,
std::stringstream &ss) override
{
- assert(m_paxos->is_plugged());
+ ceph_assert(m_paxos->is_plugged());
string poolname;
cmd_getval_throws(g_ceph_context, cmdmap, "pool", poolname);
std::vector<mds_gid_t> to_fail;
// There may be standby_replay daemons left here
for (const auto &i : fs->mds_map.get_mds_info()) {
- assert(i.second.state == MDSMap::STATE_STANDBY_REPLAY);
+ ceph_assert(i.second.state == MDSMap::STATE_STANDBY_REPLAY);
to_fail.push_back(i.first);
}
}
}
- assert(poolid >= 0); // Checked by parsing code above
+ ceph_assert(poolid >= 0); // Checked by parsing code above
if (fs->mds_map.get_first_data_pool() == poolid) {
ss << "cannot remove default data pool";
bool *result,
std::ostream &ss)
{
- assert(result != nullptr);
+ ceph_assert(result != nullptr);
string interr;
int64_t n = strict_strtoll(bool_str.c_str(), 10, &interr);
bool force,
std::stringstream *ss) const
{
- assert(ss != NULL);
+ ceph_assert(ss != NULL);
const pg_pool_t *pool = osd_map.get_pg_pool(pool_id);
if (!pool) {
// write operations like modify+truncate we care about support for)
const pg_pool_t *write_tier = osd_map.get_pg_pool(
pool->write_tier);
- assert(write_tier != NULL); // OSDMonitor shouldn't allow DNE tier
+ ceph_assert(write_tier != NULL); // OSDMonitor shouldn't allow DNE tier
if (write_tier->cache_mode == pg_pool_t::CACHEMODE_FORWARD
|| write_tier->cache_mode == pg_pool_t::CACHEMODE_READONLY) {
*ss << "EC pool '" << pool_name << "' has a write tier ("
get_fs_stats(stats.fs_stats, g_conf()->mon_data.c_str());
map<string,uint64_t> extra;
uint64_t store_size = mon->store->get_estimated_size(extra);
- assert(store_size > 0);
+ ceph_assert(store_size > 0);
stats.store_stats.bytes_total = store_size;
stats.store_stats.bytes_sst = extra["sst"];
stats.store_stats.bytes_log = extra["log"];
<< " summary v " << summary.version << dendl;
if (version == summary.version)
return;
- assert(version >= summary.version);
+ ceph_assert(version >= summary.version);
map<string,bufferlist> channel_blog;
if ((latest_full > 0) && (latest_full > summary.version)) {
bufferlist latest_bl;
get_version_full(latest_full, latest_bl);
- assert(latest_bl.length() != 0);
+ ceph_assert(latest_bl.length() != 0);
dout(7) << __func__ << " loading summary e" << latest_full << dendl;
auto p = latest_bl.cbegin();
decode(summary, p);
while (version > summary.version) {
bufferlist bl;
int err = get_version(summary.version+1, bl);
- assert(err == 0);
- assert(bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(bl.length());
auto p = bl.cbegin();
__u8 v;
void LogMonitor::encode_full(MonitorDBStore::TransactionRef t)
{
dout(10) << __func__ << " log v " << summary.version << dendl;
- assert(get_last_committed() == summary.version);
+ ceph_assert(get_last_committed() == summary.version);
bufferlist summary_bl;
encode(summary, summary_bl, mon->get_quorum_con_features());
dout(10) << __func__ << " client wants " << s->type << " ver " << s->next << dendl;
int sub_level = sub_name_to_id(s->type);
- assert(sub_level >= 0);
+ ceph_assert(sub_level >= 0);
version_t summary_version = summary.version;
if (s->next > summary_version) {
while (sv && sv <= summary_ver) {
bufferlist bl;
int err = get_version(sv, bl);
- assert(err == 0);
- assert(bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(bl.length());
auto p = bl.cbegin();
__u8 v;
decode(v,p);
dout(10) << __func__ << " version " << version
<< ", my e " << get_fsmap().epoch << dendl;
- assert(version > get_fsmap().epoch);
+ ceph_assert(version > get_fsmap().epoch);
load_health();
bufferlist fsmap_bl;
fsmap_bl.clear();
int err = get_version(version, fsmap_bl);
- assert(err == 0);
+ ceph_assert(err == 0);
- assert(fsmap_bl.length() > 0);
+ ceph_assert(fsmap_bl.length() > 0);
dout(10) << __func__ << " got " << version << dendl;
PaxosFSMap::decode(fsmap_bl);
}
// apply to paxos
- assert(get_last_committed() + 1 == pending.epoch);
+ ceph_assert(get_last_committed() + 1 == pending.epoch);
bufferlist pending_bl;
pending.encode(pending_bl, mon->get_quorum_con_features());
reply:
// note time and reply
- assert(effective_epoch > 0);
+ ceph_assert(effective_epoch > 0);
_note_beacon(m);
{
auto beacon = MMDSBeacon::create(mon->monmap->fsid,
failed_mds = true;
}
if (failed_mds) {
- assert(mon->osdmon()->is_writeable());
+ ceph_assert(mon->osdmon()->is_writeable());
request_proposal(mon->osdmon());
}
}
}
fail_mds_gid(pending, gid);
- assert(mon->osdmon()->is_writeable());
+ ceph_assert(mon->osdmon()->is_writeable());
request_proposal(mon->osdmon());
// Respond to MDS, so that it knows it can continue to shut down
r = -ENOENT;
goto out;
} else {
- assert(err == 0);
- assert(b.length());
+ ceph_assert(err == 0);
+ ceph_assert(b.length());
dummy.decode(b);
fsmapp = &dummy;
}
if (r == 0) {
// See if a GID is assigned to this role
const auto &fs = fsmap.get_filesystem(role.fscid);
- assert(fs != nullptr); // parse_role ensures it exists
+ ceph_assert(fs != nullptr); // parse_role ensures it exists
if (fs->mds_map.is_up(role.rank)) {
dout(10) << __func__ << ": validated rank/GID " << role
<< " as a rank" << dendl;
int MDSMonitor::fail_mds(FSMap &fsmap, std::ostream &ss,
const std::string &arg, MDSMap::mds_info_t *failed_info)
{
- assert(failed_info != nullptr);
+ ceph_assert(failed_info != nullptr);
mds_gid_t gid = gid_from_arg(fsmap, arg, ss);
if (gid == MDS_GID_NONE) {
fail_mds_gid(fsmap, gid);
ss << "failed mds gid " << gid;
- assert(mon->osdmon()->is_writeable());
+ ceph_assert(mon->osdmon()->is_writeable());
request_proposal(mon->osdmon());
return 0;
}
null_map.compat = fsmap.compat;
if (fscid == FS_CLUSTER_ID_NONE) {
// For a client, we should have already dropped out
- assert(is_mds);
+ ceph_assert(is_mds);
auto it = fsmap.standby_daemons.find(mds_gid);
if (it != fsmap.standby_daemons.end()) {
mds_map = &fsmap.get_filesystem(fscid)->mds_map;
}
- assert(mds_map != nullptr);
+ ceph_assert(mds_map != nullptr);
dout(10) << __func__ << " selected MDS map epoch " <<
mds_map->epoch << " for namespace " << fscid << " for subscriber "
<< sub->session->name << " who wants epoch " << sub->next << dendl;
int MDSMonitor::dump_metadata(const FSMap& fsmap, const std::string &who,
Formatter *f, ostream& err)
{
- assert(f);
+ ceph_assert(f);
mds_gid_t gid = gid_from_arg(fsmap, who, err);
if (gid == MDS_GID_NONE) {
int MDSMonitor::print_nodes(Formatter *f)
{
- assert(f);
+ ceph_assert(f);
const auto &fsmap = get_fsmap();
void MDSMonitor::maybe_replace_gid(FSMap &fsmap, mds_gid_t gid,
const MDSMap::mds_info_t& info, bool *mds_propose, bool *osd_propose)
{
- assert(mds_propose != nullptr);
- assert(osd_propose != nullptr);
+ ceph_assert(mds_propose != nullptr);
+ ceph_assert(osd_propose != nullptr);
const auto fscid = fsmap.mds_roles.at(gid);
for (const auto &gid : standby_gids) {
const auto &info = fsmap.standby_daemons.at(gid);
- assert(info.state == MDSMap::STATE_STANDBY);
+ ceph_assert(info.state == MDSMap::STATE_STANDBY);
if (!info.standby_replay) {
continue;
void print_summary(Formatter *f, std::ostream *ss) const
{
// One or the other, not both
- assert((ss != nullptr) != (f != nullptr));
+ ceph_assert((ss != nullptr) != (f != nullptr));
if (f) {
dump(f);
} else {
bufferlist bl;
int err = get_version(version, bl);
- assert(err == 0);
+ ceph_assert(err == 0);
bool old_available = map.get_available();
uint64_t old_gid = map.get_active_gid();
prev_health_checks.resize(mon->paxos_service.size());
send = true;
}
- assert(prev_health_checks.size() == mon->paxos_service.size());
+ ceph_assert(prev_health_checks.size() == mon->paxos_service.size());
for (auto i = 0u; i < prev_health_checks.size(); i++) {
const auto& curr = mon->paxos_service[i]->get_health_checks();
if (!send && curr != prev_health_checks[i]) {
}
}
} else {
- assert(sub->type == "mgrdigest");
+ ceph_assert(sub->type == "mgrdigest");
if (sub->next == 0) {
// new registration; cancel previous timer
cancel_timer();
bool MgrMonitor::promote_standby()
{
- assert(pending_map.active_gid == 0);
+ ceph_assert(pending_map.active_gid == 0);
if (pending_map.standbys.size()) {
// Promote a replacement (arbitrary choice of standby)
auto replacement_gid = pending_map.standbys.begin()->first;
void MgrMonitor::print_nodes(Formatter *f) const
{
- assert(f);
+ ceph_assert(f);
std::map<string, list<string> > mgrs; // hostname => mgr
auto ls = map.get_all_names();
bufferlist bl;
get_version(version, bl);
if (version) {
- assert(bl.length());
+ ceph_assert(bl.length());
try {
auto p = bl.cbegin();
decode(digest, p);
dout(10) << " " << version << dendl;
bufferlist bl;
encode(pending_digest, bl, mon->get_quorum_con_features());
- assert(pending_service_map_bl.length());
+ ceph_assert(pending_service_map_bl.length());
bl.append(pending_service_map_bl);
put_version(t, version, bl);
put_last_committed(t, version);
int MonClient::get_monmap_and_config()
{
ldout(cct, 10) << __func__ << dendl;
- assert(!messenger);
+ ceph_assert(!messenger);
int tries = 10;
messenger = Messenger::create_client_messenger(
cct, "temp_mon_client");
- assert(messenger);
+ ceph_assert(messenger);
messenger->add_dispatcher_head(this);
messenger->start();
ldout(cct, 5) << __func__ << " success, global_id "
<< active_con->get_global_id() << dendl;
// active_con should not have been set if there was an error
- assert(authenticate_err == 0);
+ ceph_assert(authenticate_err == 0);
authenticated = true;
}
void MonClient::handle_auth(MAuthReply *m)
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
if (!_hunting()) {
std::swap(active_con->get_auth(), auth);
int ret = active_con->authenticate(m);
// hunting
auto found = _find_pending_con(m->get_connection());
- assert(found != pending_cons.end());
+ ceph_assert(found != pending_cons.end());
int auth_err = found->second.handle_auth(m, entity_name, want_keys,
rotating_secrets.get());
m->put();
// the last try just failed, give up.
} else {
auto& mc = found->second;
- assert(mc.have_session());
+ ceph_assert(mc.have_session());
active_con.reset(new MonConnection(std::move(mc)));
pending_cons.clear();
}
// _resend_mon_commands() could _reopen_session() if the connected mon is not
// the one the MonCommand is targeting.
if (!auth_err && active_con) {
- assert(auth);
+ ceph_assert(auth);
_check_auth_tickets();
}
auth_cond.SignalAll();
void MonClient::_send_mon_message(Message *m)
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
if (active_con) {
auto cur_con = active_con->get_con();
ldout(cct, 10) << "_send_mon_message to mon."
void MonClient::_reopen_session(int rank)
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
ldout(cct, 10) << __func__ << " rank " << rank << dendl;
active_con.reset();
bool MonClient::_opened() const
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
return active_con || _hunting();
}
void MonClient::_start_hunting()
{
- assert(!_hunting());
+ ceph_assert(!_hunting());
// adjust timeouts if necessary
if (!had_a_connection)
return;
void MonClient::_finish_hunting()
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
// the pending conns have been cleaned.
- assert(!_hunting());
+ ceph_assert(!_hunting());
if (active_con) {
auto con = active_con->get_con();
ldout(cct, 1) << "found mon."
void MonClient::_renew_subs()
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
if (!sub.have_new()) {
ldout(cct, 10) << __func__ << " - empty" << dendl;
return;
int MonClient::_check_auth_tickets()
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
if (active_con && auth) {
if (auth->need_tickets()) {
ldout(cct, 10) << __func__ << " getting new tickets!" << dendl;
int MonClient::_check_auth_rotating()
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
if (!rotating_secrets ||
!auth_principal_needs_rotating_keys(entity_name)) {
ldout(cct, 20) << "_check_auth_rotating not needed by " << entity_name << dendl;
until += timeout;
// Must be initialized
- assert(auth != nullptr);
+ ceph_assert(auth != nullptr);
if (auth->get_protocol() == CEPH_AUTH_NONE)
return 0;
int MonClient::_cancel_mon_command(uint64_t tid)
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
map<ceph_tid_t, MonCommand*>::iterator it = mon_commands.find(tid);
if (it == mon_commands.end()) {
void MonClient::handle_get_version_reply(MMonGetVersionReply* m)
{
- assert(monc_lock.is_locked());
+ ceph_assert(monc_lock.is_locked());
map<ceph_tid_t, version_req_d*>::iterator iter = version_requests.find(m->handle);
if (iter == version_requests.end()) {
ldout(cct, 0) << __func__ << " version request with handle " << m->handle
int MonConnection::authenticate(MAuthReply *m)
{
- assert(auth);
+ ceph_assert(auth);
if (!m->global_id) {
ldout(cct, 1) << "peer sent an invalid global_id" << dendl;
}
}
void MonClient::register_config_callback(md_config_t::config_callback fn) {
- assert(!config_cb);
+ ceph_assert(!config_cb);
config_cb = fn;
}
if (removed)
removed->insert(get_addr(i));
remove(n);
- assert(!contains(n));
+ ceph_assert(!contains(n));
}
// add missing initial members
lgeneric_dout(cct, 1) << " adding " << *p << " " << a << dendl;
add(*p, a);
}
- assert(contains(*p));
+ ceph_assert(contains(*p));
}
}
calc_legacy_ranks();
* @param m monitor info of the new monitor
*/
void add(const mon_info_t& m) {
- assert(mon_info.count(m.name) == 0);
- assert(addr_mons.count(m.public_addr) == 0);
+ ceph_assert(mon_info.count(m.name) == 0);
+ ceph_assert(addr_mons.count(m.public_addr) == 0);
mon_info[m.name] = m;
if (get_required_features().contains_all(
ceph::features::mon::FEATURE_NAUTILUS)) {
ranks.push_back(m.name);
- assert(ranks.size() == mon_info.size());
+ ceph_assert(ranks.size() == mon_info.size());
} else {
calc_legacy_ranks();
}
* @param name Monitor name (i.e., 'foo' in 'mon.foo')
*/
void remove(const string &name) {
- assert(mon_info.count(name));
+ ceph_assert(mon_info.count(name));
mon_info.erase(name);
- assert(mon_info.count(name) == 0);
+ ceph_assert(mon_info.count(name) == 0);
if (get_required_features().contains_all(
ceph::features::mon::FEATURE_NAUTILUS)) {
ranks.erase(std::find(ranks.begin(), ranks.end(), name));
- assert(ranks.size() == mon_info.size());
+ ceph_assert(ranks.size() == mon_info.size());
} else {
calc_legacy_ranks();
}
* @param newname monitor's new name (i.e., 'bar' in 'mon.bar')
*/
void rename(string oldname, string newname) {
- assert(contains(oldname));
- assert(!contains(newname));
+ ceph_assert(contains(oldname));
+ ceph_assert(!contains(newname));
mon_info[newname] = mon_info[oldname];
mon_info.erase(oldname);
mon_info[newname].name = newname;
if (get_required_features().contains_all(
ceph::features::mon::FEATURE_NAUTILUS)) {
*std::find(ranks.begin(), ranks.end(), oldname) = newname;
- assert(ranks.size() == mon_info.size());
+ ceph_assert(ranks.size() == mon_info.size());
} else {
calc_legacy_ranks();
}
}
string get_name(unsigned n) const {
- assert(n < ranks.size());
+ ceph_assert(n < ranks.size());
return ranks[n];
}
string get_name(const entity_addr_t& a) const {
}
const entity_addr_t& get_addr(const string& n) const {
- assert(mon_info.count(n));
+ ceph_assert(mon_info.count(n));
map<string,mon_info_t>::const_iterator p = mon_info.find(n);
return p->second.public_addr;
}
const entity_addr_t& get_addr(unsigned m) const {
- assert(m < ranks.size());
+ ceph_assert(m < ranks.size());
return get_addr(ranks[m]);
}
void set_addr(const string& n, const entity_addr_t& a) {
- assert(mon_info.count(n));
+ ceph_assert(mon_info.count(n));
mon_info[n].public_addr = a;
}
config_key_service = new ConfigKeyService(this, paxos);
bool r = mon_caps.parse("allow *", NULL);
- assert(r);
+ ceph_assert(r);
exited_quorum = ceph_clock_now();
paxos_service.clear();
delete config_key_service;
delete paxos;
- assert(session_map.sessions.empty());
+ ceph_assert(session_map.sessions.empty());
}
please enable \"mon_enable_op_tracker\", and the tracker will start to track new ops received afterwards.";
}
} else {
- assert(0 == "bad AdminSocket command binding");
+ ceph_assert(0 == "bad AdminSocket command binding");
}
(read_only ? audit_clog->debug() : audit_clog->info())
<< "from='admin socket' "
void Monitor::handle_signal(int signum)
{
- assert(signum == SIGINT || signum == SIGTERM);
+ ceph_assert(signum == SIGINT || signum == SIGTERM);
derr << "*** Got Signal " << sig_str(signum) << " ***" << dendl;
shutdown();
}
return r;
}
- assert(!logger);
+ ceph_assert(!logger);
{
PerfCountersBuilder pcb(g_ceph_context, "mon", l_mon_first, l_mon_last);
pcb.add_u64(l_mon_num_sessions, "num_sessions", "Open sessions", "sess",
cct->get_perfcounters_collection()->add(logger);
}
- assert(!cluster_logger);
+ ceph_assert(!cluster_logger);
{
PerfCountersBuilder pcb(g_ceph_context, "cluster", l_cluster_first, l_cluster_last);
pcb.add_u64(l_cluster_num_mon, "num_mon", "Monitors");
lock.Unlock();
r = admin_socket->register_command("mon_status", "mon_status", admin_hook,
"show current monitor status");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("quorum_status", "quorum_status",
admin_hook, "show current quorum status");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("sync_force",
"sync_force name=validate,"
"type=CephChoices,"
"strings=--yes-i-really-mean-it",
admin_hook,
"force sync of and clear monitor store");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("add_bootstrap_peer_hint",
"add_bootstrap_peer_hint name=addr,"
"type=CephIPAddr",
admin_hook,
"add peer address as potential bootstrap"
" peer for cluster bringup");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("quorum enter", "quorum enter",
admin_hook,
"force monitor back into quorum");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("quorum exit", "quorum exit",
admin_hook,
"force monitor out of the quorum");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("ops",
"ops",
admin_hook,
"show the ops currently in flight");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("sessions",
"sessions",
admin_hook,
"list existing sessions");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("dump_historic_ops", "dump_historic_ops",
admin_hook,
"show recent ops");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("dump_historic_ops_by_duration", "dump_historic_ops_by_duration",
admin_hook,
"show recent ops, sorted by duration");
- assert(r == 0);
+ ceph_assert(r == 0);
r = admin_socket->register_command("dump_historic_slow_ops", "dump_historic_slow_ops",
admin_hook,
"show recent slow ops");
- assert(r == 0);
+ ceph_assert(r == 0);
lock.Lock();
svc->get_store_prefixes(targets);
}
ConfigKeyService *config_key_service_ptr = dynamic_cast<ConfigKeyService*>(config_key_service);
- assert(config_key_service_ptr);
+ ceph_assert(config_key_service_ptr);
config_key_service_ptr->get_store_prefixes(targets);
return targets;
}
void Monitor::sync_timeout()
{
dout(10) << __func__ << dendl;
- assert(state == STATE_SYNCHRONIZING);
+ ceph_assert(state == STATE_SYNCHRONIZING);
bootstrap();
}
derr << __func__
<< " something wrong happened while reading the store: "
<< cpp_strerror(err) << dendl;
- assert(0 == "error reading the store");
+ ceph_assert(0 == "error reading the store");
}
} else {
latest_monmap.decode(monmon_bl);
derr << __func__
<< " something wrong happened while reading the store: "
<< cpp_strerror(err) << dendl;
- assert(0 == "error reading the store");
+ ceph_assert(0 == "error reading the store");
}
- assert(backup_bl.length() > 0);
+ ceph_assert(backup_bl.length() > 0);
MonMap backup_monmap;
backup_monmap.decode(backup_bl);
{
dout(10) << __func__ << " " << other << (full ? " full" : " recent") << dendl;
- assert(state == STATE_PROBING ||
+ ceph_assert(state == STATE_PROBING ||
state == STATE_SYNCHRONIZING);
state = STATE_SYNCHRONIZING;
store->apply_transaction(t);
- assert(g_conf()->mon_sync_requester_kill_at != 1);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 1);
// clear the underlying store
set<string> targets = get_sync_targets_names();
// deciding a partial or no sync is needed.
paxos->init();
- assert(g_conf()->mon_sync_requester_kill_at != 2);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 2);
}
// assume 'other' as the leader. We will update the leader once we receive
dout(10) << __func__ << dendl;
bufferlist backup_monmap;
sync_obtain_latest_monmap(backup_monmap);
- assert(backup_monmap.length() > 0);
+ ceph_assert(backup_monmap.length() > 0);
t->put("mon_sync", "latest_monmap", backup_monmap);
}
{
dout(10) << __func__ << " lc " << last_committed << " from " << sync_provider << dendl;
- assert(g_conf()->mon_sync_requester_kill_at != 7);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 7);
if (sync_full) {
// finalize the paxos commits
store->apply_transaction(tx);
}
- assert(g_conf()->mon_sync_requester_kill_at != 8);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 8);
auto t(std::make_shared<MonitorDBStore::Transaction>());
t->erase("mon_sync", "in_sync");
t->erase("mon_sync", "last_committed_floor");
store->apply_transaction(t);
- assert(g_conf()->mon_sync_requester_kill_at != 9);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 9);
init_paxos();
- assert(g_conf()->mon_sync_requester_kill_at != 10);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 10);
bootstrap();
}
default:
dout(0) << __func__ << " unknown op " << m->op << dendl;
- assert(0 == "unknown op");
+ ceph_assert(0 == "unknown op");
}
}
return;
}
- assert(g_conf()->mon_sync_provider_kill_at != 1);
+ ceph_assert(g_conf()->mon_sync_provider_kill_at != 1);
// make sure they can understand us.
if ((required_features ^ m->get_connection()->get_features()) &
// process instance. there is no need to be unique *across*
// monitors, though.
uint64_t cookie = ((unsigned long long)elector.get_epoch() << 24) + ++sync_provider_count;
- assert(sync_providers.count(cookie) == 0);
+ ceph_assert(sync_providers.count(cookie) == 0);
dout(10) << __func__ << " cookie " << cookie << " for " << m->get_source_inst() << dendl;
return;
}
- assert(g_conf()->mon_sync_provider_kill_at != 2);
+ ceph_assert(g_conf()->mon_sync_provider_kill_at != 2);
SyncProvider& sp = sync_providers[m->cookie];
sp.reset_timeout(g_ceph_context, g_conf()->mon_sync_timeout * 2);
sp.last_committed++;
int err = store->get(paxos->get_name(), sp.last_committed, bl);
- assert(err == 0);
+ ceph_assert(err == 0);
tx->put(paxos->get_name(), sp.last_committed, bl);
left -= bl.length();
<< " key " << sp.last_key << dendl;
reply->op = MMonSync::OP_LAST_CHUNK;
- assert(g_conf()->mon_sync_provider_kill_at != 3);
+ ceph_assert(g_conf()->mon_sync_provider_kill_at != 3);
// clean up our local state
sync_providers.erase(sp.cookie);
sync_reset_timeout();
sync_get_next_chunk();
- assert(g_conf()->mon_sync_requester_kill_at != 3);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 3);
}
void Monitor::sync_get_next_chunk()
MMonSync *r = new MMonSync(MMonSync::OP_GET_CHUNK, sync_cookie);
messenger->send_message(r, sync_provider);
- assert(g_conf()->mon_sync_requester_kill_at != 4);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 4);
}
void Monitor::handle_sync_chunk(MonOpRequestRef op)
return;
}
- assert(state == STATE_SYNCHRONIZING);
- assert(g_conf()->mon_sync_requester_kill_at != 5);
+ ceph_assert(state == STATE_SYNCHRONIZING);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 5);
auto tx(std::make_shared<MonitorDBStore::Transaction>());
tx->append_from_encoded(m->chunk_bl);
store->apply_transaction(tx);
- assert(g_conf()->mon_sync_requester_kill_at != 6);
+ ceph_assert(g_conf()->mon_sync_requester_kill_at != 6);
if (!sync_full) {
dout(10) << __func__ << " applying recent paxos transactions as we go" << dendl;
void Monitor::probe_timeout(int r)
{
dout(4) << "probe_timeout " << probe_timeout_event << dendl;
- assert(is_probing() || is_synchronizing());
- assert(probe_timeout_event);
+ ceph_assert(is_probing() || is_synchronizing());
+ ceph_assert(probe_timeout_event);
probe_timeout_event = NULL;
bootstrap();
}
return;
}
- assert(paxos != NULL);
+ ceph_assert(paxos != NULL);
if (is_synchronizing()) {
dout(10) << " currently syncing" << dendl;
elector.advance_epoch();
rank = monmap->get_rank(name);
- assert(rank == 0);
+ ceph_assert(rank == 0);
set<int> q;
q.insert(rank);
const utime_t& Monitor::get_leader_since() const
{
- assert(state == STATE_LEADER);
+ ceph_assert(state == STATE_LEADER);
return leader_since;
}
void Monitor::_finish_svc_election()
{
- assert(state == STATE_LEADER || state == STATE_PEON);
+ ceph_assert(state == STATE_LEADER || state == STATE_PEON);
for (auto& svc : paxos_service) {
// we already called election_finished() on monmon(); avoid callig twice
<< " features " << features
<< " mon_features " << mon_features
<< dendl;
- assert(is_electing());
+ ceph_assert(is_electing());
state = STATE_LEADER;
leader_since = ceph_clock_now();
leader = rank;
dout(20) << __func__ << " healthmon proposing, waiting" << dendl;
healthmon()->wait_for_finished_proposal(nullptr, new C_MonContext(this,
[this](int r){
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
do_health_to_clog_interval();
}));
* once you unset it.
*/
if (monmap_features.contains_all(ceph::features::mon::FEATURE_KRAKEN)) {
- assert(ceph::features::mon::get_persistent().contains_all(
+ ceph_assert(ceph::features::mon::get_persistent().contains_all(
ceph::features::mon::FEATURE_KRAKEN));
// this feature should only ever be set if the quorum supports it.
- assert(HAVE_FEATURE(quorum_con_features, SERVER_KRAKEN));
+ ceph_assert(HAVE_FEATURE(quorum_con_features, SERVER_KRAKEN));
new_features.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_KRAKEN);
}
if (monmap_features.contains_all(ceph::features::mon::FEATURE_LUMINOUS)) {
- assert(ceph::features::mon::get_persistent().contains_all(
+ ceph_assert(ceph::features::mon::get_persistent().contains_all(
ceph::features::mon::FEATURE_LUMINOUS));
// this feature should only ever be set if the quorum supports it.
- assert(HAVE_FEATURE(quorum_con_features, SERVER_LUMINOUS));
+ ceph_assert(HAVE_FEATURE(quorum_con_features, SERVER_LUMINOUS));
new_features.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_LUMINOUS);
}
if (monmap_features.contains_all(ceph::features::mon::FEATURE_MIMIC)) {
- assert(ceph::features::mon::get_persistent().contains_all(
+ ceph_assert(ceph::features::mon::get_persistent().contains_all(
ceph::features::mon::FEATURE_MIMIC));
// this feature should only ever be set if the quorum supports it.
- assert(HAVE_FEATURE(quorum_con_features, SERVER_MIMIC));
+ ceph_assert(HAVE_FEATURE(quorum_con_features, SERVER_MIMIC));
new_features.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_MIMIC);
}
if (monmap_features.contains_all(ceph::features::mon::FEATURE_NAUTILUS)) {
- assert(ceph::features::mon::get_persistent().contains_all(
+ ceph_assert(ceph::features::mon::get_persistent().contains_all(
ceph::features::mon::FEATURE_NAUTILUS));
// this feature should only ever be set if the quorum supports it.
- assert(HAVE_FEATURE(quorum_con_features, SERVER_NAUTILUS));
+ ceph_assert(HAVE_FEATURE(quorum_con_features, SERVER_NAUTILUS));
new_features.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_NAUTILUS);
}
void Monitor::handle_command(MonOpRequestRef op)
{
- assert(op->is_type_command());
+ ceph_assert(op->is_type_command());
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
if (m->fsid != monmap->fsid) {
dout(0) << "handle_command on fsid " << m->fsid << " != " << monmap->fsid << dendl;
ds << '\n';
}
} else {
- assert(0 == "We should never get here!");
+ ceph_assert(0 == "We should never get here!");
return;
}
rdata.append(ds);
bufferlist& rdata, version_t version)
{
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
- assert(m->get_type() == MSG_MON_COMMAND);
+ ceph_assert(m->get_type() == MSG_MON_COMMAND);
MMonCommandAck *reply = new MMonCommandAck(m->cmd, rc, rs, version);
reply->set_tid(m->get_tid());
reply->set_data(rdata);
}
send_mon_message(forward, mon);
op->mark_forwarded();
- assert(op->get_req()->get_type() != 0);
+ ceph_assert(op->get_req()->get_type() != 0);
} else {
dout(10) << "forward_request no session for request " << *req << dendl;
}
socket_addr(sa) {}
int send_message(Message *m) override {
- assert(!"send_message on anonymous connection");
+ ceph_assert(!"send_message on anonymous connection");
}
void send_keepalive() override {
- assert(!"send_keepalive on anonymous connection");
+ ceph_assert(!"send_keepalive on anonymous connection");
}
void mark_down() override {
// silently ignore
<< " " << m->client_addrs
<< " via " << m->get_source_inst() << dendl;
MonSession *session = op->get_session();
- assert(session);
+ ceph_assert(session);
if (!session->is_capable("mon", MON_CAP_X)) {
dout(0) << "forward from entity with insufficient caps! "
// see PaxosService::dispatch(); we rely on this being anon
// (c->msgr == NULL)
PaxosServiceMessage *req = m->claim_message();
- assert(req != NULL);
+ ceph_assert(req != NULL);
ConnectionRef c(new AnonConnection(cct, m->client_socket_addr));
MonSession *s = new MonSession(req->get_source(),
op->mark_event(__func__);
MonSession *session = op->get_session();
- assert(session);
+ ceph_assert(session);
Message *req = op->get_req();
ConnectionRef con = op->get_connection();
osdmon()->send_incremental(m->send_osdmap_first, rr->session,
true, MonOpRequestRef());
}
- assert(rr->tid == m->session_mon_tid && rr->session->routed_request_tids.count(m->session_mon_tid));
+ ceph_assert(rr->tid == m->session_mon_tid && rr->session->routed_request_tids.count(m->session_mon_tid));
routed_requests.erase(m->session_mon_tid);
rr->session->routed_request_tids.erase(m->session_mon_tid);
delete rr;
rr->op->mark_event("retry routed request");
retry.push_back(new C_RetryMessage(this, rr->op));
if (rr->session) {
- assert(rr->session->routed_request_tids.count(p->first));
+ ceph_assert(rr->session->routed_request_tids.count(p->first));
rr->session->routed_request_tids.erase(p->first);
}
delete rr;
{
dout(10) << "remove_session " << s << " " << s->name << " " << s->addrs
<< " features 0x" << std::hex << s->con_features << std::dec << dendl;
- assert(s->con);
- assert(!s->closed);
+ ceph_assert(s->con);
+ ceph_assert(!s->closed);
for (set<uint64_t>::iterator p = s->routed_request_tids.begin();
p != s->routed_request_tids.end();
++p) {
- assert(routed_requests.count(*p));
+ ceph_assert(routed_requests.count(*p));
RoutedRequest *rr = routed_requests[*p];
dout(10) << " dropping routed request " << rr->tid << dendl;
delete rr;
m->get_source_addrs(),
con.get());
}
- assert(s);
+ ceph_assert(s);
con->set_priv(RefCountedPtr{s, false});
dout(10) << __func__ << " new session " << s << " " << *s
<< " features 0x" << std::hex
<< dendl;
}
- assert(s);
+ ceph_assert(s);
s->session_timeout = ceph_clock_now();
s->session_timeout += g_conf()->mon_session_timeout;
{
op->mark_event("mon:dispatch_op");
MonSession *s = op->get_session();
- assert(s);
+ ceph_assert(s);
if (s->closed) {
dout(10) << " session closed, dropping " << op->get_req() << dendl;
return;
void Monitor::timecheck_start_round()
{
dout(10) << __func__ << " curr " << timecheck_round << dendl;
- assert(is_leader());
+ ceph_assert(is_leader());
if (monmap->size() == 1) {
- assert(0 == "We are alone; this shouldn't have been scheduled!");
+ ceph_assert(0 == "We are alone; this shouldn't have been scheduled!");
return;
}
}
}
- assert(timecheck_round % 2 == 0);
+ ceph_assert(timecheck_round % 2 == 0);
timecheck_acks = 0;
timecheck_round ++;
timecheck_round_start = ceph_clock_now();
void Monitor::timecheck_finish_round(bool success)
{
dout(10) << __func__ << " curr " << timecheck_round << dendl;
- assert(timecheck_round % 2);
+ ceph_assert(timecheck_round % 2);
timecheck_round ++;
timecheck_round_start = utime_t();
if (success) {
- assert(timecheck_waiting.empty());
- assert(timecheck_acks == quorum.size());
+ ceph_assert(timecheck_waiting.empty());
+ ceph_assert(timecheck_acks == quorum.size());
timecheck_report();
timecheck_check_skews();
return;
void Monitor::timecheck_check_skews()
{
dout(10) << __func__ << dendl;
- assert(is_leader());
- assert((timecheck_round % 2) == 0);
+ ceph_assert(is_leader());
+ ceph_assert((timecheck_round % 2) == 0);
if (monmap->size() == 1) {
- assert(0 == "We are alone; we shouldn't have gotten here!");
+ ceph_assert(0 == "We are alone; we shouldn't have gotten here!");
return;
}
- assert(timecheck_latencies.size() == timecheck_skews.size());
+ ceph_assert(timecheck_latencies.size() == timecheck_skews.size());
bool found_skew = false;
for (auto& p : timecheck_skews) {
void Monitor::timecheck_report()
{
dout(10) << __func__ << dendl;
- assert(is_leader());
- assert((timecheck_round % 2) == 0);
+ ceph_assert(is_leader());
+ ceph_assert((timecheck_round % 2) == 0);
if (monmap->size() == 1) {
- assert(0 == "We are alone; we shouldn't have gotten here!");
+ ceph_assert(0 == "We are alone; we shouldn't have gotten here!");
return;
}
- assert(timecheck_latencies.size() == timecheck_skews.size());
+ ceph_assert(timecheck_latencies.size() == timecheck_skews.size());
bool do_output = true; // only output report once
for (set<int>::iterator q = quorum.begin(); q != quorum.end(); ++q) {
if (monmap->get_name(*q) == name)
void Monitor::timecheck()
{
dout(10) << __func__ << dendl;
- assert(is_leader());
+ ceph_assert(is_leader());
if (monmap->size() == 1) {
- assert(0 == "We are alone; we shouldn't have gotten here!");
+ ceph_assert(0 == "We are alone; we shouldn't have gotten here!");
return;
}
- assert(timecheck_round % 2 != 0);
+ ceph_assert(timecheck_round % 2 != 0);
timecheck_acks = 1; // we ack ourselves
const double latency)
{
health_status_t status = HEALTH_OK;
- assert(latency >= 0);
+ ceph_assert(latency >= 0);
double abs_skew;
if (timecheck_has_skew(skew_bound, &abs_skew)) {
MTimeCheck2 *m = static_cast<MTimeCheck2*>(op->get_req());
dout(10) << __func__ << " " << *m << dendl;
/* handles PONG's */
- assert(m->op == MTimeCheck2::OP_PONG);
+ ceph_assert(m->op == MTimeCheck2::OP_PONG);
int other = m->get_source().num();
if (m->epoch < get_epoch()) {
<< " -- severely lagged? discard" << dendl;
return;
}
- assert(m->epoch == get_epoch());
+ ceph_assert(m->epoch == get_epoch());
if (m->round < timecheck_round) {
dout(1) << __func__ << " got old round " << m->round
utime_t curr_time = ceph_clock_now();
- assert(timecheck_waiting.count(other) > 0);
+ ceph_assert(timecheck_waiting.count(other) > 0);
utime_t timecheck_sent = timecheck_waiting[other];
timecheck_waiting.erase(other);
if (curr_time < timecheck_sent) {
* may be masked by an even higher latency, but with high latencies
* we probably have worse issues to deal with than just skewed clocks.
*/
- assert(latency >= 0);
+ ceph_assert(latency >= 0);
double delta = ((double) m->timestamp) - ((double) curr_time);
double abs_delta = (delta > 0 ? delta : -delta);
if (timecheck_acks == quorum.size()) {
dout(10) << __func__ << " got pongs from everybody ("
<< timecheck_acks << " total)" << dendl;
- assert(timecheck_skews.size() == timecheck_acks);
- assert(timecheck_waiting.empty());
+ ceph_assert(timecheck_skews.size() == timecheck_acks);
+ ceph_assert(timecheck_waiting.empty());
// everyone has acked, so bump the round to finish it.
timecheck_finish_round();
}
MTimeCheck2 *m = static_cast<MTimeCheck2*>(op->get_req());
dout(10) << __func__ << " " << *m << dendl;
- assert(is_peon());
- assert(m->op == MTimeCheck2::OP_PING || m->op == MTimeCheck2::OP_REPORT);
+ ceph_assert(is_peon());
+ ceph_assert(m->op == MTimeCheck2::OP_PING || m->op == MTimeCheck2::OP_REPORT);
if (m->epoch != get_epoch()) {
dout(1) << __func__ << " got wrong epoch "
timecheck_round = m->round;
if (m->op == MTimeCheck2::OP_REPORT) {
- assert((timecheck_round % 2) == 0);
+ ceph_assert((timecheck_round % 2) == 0);
timecheck_latencies.swap(m->latencies);
timecheck_skews.swap(m->skews);
return;
}
- assert((timecheck_round % 2) != 0);
+ ceph_assert((timecheck_round % 2) != 0);
MTimeCheck2 *reply = new MTimeCheck2(MTimeCheck2::OP_PONG);
utime_t curr_time = ceph_clock_now();
reply->timestamp = curr_time;
bool reply = false;
MonSession *s = op->get_session();
- assert(s);
+ ceph_assert(s);
for (map<string,ceph_mon_subscribe_item>::iterator p = m->what.begin();
p != m->what.end();
dout(10) << __func__ << ": MDS sub '" << p->first << "'" << dendl;
if ((int)s->is_capable("mds", MON_CAP_R)) {
Subscription *sub = s->sub_map[p->first];
- assert(sub != nullptr);
+ ceph_assert(sub != nullptr);
mdsmon()->check_sub(sub);
}
} else if (p->first == "osdmap") {
PaxosService *svc = NULL;
MonSession *s = op->get_session();
- assert(s);
+ ceph_assert(s);
if (!is_leader() && !is_peon()) {
dout(10) << " waiting for quorum" << dendl;
int Monitor::get_mon_metadata(int mon, Formatter *f, ostream& err)
{
- assert(f);
+ ceph_assert(f);
if (!mon_metadata.count(mon)) {
err << "mon." << mon << " not found";
return -EINVAL;
int Monitor::scrub_start()
{
dout(10) << __func__ << dendl;
- assert(is_leader());
+ ceph_assert(is_leader());
if (!scrub_result.empty()) {
clog->info() << "scrub already in progress";
int Monitor::scrub()
{
- assert(is_leader());
- assert(scrub_state);
+ ceph_assert(is_leader());
+ ceph_assert(scrub_state);
scrub_cancel_timeout();
wait_for_paxos_write();
scrub_reset_timeout();
if (quorum.size() == 1) {
- assert(scrub_state->finished == true);
+ ceph_assert(scrub_state->finished == true);
scrub_finish();
}
return 0;
scrub_reset_timeout();
int from = m->get_source().num();
- assert(scrub_result.count(from) == 0);
+ ceph_assert(scrub_result.count(from) == 0);
scrub_result[from] = m->result;
if (scrub_result.size() == quorum.size()) {
pair<string,string> *start,
int *num_keys)
{
- assert(r != NULL);
- assert(start != NULL);
- assert(num_keys != NULL);
+ ceph_assert(r != NULL);
+ ceph_assert(start != NULL);
+ ceph_assert(num_keys != NULL);
set<string> prefixes = get_sync_targets_names();
prefixes.erase("paxos"); // exclude paxos, as this one may have extra states for proposals, etc.
bufferlist bl;
int err = store->get(k.first, k.second, bl);
- assert(err == 0);
+ ceph_assert(err == 0);
uint32_t key_crc = bl.crc32c(0);
dout(30) << __func__ << " " << k << " bl " << bl.length() << " bytes"
int r = store->get(MONITOR_NAME, "cluster_uuid", ebl);
if (r == -ENOENT)
return r;
- assert(r == 0);
+ ceph_assert(r == 0);
string es(ebl.c_str(), ebl.length());
else if (r == -EAGAIN)
mon->dispatch_op(op);
else
- assert(0 == "bad C_Command return value");
+ ceph_assert(0 == "bad C_Command return value");
}
};
else if (r == -ECANCELED)
return;
else
- assert(0 == "bad C_RetryMessage return value");
+ ceph_assert(0 == "bad C_RetryMessage return value");
}
};
compact.pop_front();
}
} else {
- assert(0 == "failed to write to db");
+ ceph_assert(0 == "failed to write to db");
}
return r;
}
* @param last_key[out] Last key in the chunk
*/
void get_chunk_tx(TransactionRef tx, uint64_t max) override {
- assert(done == false);
- assert(iter->valid() == true);
+ ceph_assert(done == false);
+ ceph_assert(iter->valid() == true);
while (iter->valid()) {
string prefix(iter->raw_key().first);
}
iter->next();
}
- assert(iter->valid() == false);
+ ceph_assert(iter->valid() == false);
done = true;
}
pair<string,string> get_next_key() override {
- assert(iter->valid());
+ ceph_assert(iter->valid());
for (; iter->valid(); iter->next()) {
pair<string,string> r = iter->raw_key();
}
KeyValueDB::Iterator get_iterator(const string &prefix) {
- assert(!prefix.empty());
+ ceph_assert(!prefix.empty());
KeyValueDB::Iterator iter = db->get_iterator(prefix);
iter->seek_to_first();
return iter;
}
int get(const string& prefix, const string& key, bufferlist& bl) {
- assert(bl.length() == 0);
+ ceph_assert(bl.length() == 0);
return db->get(prefix, key, &bl);
}
generic_dout(0) << "MonitorDBStore::get() error obtaining"
<< " (" << prefix << ":" << key << "): "
<< cpp_strerror(err) << dendl;
- assert(0 == "error obtaining key");
+ ceph_assert(0 == "error obtaining key");
}
- assert(bl.length());
+ ceph_assert(bl.length());
version_t ver;
auto p = bl.cbegin();
decode(ver, p);
dbt->rmkeys_by_prefix((*iter));
}
int r = db->submit_transaction_sync(dbt);
- assert(r >= 0);
+ ceph_assert(r >= 0);
}
void _open(string kv_type) {
derr << __func__ << " error initializing "
<< kv_type << " db back storage in "
<< full_path << dendl;
- assert(0 == "MonitorDBStore: error initializing keyvaluedb back storage");
+ ceph_assert(0 == "MonitorDBStore: error initializing keyvaluedb back storage");
}
db.reset(db_ptr);
is_open(false) {
}
~MonitorDBStore() {
- assert(!is_open);
+ ceph_assert(!is_open);
if (do_dump) {
if (!g_conf()->mon_debug_dump_json) {
::close(dump_fd_binary);
// read and decode
monmap_bl.clear();
int ret = get_version(version, monmap_bl);
- assert(ret == 0);
- assert(monmap_bl.length());
+ ceph_assert(ret == 0);
+ ceph_assert(monmap_bl.length());
dout(10) << __func__ << " got " << version << dendl;
mon->monmap->decode(monmap_bl);
{
dout(10) << __func__ << " epoch " << pending_map.epoch << dendl;
- assert(mon->monmap->epoch + 1 == pending_map.epoch ||
+ ceph_assert(mon->monmap->epoch + 1 == pending_map.epoch ||
pending_map.epoch == 1); // special case mkfs!
bufferlist bl;
pending_map.encode(bl, mon->get_quorum_con_features());
// established them in the first place.
return;
} else {
- assert(0 == "bad C_ApplyFeatures return value");
+ ceph_assert(0 == "bad C_ApplyFeatures return value");
}
}
};
return;
}
- assert(is_writeable());
- assert(features.contains_all(pending_map.persistent_features));
+ ceph_assert(is_writeable());
+ ceph_assert(features.contains_all(pending_map.persistent_features));
// we should never hit this because `features` should be the result
// of the quorum's supported features. But if it happens, die.
- assert(ceph::features::mon::get_supported().contains_all(features));
+ ceph_assert(ceph::features::mon::get_supported().contains_all(features));
mon_feature_t new_features =
(pending_map.persistent_features ^
ss << "there is no map for epoch " << epoch;
goto reply;
}
- assert(r == 0);
- assert(bl.length() > 0);
+ ceph_assert(r == 0);
+ ceph_assert(bl.length() > 0);
p = new MonMap;
p->decode(bl);
}
- assert(p);
+ ceph_assert(p);
if (prefix == "mon getmap") {
p->encode(rdata, m->get_connection()->get_features());
* state, thus we are not bound by it.
*/
- assert(mon->monmap);
+ ceph_assert(mon->monmap);
MonMap &monmap = *mon->monmap;
int r = ceph_release_from_name(
g_conf()->mon_osd_initial_require_min_compat_client.c_str());
if (r <= 0) {
- assert(0 == "mon_osd_initial_require_min_compat_client is not valid");
+ ceph_assert(0 == "mon_osd_initial_require_min_compat_client is not valid");
}
newmap.require_min_compat_client = r;
}
version_t version = get_last_committed();
if (version == osdmap.epoch)
return;
- assert(version > osdmap.epoch);
+ ceph_assert(version > osdmap.epoch);
dout(15) << "update_from_paxos paxos e " << version
<< ", my e " << osdmap.epoch << dendl;
}
}
- assert(latest_full > 0);
+ ceph_assert(latest_full > 0);
auto t(std::make_shared<MonitorDBStore::Transaction>());
put_version_latest_full(t, latest_full);
mon->store->apply_transaction(t);
if ((latest_full > 0) && (latest_full > osdmap.epoch)) {
bufferlist latest_bl;
get_version_full(latest_full, latest_bl);
- assert(latest_bl.length() != 0);
+ ceph_assert(latest_bl.length() != 0);
dout(7) << __func__ << " loading latest full map e" << latest_full << dendl;
osdmap = OSDMap();
osdmap.decode(latest_bl);
while (version > osdmap.epoch) {
bufferlist inc_bl;
int err = get_version(osdmap.epoch+1, inc_bl);
- assert(err == 0);
- assert(inc_bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(inc_bl.length());
dout(7) << "update_from_paxos applying incremental " << osdmap.epoch+1
<< dendl;
OSDMap::Incremental inc(inc_bl);
err = osdmap.apply_incremental(inc);
- assert(err == 0);
+ ceph_assert(err == 0);
if (!t)
t.reset(new MonitorDBStore::Transaction);
get_version_full(osdmap.epoch, orig_full_bl);
if (orig_full_bl.length()) {
// the primary provided the full map
- assert(inc.have_crc);
+ ceph_assert(inc.have_crc);
if (inc.full_crc != osdmap.crc) {
// This will happen if the mons were running mixed versions in
// the past or some other circumstance made the full encoded
*_dout << dendl;
}
} else {
- assert(!inc.have_crc);
+ ceph_assert(!inc.have_crc);
put_version_full(t, osdmap.epoch, full_bl);
}
put_version_latest_full(t, osdmap.epoch);
pending_inc.modified = ceph_clock_now();
int r = pending_inc.propagate_snaps_to_tiers(cct, osdmap);
- assert(r == 0);
+ ceph_assert(r == 0);
if (mapping_job) {
if (!mapping_job->is_done()) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// make sure FLAG_FULL is truly set, so we are safe not
// to set a extra (redundant) FLAG_BACKFILLFULL flag
- assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
+ ceph_assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
continue;
}
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_BACKFILLFULL)) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// make sure FLAG_FULL is truly set, so we are safe not
// to set a extra (redundant) FLAG_NEARFULL flag
- assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
+ ceph_assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
continue;
}
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_NEARFULL)) {
<< " features " << features << dendl;
// the features should be a subset of the mon quorum's features!
- assert((features & ~mon->get_quorum_con_features()) == 0);
+ ceph_assert((features & ~mon->get_quorum_con_features()) == 0);
bufferlist fullbl;
encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED);
}
// encode
- assert(get_last_committed() + 1 == pending_inc.epoch);
+ ceph_assert(get_last_committed() + 1 == pending_inc.epoch);
bufferlist bl;
encode(pending_inc, bl, features | CEPH_FEATURE_RESERVED);
e <= std::min(last, m->get_full_last()) && max > 0;
++e, --max) {
int r = get_version_full(e, features, reply->maps[e]);
- assert(r >= 0);
+ ceph_assert(r >= 0);
}
for (epoch_t e = std::max(first, m->get_inc_first());
e <= std::min(last, m->get_inc_last()) && max > 0;
++e, --max) {
int r = get_version(e, features, reply->incremental_maps[e]);
- assert(r >= 0);
+ ceph_assert(r >= 0);
}
reply->oldest_map = first;
reply->newest_map = last;
MOSDMarkMeDown *m = static_cast<MOSDMarkMeDown*>(op->get_req());
int target_osd = m->target_osd;
- assert(osdmap.is_up(target_osd));
- assert(osdmap.get_addrs(target_osd) == m->target_addrs);
+ ceph_assert(osdmap.is_up(target_osd));
+ ceph_assert(osdmap.get_addrs(target_osd) == m->target_addrs);
mon->clog->info() << "osd." << target_osd << " marked itself down";
pending_inc.new_state[target_osd] = CEPH_OSD_UP;
// laggy. this is clearly not true in all cases, but will sometimes
// help us localize the grace correction to a subset of the system
// (say, a rack with a bad switch) that is unhappy.
- assert(fi.reporters.size());
+ ceph_assert(fi.reporters.size());
for (map<int,failure_reporter_t>::iterator p = fi.reporters.begin();
p != fi.reporters.end();
++p) {
int target_osd = m->get_target_osd();
int reporter = m->get_orig_source().num();
- assert(osdmap.is_up(target_osd));
- assert(osdmap.get_addrs(target_osd) == m->get_target_addrs());
+ ceph_assert(osdmap.is_up(target_osd));
+ ceph_assert(osdmap.get_addrs(target_osd) == m->get_target_addrs());
if (m->if_osd_failed()) {
// calculate failure time
goto ignore;
}
- assert(m->get_orig_source_inst().name.is_osd());
+ ceph_assert(m->get_orig_source_inst().name.is_osd());
// check if osd has required features to boot
if (osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS &&
<< " hb_front_addrs " << m->hb_front_addrs
<< dendl;
- assert(m->get_orig_source().is_osd());
+ ceph_assert(m->get_orig_source().is_osd());
int from = m->get_orig_source().num();
// does this osd exist?
dout(7) << __func__ << " was up, first marking down osd." << from << " "
<< osdmap.get_addrs(from) << dendl;
// preprocess should have caught these; if not, assert.
- assert(osdmap.get_addrs(from) != m->get_orig_source_addrs() ||
+ ceph_assert(osdmap.get_addrs(from) != m->get_orig_source_addrs() ||
osdmap.get_cluster_addrs(from) != m->cluster_addrs);
- assert(osdmap.get_uuid(from) == m->sb.osd_fsid);
+ ceph_assert(osdmap.get_uuid(from) == m->sb.osd_fsid);
if (pending_inc.new_state.count(from) == 0 ||
(pending_inc.new_state[from] & CEPH_OSD_UP) == 0) {
<< dendl;
if (!osdmap.exists(from) || osdmap.get_uuid(from) != m->sb.osd_fsid) {
// preprocess should have caught this; if not, assert.
- assert(!osdmap.exists(from) || osdmap.get_uuid(from).is_zero());
+ ceph_assert(!osdmap.exists(from) || osdmap.get_uuid(from).is_zero());
pending_inc.new_uuid[from] = m->sb.osd_fsid;
}
bufferlist bl;
int err = get_version(e, features, bl);
if (err == 0) {
- assert(bl.length());
+ ceph_assert(bl.length());
// if (get_version(e, bl) > 0) {
dout(20) << "build_incremental inc " << e << " "
<< bl.length() << " bytes" << dendl;
m->incremental_maps[e] = bl;
} else {
- assert(err == -ENOENT);
- assert(!bl.length());
+ ceph_assert(err == -ENOENT);
+ ceph_assert(!bl.length());
get_version_full(e, features, bl);
if (bl.length() > 0) {
//else if (get_version("full", e, bl) > 0) {
op->mark_osdmon_event(__func__);
MonSession *s = op->get_session();
- assert(s);
+ ceph_assert(s);
if (s->proxy_con) {
// oh, we can tell the other mon to do it
first = get_first_committed();
bufferlist bl;
int err = get_version_full(first, features, bl);
- assert(err == 0);
- assert(bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(bl.length());
dout(20) << "send_incremental starting with base full "
<< first << " " << bl.length() << " bytes" << dendl;
m->maps[first] = bl;
if (!osdmap.get_num_up_osds()) {
return;
}
- assert(osdmap.get_up_osd_features() & CEPH_FEATURE_MON_STATEFUL_SUB);
+ ceph_assert(osdmap.get_up_osd_features() & CEPH_FEATURE_MON_STATEFUL_SUB);
mon->with_session_map([this](const MonSessionMap& session_map) {
auto pg_creates_subs = session_map.subs.find("osd_pg_creates");
if (pg_creates_subs == session_map.subs.end()) {
void OSDMonitor::check_pg_creates_sub(Subscription *sub)
{
dout(20) << __func__ << " .. " << sub->session->name << dendl;
- assert(sub->type == "osd_pg_creates");
+ ceph_assert(sub->type == "osd_pg_creates");
// only send these if the OSD is up. we will check_subs() when they do
// come up so they will get the creates then.
if (sub->session->name.is_osd() &&
const std::string &app_key,
const std::string &app_value)
{
- assert(paxos->is_plugged() && is_writeable());
+ ceph_assert(paxos->is_plugged() && is_writeable());
dout(20) << __func__ << ": pool_id=" << pool_id << ", app_name=" << app_name
<< dendl;
- assert(osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS);
+ ceph_assert(osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS);
auto pp = osdmap.get_pg_pool(pool_id);
- assert(pp != nullptr);
+ ceph_assert(pp != nullptr);
pg_pool_t p = *pp;
if (pending_inc.new_pools.count(pool_id)) {
auto creating_pgs_by_epoch = creating_pgs_by_osd_epoch.find(osd);
if (creating_pgs_by_epoch == creating_pgs_by_osd_epoch.end())
return next;
- assert(!creating_pgs_by_epoch->second.empty());
+ ceph_assert(!creating_pgs_by_epoch->second.empty());
MOSDPGCreate *oldm = nullptr; // for pre-mimic OSD compat
MOSDPGCreate2 *m = nullptr;
// Need the create time from the monitor using its clock to set
// last_scrub_stamp upon pg creation.
auto create = creating_pgs.pgs.find(pg.pgid);
- assert(create != creating_pgs.pgs.end());
+ ceph_assert(create != creating_pgs.pgs.end());
if (old) {
if (!oldm) {
oldm = new MOSDPGCreate(creating_pgs_epoch);
ss << "there is no map for epoch " << epoch;
goto reply;
}
- assert(err == 0);
- assert(osdmap_bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(osdmap_bl.length());
OSDMap *p;
if (epoch == osdmap.get_epoch()) {
break;
}
}
- assert(i != ALL_CHOICES.end());
+ ceph_assert(i != ALL_CHOICES.end());
switch(*it) {
case PG_NUM:
f->dump_int("pg_num", p->get_pg_num());
if (i->second == *it)
break;
}
- assert(i != ALL_CHOICES.end());
+ ceph_assert(i != ALL_CHOICES.end());
ss << i->first << ": " <<
(p->has_flag(pg_pool_t::get_flag_by_name(i->first)) ?
"true" : "false") << "\n";
if (i->second == *it)
break;
}
- assert(i != ALL_CHOICES.end());
+ ceph_assert(i != ALL_CHOICES.end());
{
pool_opts_t::key_t key = pool_opts_t::get_opt_desc(i->first).key;
if (p->opts.is_set(key)) {
int64_t poolid = osdmap.lookup_pg_pool_name(pool_name);
if (poolid < 0) {
- assert(poolid == -ENOENT);
+ ceph_assert(poolid == -ENOENT);
ss << "unrecognized pool '" << pool_name << "'";
r = -ENOENT;
goto reply;
{
pg_pool_t *pool = pending_inc.get_new_pool(pool_id,
osdmap.get_pg_pool(pool_id));
- assert(pool);
+ ceph_assert(pool);
pool->set_flag(flags);
}
{
pg_pool_t *pool = pending_inc.get_new_pool(pool_id,
osdmap.get_pg_pool(pool_id));
- assert(pool);
+ ceph_assert(pool);
pool->unset_flag(flags);
}
}
if (pbegin && pbegin < end) {
// the tail of [begin,end) is purged; shorten the range
- assert(pbegin > begin);
+ ceph_assert(pbegin > begin);
end = pbegin;
}
to_prune.insert(begin, end - begin);
true);
if (r)
return r;
- assert((*erasure_code_profile_map).count("plugin"));
+ ceph_assert((*erasure_code_profile_map).count("plugin"));
string default_plugin = (*erasure_code_profile_map)["plugin"];
map<string,string> user_map;
for (vector<string>::const_iterator i = erasure_code_profile.begin();
if (it != profile.end()) {
string err_str;
stripe_unit = strict_iecstrtoll(it->second.c_str(), &err_str);
- assert(err_str.empty());
+ ceph_assert(err_str.empty());
}
*stripe_width = data_chunks *
erasure_code->get_chunk_size(stripe_unit * data_chunks);
}
break;
default:
- assert(!"unknown type");
+ ceph_assert(!"unknown type");
}
} else {
ss << "unrecognized variable '" << var << "'";
if (err < 0)
return err;
- assert(err == 0);
+ ceph_assert(err == 0);
do_osd_crush_remove(newcrush);
return 0;
int32_t OSDMonitor::_allocate_osd_id(int32_t* existing_id)
{
- assert(existing_id);
+ ceph_assert(existing_id);
*existing_id = -1;
for (int32_t i = 0; i < osdmap.get_max_osd(); ++i) {
int32_t* new_id)
{
dout(10) << __func__ << " uuid " << uuid << dendl;
- assert(new_id);
+ ceph_assert(new_id);
// We presume validation has been performed prior to calling this
// function. We assert with prejudice.
if (!uuid.is_zero()) {
existing_id = osdmap.identify_osd(uuid);
if (existing_id >= 0) {
- assert(id < 0 || id == existing_id);
+ ceph_assert(id < 0 || id == existing_id);
*new_id = existing_id;
goto out;
} else if (id >= 0) {
dout(10) << __func__ << " allocated id " << allocated_id
<< " existing id " << existing_id << dendl;
if (existing_id >= 0) {
- assert(existing_id < osdmap.get_max_osd());
- assert(allocated_id < 0);
+ ceph_assert(existing_id < osdmap.get_max_osd());
+ ceph_assert(allocated_id < 0);
pending_inc.new_weight[existing_id] = CEPH_OSD_OUT;
*new_id = existing_id;
} else if (allocated_id >= 0) {
- assert(existing_id < 0);
+ ceph_assert(existing_id < 0);
// raise max_osd
if (pending_inc.new_max_osd < 0) {
pending_inc.new_max_osd = osdmap.get_max_osd() + 1;
++pending_inc.new_max_osd;
}
*new_id = pending_inc.new_max_osd - 1;
- assert(*new_id == allocated_id);
+ ceph_assert(*new_id == allocated_id);
} else {
- assert(0 == "unexpected condition");
+ ceph_assert(0 == "unexpected condition");
}
out:
dout(10) << __func__ << " id " << id << " uuid " << uuid
<< " check_osd_exists " << check_osd_exists << dendl;
- assert(existing_id);
+ ceph_assert(existing_id);
if (id < 0 && uuid.is_zero()) {
// we have nothing to validate
* provided, but we will always guarantee the idempotency of `osd new`.
*/
- assert(!uuid.is_zero());
+ ceph_assert(!uuid.is_zero());
if (pending_inc.identify_osd(uuid) >= 0) {
// osd is about to exist
return -EAGAIN;
stringstream& ss)
{
dout(10) << __func__ << " id " << id << " uuid " << uuid << dendl;
- assert(existing_id);
+ ceph_assert(existing_id);
if (osdmap.is_destroyed(id)) {
ss << "ceph osd create has been deprecated. Please use ceph osd new "
"instead.";
string uuidstr;
int64_t id = -1;
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
dout(10) << __func__ << " " << op << dendl;
if (err == EEXIST) {
// this is idempotent from the osdmon's point-of-view
may_be_idempotent = true;
- assert(existing_id >= 0);
+ ceph_assert(existing_id >= 0);
id = existing_id;
} else if (err < 0) {
return err;
// find an `id`
id = _allocate_osd_id(&existing_id);
if (id < 0) {
- assert(existing_id >= 0);
+ ceph_assert(existing_id >= 0);
id = existing_id;
}
dout(10) << __func__ << " found id " << id << " to use" << dendl;
dout(10) << __func__ << " creating new osd." << id << dendl;
}
} else {
- assert(id >= 0);
- assert(osdmap.exists(id));
+ ceph_assert(id >= 0);
+ ceph_assert(osdmap.exists(id));
}
// we are now able to either create a brand new osd or reuse an existing
if (may_be_idempotent && params.empty()) {
// nothing to do, really.
dout(10) << __func__ << " idempotent and no params -- no op." << dendl;
- assert(id >= 0);
+ ceph_assert(id >= 0);
if (f) {
f->open_object_section("created_osd");
f->dump_int("osdid", id);
} else if (may_be_idempotent && err != EEXIST) {
// for this to be idempotent, `id` should already be >= 0; no need
// to use validate_id.
- assert(id >= 0);
+ ceph_assert(id >= 0);
ss << "osd." << id << " exists but secrets do not match";
return -EEXIST;
}
if (err < 0) {
return err;
} else if (may_be_idempotent && err != EEXIST) {
- assert(id >= 0);
+ ceph_assert(id >= 0);
ss << "osd." << id << " exists but dm-crypt key does not match.";
return -EEXIST;
}
}
}
- assert(!has_secrets || !cephx_secret.empty());
- assert(!has_lockbox || !lockbox_secret.empty());
+ ceph_assert(!has_secrets || !cephx_secret.empty());
+ ceph_assert(!has_lockbox || !lockbox_secret.empty());
if (may_be_idempotent) {
// we have nothing to do for either the osdmon or the authmon,
// touched. This is therefore an idempotent operation, and we can
// just return right away.
dout(10) << __func__ << " idempotent -- no op." << dendl;
- assert(id >= 0);
+ ceph_assert(id >= 0);
if (f) {
f->open_object_section("created_osd");
f->dump_int("osdid", id);
}
return EEXIST;
}
- assert(!may_be_idempotent);
+ ceph_assert(!may_be_idempotent);
// perform updates.
if (has_secrets) {
- assert(!cephx_secret.empty());
- assert((lockbox_secret.empty() && dmcrypt_key.empty()) ||
+ ceph_assert(!cephx_secret.empty());
+ ceph_assert((lockbox_secret.empty() && dmcrypt_key.empty()) ||
(!lockbox_secret.empty() && !dmcrypt_key.empty()));
err = mon->authmon()->do_osd_new(cephx_entity,
lockbox_entity,
has_lockbox);
- assert(0 == err);
+ ceph_assert(0 == err);
if (has_lockbox) {
- assert(nullptr != svc);
+ ceph_assert(nullptr != svc);
svc->do_osd_new(uuid, dmcrypt_key);
}
}
if (is_recreate_destroyed) {
- assert(id >= 0);
- assert(osdmap.is_destroyed(id));
+ ceph_assert(id >= 0);
+ ceph_assert(osdmap.is_destroyed(id));
pending_inc.new_weight[id] = CEPH_OSD_OUT;
pending_inc.new_state[id] |= CEPH_OSD_DESTROYED;
if ((osdmap.get_state(id) & CEPH_OSD_NEW) == 0) {
}
pending_inc.new_uuid[id] = uuid;
} else {
- assert(id >= 0);
+ ceph_assert(id >= 0);
int32_t new_id = -1;
do_osd_create(id, uuid, device_class, &new_id);
- assert(new_id >= 0);
- assert(id == new_id);
+ ceph_assert(new_id >= 0);
+ ceph_assert(id == new_id);
}
if (f) {
int32_t id,
stringstream& ss)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
// we check if the osd exists for the benefit of `osd purge`, which may
// have previously removed the osd. If the osd does not exist, return
ConfigKeyService *svc = (ConfigKeyService*)mon->config_key_service;
err = svc->validate_osd_destroy(id, uuid);
if (err < 0) {
- assert(err == -ENOENT);
+ ceph_assert(err == -ENOENT);
err = 0;
idempotent_cks = true;
}
if (!idempotent_auth) {
err = mon->authmon()->do_osd_destroy(cephx_entity, lockbox_entity);
- assert(0 == err);
+ ceph_assert(0 == err);
}
if (!idempotent_cks) {
// defying PaxosService and all laws of nature. Therefore, as we may
// be used during 'osd purge', let's keep the caller responsible for
// proposing.
- assert(err == 0);
+ ceph_assert(err == 0);
return 0;
}
int32_t id,
stringstream& ss)
{
- assert(paxos->is_plugged());
+ ceph_assert(paxos->is_plugged());
dout(10) << __func__ << " purging osd." << id << dendl;
- assert(!osdmap.is_up(id));
+ ceph_assert(!osdmap.is_up(id));
/*
* This may look a bit weird, but this is what's going to happen:
may_be_idempotent = false;
}
}
- assert(0 == err);
+ ceph_assert(0 == err);
if (may_be_idempotent && !osdmap.exists(id)) {
dout(10) << __func__ << " osd." << id << " does not exist and "
err = prepare_command_osd_remove(id);
// we should not be busy, as we should have made sure this id is not up.
- assert(0 == err);
+ ceph_assert(0 == err);
do_osd_crush_remove(newcrush);
return 0;
err = 0;
} else {
int ruleno = newcrush.get_rule_id(name);
- assert(ruleno >= 0);
+ ceph_assert(ruleno >= 0);
// make sure it is not in use.
// FIXME: this is ok in some situations, but let's not bother with that
err = 0;
goto reply;
}
- assert(osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS);
+ ceph_assert(osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS);
if (!osdmap.get_num_up_osds() && sure != "--yes-i-really-mean-it") {
ss << "Not advisable to continue since no OSDs are up. Pass "
<< "--yes-i-really-mean-it if you really wish to continue.";
ss << ", ";
ss << "osd." << osd << " is still up; must be down before removal. ";
} else {
- assert(err == 0);
+ ceph_assert(err == 0);
if (any) {
ss << ", osd." << osd;
} else {
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
}
}
osdmap.get_noout_osds(&osds);
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
// cancel any pending noup/nodown/noin/noout requests too
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
}
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
}
}
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
switch (option) {
break;
default:
- assert(0 == "invalid option");
+ ceph_assert(0 == "invalid option");
}
goto update;
bool is_destroy = (prefix == "osd destroy-actual");
if (!is_destroy) {
- assert("osd purge-actual" == prefix ||
+ ceph_assert("osd purge-actual" == prefix ||
"osd purge-new" == prefix);
}
if (is_destroy) {
err = prepare_command_osd_destroy(id, ss);
// we checked above that it should exist.
- assert(err != -ENOENT);
+ ceph_assert(err != -ENOENT);
} else {
err = prepare_command_osd_purge(id, ss);
if (err == -ENOENT) {
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
const pg_pool_t *tp = osdmap.get_pg_pool(tierpool_id);
- assert(tp);
+ ceph_assert(tp);
if (!_check_become_tier(tierpool_id, tp, pool_id, p, &err, &ss)) {
goto reply;
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
const pg_pool_t *tp = osdmap.get_pg_pool(tierpool_id);
- assert(tp);
+ ceph_assert(tp);
if (!_check_remove_tier(pool_id, p, tp, &err, &ss)) {
goto reply;
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
const pg_pool_t *overlay_p = osdmap.get_pg_pool(overlaypool_id);
- assert(overlay_p);
+ ceph_assert(overlay_p);
if (p->tiers.count(overlaypool_id) == 0) {
ss << "tier pool '" << overlaypoolstr << "' is not a tier of '" << poolstr << "'";
err = -EINVAL;
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
if (!p->has_read_tier()) {
err = 0;
ss << "there is now (or already was) no overlay for '" << poolstr << "'";
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
if (!p->is_tier()) {
ss << "pool '" << poolstr << "' is not a tier";
err = -EINVAL;
<< "' to " << pg_pool_t::get_cache_mode_name(mode);
if (mode == pg_pool_t::CACHEMODE_NONE) {
const pg_pool_t *base_pool = osdmap.get_pg_pool(np->tier_of);
- assert(base_pool);
+ ceph_assert(base_pool);
if (base_pool->read_tier == pool_id ||
base_pool->write_tier == pool_id)
ss <<" (WARNING: pool is still configured as read or write tier)";
goto reply;
}
const pg_pool_t *p = osdmap.get_pg_pool(pool_id);
- assert(p);
+ ceph_assert(p);
const pg_pool_t *tp = osdmap.get_pg_pool(tierpool_id);
- assert(tp);
+ ceph_assert(tp);
if (!_check_become_tier(tierpool_id, tp, pool_id, p, &err, &ss)) {
goto reply;
} else if (field == "max_bytes") {
value = strict_iecstrtoll(val.c_str(), &tss);
} else {
- assert(0 == "unrecognized option");
+ ceph_assert(0 == "unrecognized option");
}
if (!tss.empty()) {
ss << "error parsing value '" << val << "': " << tss;
} else if (field == "max_bytes") {
pi->quota_max_bytes = value;
} else {
- assert(0 == "unrecognized option");
+ ceph_assert(0 == "unrecognized option");
}
ss << "set-quota " << field << " = " << value << " for pool " << poolstr;
rs = ss.str();
}
if (base_pool->tiers.count(tier_pool_id)) {
- assert(tier_pool->tier_of == base_pool_id);
+ ceph_assert(tier_pool->tier_of == base_pool_id);
*err = 0;
*ss << "pool '" << tier_pool_name << "' is now (or already was) a tier of '"
<< base_pool_name << "'";
else if (r == -EAGAIN)
cmon->dispatch(op);
else
- assert(0 == "bad C_Booted return value");
+ ceph_assert(0 == "bad C_Booted return value");
}
};
else if (r == -EAGAIN)
osdmon->dispatch(op);
else
- assert(0 == "bad C_ReplyMap return value");
+ ceph_assert(0 == "bad C_ReplyMap return value");
}
};
struct C_PoolOp : public C_MonOp {
else if (r == -EAGAIN)
osdmon->dispatch(op);
else
- assert(0 == "bad C_PoolOp return value");
+ ceph_assert(0 == "bad C_PoolOp return value");
}
};
return;
auto ts = per_pool_sum_deltas_stamps.find(p->first);
- assert(ts != per_pool_sum_deltas_stamps.end());
+ ceph_assert(ts != per_pool_sum_deltas_stamps.end());
recovery_rate_summary(f, out, p->second.first, ts->second);
}
return;
auto ts = per_pool_sum_deltas_stamps.find(p->first);
- assert(ts != per_pool_sum_deltas_stamps.end());
+ ceph_assert(ts != per_pool_sum_deltas_stamps.end());
client_io_rate_summary(f, out, p->second.first, ts->second);
}
return;
auto ts = per_pool_sum_deltas_stamps.find(p->first);
- assert(ts != per_pool_sum_deltas_stamps.end());
+ ceph_assert(ts != per_pool_sum_deltas_stamps.end());
cache_io_rate_summary(f, out, p->second.first, ts->second);
}
int k = atoi(pk->second.c_str());
int m = atoi(pm->second.c_str());
int mk = m + k;
- assert(mk != 0);
- assert(k != 0);
+ ceph_assert(mk != 0);
+ ceph_assert(k != 0);
return (float)mk / k;
} else {
return 0.0;
}
break;
default:
- assert(0 == "unrecognized pool type");
+ ceph_assert(0 == "unrecognized pool type");
}
}
if (f)
f->close_section();
else {
- assert(ss != nullptr);
+ ceph_assert(ss != nullptr);
*ss << "POOLS:\n";
tbl.set_indent(4);
*ss << tbl;
}
f->close_section();
} else {
- assert(ss != nullptr);
+ ceph_assert(ss != nullptr);
TextTable tbl;
tbl.define_column("SIZE", TextTable::LEFT, TextTable::RIGHT);
tbl.define_column("AVAIL", TextTable::LEFT, TextTable::RIGHT);
void PGMap::apply_incremental(CephContext *cct, const Incremental& inc)
{
- assert(inc.version == version+1);
+ ceph_assert(inc.version == version+1);
version++;
pool_stat_t pg_sum_old = pg_sum;
num_pg--;
int end = --num_pg_by_state[s.state];
- assert(end >= 0);
+ ceph_assert(end >= 0);
if (end == 0)
num_pg_by_state.erase(s.state);
end = --num_pg_by_pool[pgid.pool()];
p != s.blocked_by.end();
++p) {
auto q = blocked_by_sum.find(*p);
- assert(q != blocked_by_sum.end());
+ ceph_assert(q != blocked_by_sum.end());
--q->second;
if (q->second == 0)
blocked_by_sum.erase(q);
{
num_osd--;
osd_sum.sub(s);
- assert(osd < (int)osd_last_seq.size());
+ ceph_assert(osd < (int)osd_last_seq.size());
osd_last_seq[osd] = 0;
}
int types, const utime_t cutoff,
mempool::pgmap::unordered_map<pg_t, pg_stat_t>& stuck_pgs) const
{
- assert(types != 0);
+ ceph_assert(types != 0);
for (auto i = pg_stat.begin();
i != pg_stat.end();
++i) {
const pool_stat_t& old_pool_sum)
{
if (per_pool_sum_deltas.count(pool) == 0) {
- assert(per_pool_sum_deltas_stamps.count(pool) == 0);
- assert(per_pool_sum_delta.count(pool) == 0);
+ ceph_assert(per_pool_sum_deltas_stamps.count(pool) == 0);
+ ceph_assert(per_pool_sum_delta.count(pool) == 0);
}
auto& sum_delta = per_pool_sum_delta[pool];
}
for (auto pgid : p->second) {
const pg_stat_t &stat = pg_map.pg_stat.at(pgid);
- assert(stat.acting_primary == osd);
+ ceph_assert(stat.acting_primary == osd);
_try_mark_pg_stale(osdmap, pgid, stat, pending_inc);
}
}
dout(30) << __func__ << " apply version " << v << dendl;
bufferlist bl;
int err = get_store()->get(get_name(), v, bl);
- assert(err == 0);
- assert(bl.length());
+ ceph_assert(err == 0);
+ ceph_assert(bl.length());
decode_append_transaction(tx, bl);
}
dout(15) << __func__ << " total versions " << (last-first) << dendl;
<< " first_committed: " << first_committed << dendl;
dout(10) << "init" << dendl;
- assert(is_consistent());
+ ceph_assert(is_consistent());
}
void Paxos::init_logger()
{
// we're recoverying, it seems!
state = STATE_RECOVERING;
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
// reset the number of lasts received
uncommitted_v = 0;
uncommitted_v = last_committed+1;
get_store()->get(get_name(), last_committed+1, uncommitted_value);
- assert(uncommitted_value.length());
+ ceph_assert(uncommitted_value.length());
dout(10) << "learned uncommitted " << (last_committed+1)
<< " pn " << uncommitted_pn
<< " (" << uncommitted_value.length() << " bytes) from myself"
MMonPaxos *collect = static_cast<MMonPaxos*>(op->get_req());
dout(10) << "handle_collect " << *collect << dendl;
- assert(mon->is_peon()); // mon epoch filter should catch strays
+ ceph_assert(mon->is_peon()); // mon epoch filter should catch strays
// we're recoverying, it seems!
state = STATE_RECOVERING;
if (collect->last_committed <= last_committed &&
get_store()->exists(get_name(), last_committed+1)) {
get_store()->get(get_name(), last_committed+1, bl);
- assert(bl.length() > 0);
+ ceph_assert(bl.length() > 0);
dout(10) << " sharing our accepted but uncommitted value for "
<< last_committed+1 << " (" << bl.length() << " bytes)" << dendl;
last->values[last_committed+1] = bl;
void Paxos::share_state(MMonPaxos *m, version_t peer_first_committed,
version_t peer_last_committed)
{
- assert(peer_last_committed < last_committed);
+ ceph_assert(peer_last_committed < last_committed);
dout(10) << "share_state peer has fc " << peer_first_committed
<< " lc " << peer_last_committed << dendl;
for ( ; v <= last_committed; v++) {
if (get_store()->exists(get_name(), v)) {
get_store()->get(get_name(), v, m->values[v]);
- assert(m->values[v].length());
+ ceph_assert(m->values[v].length());
dout(10) << " sharing " << v << " ("
<< m->values[v].length() << " bytes)" << dendl;
bytes += m->values[v].length() + 16; // paxos_ + 10 digits = 16
void Paxos::_sanity_check_store()
{
version_t lc = get_store()->get(get_name(), "last_committed");
- assert(lc == last_committed);
+ ceph_assert(lc == last_committed);
}
return;
}
- assert(g_conf()->paxos_kill_at != 1);
+ ceph_assert(g_conf()->paxos_kill_at != 1);
// store any committed values if any are specified in the message
need_refresh = store_state(last);
- assert(g_conf()->paxos_kill_at != 2);
+ ceph_assert(g_conf()->paxos_kill_at != 2);
// is everyone contiguous and up to date?
for (map<int,version_t>::iterator p = peer_last_committed.begin();
dout(1) << "collect timeout, calling fresh election" << dendl;
collect_timeout_event = 0;
logger->inc(l_paxos_collect_timeout);
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
mon->bootstrap();
}
<< v.length() << " bytes"
<< dendl;
- assert(mon->is_leader());
- assert(is_updating() || is_updating_previous());
+ ceph_assert(mon->is_leader());
+ ceph_assert(is_updating() || is_updating_previous());
// we must already have a majority for this to work.
- assert(mon->get_quorum().size() == 1 ||
+ ceph_assert(mon->get_quorum().size() == 1 ||
num_last > (unsigned)mon->monmap->size()/2);
// and no value, yet.
- assert(new_value.length() == 0);
+ ceph_assert(new_value.length() == 0);
// accept it ourselves
accepted.clear();
logger->tinc(l_paxos_begin_latency, to_timespan(end - start));
- assert(g_conf()->paxos_kill_at != 3);
+ ceph_assert(g_conf()->paxos_kill_at != 3);
if (mon->get_quorum().size() == 1) {
// we're alone, take it easy
op->mark_paxos_event("have higher pn, ignore");
return;
}
- assert(begin->pn == accepted_pn);
- assert(begin->last_committed == last_committed);
+ ceph_assert(begin->pn == accepted_pn);
+ ceph_assert(begin->last_committed == last_committed);
- assert(g_conf()->paxos_kill_at != 4);
+ ceph_assert(g_conf()->paxos_kill_at != 4);
logger->inc(l_paxos_begin);
logger->tinc(l_paxos_begin_latency, to_timespan(end - start));
- assert(g_conf()->paxos_kill_at != 5);
+ ceph_assert(g_conf()->paxos_kill_at != 5);
// reply
MMonPaxos *accept = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_ACCEPT,
op->mark_paxos_event("old round, ignore");
return;
}
- assert(accept->last_committed == last_committed || // not committed
+ ceph_assert(accept->last_committed == last_committed || // not committed
accept->last_committed == last_committed-1); // committed
- assert(is_updating() || is_updating_previous());
- assert(accepted.count(from) == 0);
+ ceph_assert(is_updating() || is_updating_previous());
+ ceph_assert(accepted.count(from) == 0);
accepted.insert(from);
dout(10) << " now " << accepted << " have accepted" << dendl;
- assert(g_conf()->paxos_kill_at != 6);
+ ceph_assert(g_conf()->paxos_kill_at != 6);
// only commit (and expose committed state) when we get *all* quorum
// members to accept. otherwise, they may still be sharing the now
{
dout(1) << "accept timeout, calling fresh election" << dendl;
accept_timeout_event = 0;
- assert(mon->is_leader());
- assert(is_updating() || is_updating_previous() || is_writing() ||
+ ceph_assert(mon->is_leader());
+ ceph_assert(is_updating() || is_updating_previous() || is_writing() ||
is_writing_previous());
logger->inc(l_paxos_accept_timeout);
mon->bootstrap();
Paxos *paxos;
explicit C_Committed(Paxos *p) : paxos(p) {}
void finish(int r) override {
- assert(r >= 0);
+ ceph_assert(r >= 0);
Mutex::Locker l(paxos->mon->lock);
if (paxos->is_shutdown()) {
paxos->abort_commit();
void Paxos::abort_commit()
{
- assert(commits_started > 0);
+ ceph_assert(commits_started > 0);
--commits_started;
if (commits_started == 0)
shutdown_cond.Signal();
{
dout(10) << __func__ << " " << (last_committed+1) << dendl;
- assert(g_conf()->paxos_kill_at != 7);
+ ceph_assert(g_conf()->paxos_kill_at != 7);
auto t(std::make_shared<MonitorDBStore::Transaction>());
utime_t end = ceph_clock_now();
logger->tinc(l_paxos_commit_latency, end - commit_start_stamp);
- assert(g_conf()->paxos_kill_at != 8);
+ ceph_assert(g_conf()->paxos_kill_at != 8);
// cancel lease - it was for the old value.
// (this would only happen if message layer lost the 'begin', but
mon->send_mon_message(commit, *p);
}
- assert(g_conf()->paxos_kill_at != 9);
+ ceph_assert(g_conf()->paxos_kill_at != 9);
// get ready for a new round.
new_value.clear();
// among other things, this lets do_refresh() -> mon->bootstrap() ->
// wait_for_paxos_write() know that it doesn't need to flush the store
// queue. and it should not, as we are in the async completion thread now!
- assert(is_writing() || is_writing_previous());
+ ceph_assert(is_writing() || is_writing_previous());
state = STATE_REFRESH;
- assert(commits_started > 0);
+ ceph_assert(commits_started > 0);
--commits_started;
if (do_refresh()) {
extend_lease();
}
- assert(g_conf()->paxos_kill_at != 10);
+ ceph_assert(g_conf()->paxos_kill_at != 10);
finish_round();
}
void Paxos::extend_lease()
{
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
//assert(is_active());
lease_expire = ceph_clock_now();
void Paxos::commit_proposal()
{
dout(10) << __func__ << dendl;
- assert(mon->is_leader());
- assert(is_refresh());
+ ceph_assert(mon->is_leader());
+ ceph_assert(is_refresh());
finish_contexts(g_ceph_context, committing_finishers);
}
void Paxos::finish_round()
{
dout(10) << __func__ << dendl;
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
// ok, now go active!
state = STATE_ACTIVE;
void Paxos::lease_ack_timeout()
{
dout(1) << "lease_ack_timeout -- calling new election" << dendl;
- assert(mon->is_leader());
- assert(is_active());
+ ceph_assert(mon->is_leader());
+ ceph_assert(is_active());
logger->inc(l_paxos_lease_ack_timeout);
lease_ack_timeout_event = 0;
mon->bootstrap();
void Paxos::lease_timeout()
{
dout(1) << "lease_timeout -- calling new election" << dendl;
- assert(mon->is_peon());
+ ceph_assert(mon->is_peon());
logger->inc(l_paxos_lease_timeout);
lease_timeout_event = 0;
mon->bootstrap();
*/
void Paxos::trim()
{
- assert(should_trim());
+ ceph_assert(should_trim());
version_t end = std::min(get_version() - g_conf()->paxos_min,
get_first_committed() + g_conf()->paxos_trim_max);
void Paxos::dispatch(MonOpRequestRef op)
{
- assert(op->is_type_paxos());
+ ceph_assert(op->is_type_paxos());
op->mark_paxos_event("dispatch");
PaxosServiceMessage *m = static_cast<PaxosServiceMessage*>(op->get_req());
// election in progress?
}
// check sanity
- assert(mon->is_leader() ||
+ ceph_assert(mon->is_leader() ||
(mon->is_peon() && m->get_source().num() == mon->get_leader()));
switch (m->get_type()) {
void Paxos::propose_pending()
{
- assert(is_active());
- assert(pending_proposal);
+ ceph_assert(is_active());
+ ceph_assert(pending_proposal);
cancel_events();
void Paxos::queue_pending_finisher(Context *onfinished)
{
dout(5) << __func__ << " " << onfinished << dendl;
- assert(onfinished);
+ ceph_assert(onfinished);
pending_finishers.push_back(onfinished);
}
MonitorDBStore::TransactionRef Paxos::get_pending_transaction()
{
- assert(mon->is_leader());
+ ceph_assert(mon->is_leader());
if (!pending_proposal) {
pending_proposal.reset(new MonitorDBStore::Transaction);
- assert(pending_finishers.empty());
+ ceph_assert(pending_finishers.empty());
}
return pending_proposal;
}
return plugged;
}
void plug() {
- assert(plugged == false);
+ ceph_assert(plugged == false);
plugged = true;
}
void unplug() {
- assert(plugged == true);
+ ceph_assert(plugged == true);
plugged = false;
}
* @param onreadable A callback
*/
void wait_for_readable(MonOpRequestRef op, Context *onreadable) {
- assert(!is_readable());
+ ceph_assert(!is_readable());
if (op)
op->mark_event("paxos:wait_for_readable");
waiting_for_readable.push_back(onreadable);
* @param c A callback
*/
void wait_for_writeable(MonOpRequestRef op, Context *c) {
- assert(!is_writeable());
+ ceph_assert(!is_writeable());
if (op)
op->mark_event("paxos:wait_for_writeable");
waiting_for_writeable.push_back(c);
public:
virtual ~PaxosFSMap() {}
- const FSMap &get_pending_fsmap() const { assert(is_leader()); return pending_fsmap; }
+ const FSMap &get_pending_fsmap() const { ceph_assert(is_leader()); return pending_fsmap; }
const FSMap &get_fsmap() const { return fsmap; }
virtual bool is_leader() const = 0;
protected:
- FSMap &get_pending_fsmap_writeable() { assert(is_leader()); return pending_fsmap; }
+ FSMap &get_pending_fsmap_writeable() { ceph_assert(is_leader()); return pending_fsmap; }
FSMap &create_pending() {
- assert(is_leader());
+ ceph_assert(is_leader());
pending_fsmap = fsmap;
pending_fsmap.epoch++;
return pending_fsmap;
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_assert(0 == "bad return value for proposal_timer");
}
});
dout(10) << " setting proposal_timer " << do_propose
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_assert(0 == "bad return value for C_Committed");
}
};
paxos->queue_pending_finisher(new C_Committed(this));
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;
else if (r == -ECANCELED)
return;
else
- assert(0 == "bad C_RetryMessage return value");
+ ceph_assert(0 == "bad C_RetryMessage return value");
}
};
* request on hold, for instance.
*/
void request_proposal() {
- assert(is_writeable());
+ ceph_assert(is_writeable());
propose_pending();
}
* set a flag stating we're waiting on a cross-proposal to be finished.
*/
void request_proposal(PaxosService *other) {
- assert(other != NULL);
- assert(other->is_writeable());
+ ceph_assert(other != NULL);
+ ceph_assert(other->is_writeable());
other->request_proposal();
}
~MonSession() override {
//generic_dout(0) << "~MonSession " << this << dendl;
// we should have been removed before we get destructed; see MonSessionMap::remove_session()
- assert(!item.is_on_list());
- assert(sub_map.empty());
+ ceph_assert(!item.is_on_list());
+ ceph_assert(sub_map.empty());
delete auth_handler;
}
MonSessionMap() {}
~MonSessionMap() {
while (!subs.empty()) {
- assert(subs.begin()->second->empty());
+ ceph_assert(subs.begin()->second->empty());
delete subs.begin()->second;
subs.erase(subs.begin());
}
}
void remove_session(MonSession *s) {
- assert(!s->closed);
+ ceph_assert(!s->closed);
for (map<string,Subscription*>::iterator p = s->sub_map.begin(); p != s->sub_map.end(); ++p) {
p->second->type_item.remove_myself();
delete p->second;
const entity_addrvec_t& av,
Connection *c) {
MonSession *s = new MonSession(n, av, c);
- assert(s);
+ ceph_assert(s);
sessions.push_back(&s->item);
if (n.is_osd())
by_osd.insert(pair<int,MonSession*>(n.num(), s));
health_check_t& add(const std::string& code,
health_status_t severity,
const std::string& summary) {
- assert(checks.count(code) == 0);
+ ceph_assert(checks.count(code) == 0);
health_check_t& r = checks[code];
r.severity = severity;
r.summary = summary;
return;
}
auto p = m.find(type);
- assert(p != m.end());
+ ceph_assert(p != m.end());
auto q = p->second.find(features);
- assert(q != p->second.end());
+ ceph_assert(q != p->second.end());
if (--q->second == 0) {
p->second.erase(q);
if (p->second.empty()) {
{}
void dump(Formatter *f) const {
- assert(f != NULL);
+ ceph_assert(f != NULL);
f->dump_int("bytes_total", bytes_total);
f->dump_int("bytes_sst", bytes_sst);
f->dump_int("bytes_log", bytes_log);
LevelDBStoreStats store_stats;
void dump(Formatter *f) const {
- assert(f != NULL);
+ ceph_assert(f != NULL);
f->dump_int("kb_total", (fs_stats.byte_total/1024));
f->dump_int("kb_used", (fs_stats.byte_used/1024));
f->dump_int("kb_avail", (fs_stats.byte_avail/1024));