Skip to content

Commit bf8b23b

Browse files
committed
mon: s/assert/ceph_assert/g'
Now that we fallback to RelDebWithInfo [1], C asserts are not compiled in. Replace some of the existing asserts with ceph_assserts instead. [1] ceph#61637 Fixes: https://tracker.ceph.com/issues/71360 Signed-off-by: Matan Breizman <[email protected]>
1 parent 22025a6 commit bf8b23b

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

src/mon/ElectionLogic.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void ElectionLogic::bump_epoch(epoch_t e)
8686

8787
void ElectionLogic::declare_standalone_victory()
8888
{
89-
assert(elector->paxos_size() == 1 && elector->get_my_rank() == 0);
89+
ceph_assert(elector->paxos_size() == 1 && elector->get_my_rank() == 0);
9090
init();
9191
bump_epoch(epoch+1);
9292
}

src/mon/LogMonitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void LogMonitor::log_external_backlog()
465465
} else {
466466
// pre-quincy, we assumed that anything through summary.version was
467467
// logged externally.
468-
assert(r == -ENOENT);
468+
ceph_assert(r == -ENOENT);
469469
external_log_to = summary.version;
470470
dout(10) << __func__ << " initialized external_log_to = " << external_log_to
471471
<< " (summary v " << summary.version << ")" << dendl;

src/mon/MgrMonitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void MgrMonitor::on_active()
725725
return;
726726
}
727727
mon.clog->debug() << "mgrmap e" << map.epoch << ": " << map;
728-
assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
728+
ceph_assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
729729
if (pending_map.always_on_modules == always_on_modules()) {
730730
return;
731731
}

src/mon/MonClient.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ int MonConnection::handle_auth_bad_method(
18611861
auth_registry->get_supported_methods(con->get_peer_type(), &auth_supported);
18621862
auto p = std::find(auth_supported.begin(), auth_supported.end(),
18631863
old_auth_method);
1864-
assert(p != auth_supported.end());
1864+
ceph_assert(p != auth_supported.end());
18651865
p = std::find_first_of(std::next(p), auth_supported.end(),
18661866
allowed_methods.begin(), allowed_methods.end());
18671867
if (p == auth_supported.end()) {

src/mon/Monitor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6545,7 +6545,7 @@ int Monitor::handle_auth_request(
65456545
dout(1) << __func__ << " invalid mode " << (int)mode << dendl;
65466546
return -EACCES;
65476547
}
6548-
assert(mode >= AUTH_MODE_MON && mode <= AUTH_MODE_MON_MAX);
6548+
ceph_assert(mode >= AUTH_MODE_MON && mode <= AUTH_MODE_MON_MAX);
65496549
decode(entity_name, p);
65506550
decode(con->peer_global_id, p);
65516551
} catch (ceph::buffer::error& e) {
@@ -6677,7 +6677,7 @@ bool Monitor::ms_handle_fast_authentication(Connection *con)
66776677
entity_name_t(con->get_peer_type(), -1), // we don't know yet
66786678
con->get_peer_addrs(),
66796679
con);
6680-
assert(s);
6680+
ceph_assert(s);
66816681
dout(10) << __func__ << " adding session " << s << " to con " << con
66826682
<< dendl;
66836683
con->set_priv(s);

src/mon/OSDMonitor.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7795,8 +7795,8 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type,
77957795
*min_size =
77967796
erasure_code->get_data_chunk_count() +
77977797
std::min<int>(1, erasure_code->get_coding_chunk_count() - 1);
7798-
assert(*min_size <= *size);
7799-
assert(*min_size >= erasure_code->get_data_chunk_count());
7798+
ceph_assert(*min_size <= *size);
7799+
ceph_assert(*min_size >= erasure_code->get_data_chunk_count());
78007800
}
78017801
}
78027802
break;
@@ -8678,7 +8678,7 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
86788678
}
86798679
if (osdmap.require_osd_release < ceph_release_t::nautilus) {
86808680
// pre-nautilus osdmap format; increase pg_num directly
8681-
assert(n > (int)p.get_pg_num());
8681+
ceph_assert(n > (int)p.get_pg_num());
86828682
// force pre-nautilus clients to resend their ops, since they
86838683
// don't understand pg_num_target changes form a new interval
86848684
p.last_force_op_resend_prenautilus = pending_inc.epoch;

src/mon/PGMap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const
5757
{
5858
// NOTE: see PGMap::encode_digest
5959
uint8_t v = 5;
60-
assert(HAVE_FEATURE(features, SERVER_NAUTILUS));
60+
ceph_assert(HAVE_FEATURE(features, SERVER_NAUTILUS));
6161
ENCODE_START(v, 1, bl);
6262
encode(num_pg, bl);
6363
encode(num_pg_active, bl);
@@ -84,7 +84,7 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const
8484
void PGMapDigest::decode(bufferlist::const_iterator& p)
8585
{
8686
DECODE_START(5, p);
87-
assert(struct_v >= 4);
87+
ceph_assert(struct_v >= 4);
8888
decode(num_pg, p);
8989
decode(num_pg_active, p);
9090
decode(num_pg_unknown, p);

src/mon/Paxos.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ void Paxos::handle_commit(MonOpRequestRef op)
979979
void Paxos::extend_lease()
980980
{
981981
ceph_assert(mon.is_leader());
982-
//assert(is_active());
982+
//ceph_assert(is_active());
983983

984984
lease_expire = ceph::real_clock::now();
985985
lease_expire += ceph::make_timespan(g_conf()->mon_lease);

0 commit comments

Comments
 (0)