From 1bc987ac9254d9fa35cfcb614d9cfacd628c732b Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 23 Aug 2018 11:21:04 -0400 Subject: [PATCH] rgw: Use ceph_assert for asserts. Signed-off-by: Adam C. Emerson --- src/rgw/rgw_admin.cc | 2 +- src/rgw/rgw_bucket.cc | 4 ++-- src/rgw/rgw_client_io.h | 6 +++--- src/rgw/rgw_common.cc | 2 +- src/rgw/rgw_coroutine.cc | 12 ++++++------ src/rgw/rgw_cr_rados.h | 2 +- src/rgw/rgw_file.cc | 10 +++++----- src/rgw/rgw_file.h | 34 +++++++++++++++++----------------- src/rgw/rgw_frontend.h | 2 +- src/rgw/rgw_gc.cc | 2 +- src/rgw/rgw_http_client.cc | 8 ++++---- src/rgw/rgw_keystone.cc | 6 +++--- src/rgw/rgw_metadata.cc | 6 +++--- src/rgw/rgw_orphan.cc | 2 +- src/rgw/rgw_period_history.cc | 2 +- src/rgw/rgw_process.h | 2 +- src/rgw/rgw_rados.cc | 28 ++++++++++++++-------------- src/rgw/rgw_realm_watcher.cc | 2 +- src/rgw/rgw_reshard.h | 2 +- src/rgw/rgw_rest_client.cc | 2 +- src/rgw/rgw_sync.cc | 14 +++++++------- src/rgw/rgw_sync_log_trim.cc | 6 +++--- src/rgw/rgw_sync_module_aws.cc | 2 +- 23 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 1797051a5eb6c..3cd7e26741120 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2542,7 +2542,7 @@ static int scan_totp(CephContext *cct, ceph::real_time& now, rados::cls::otp::ot time_t *pofs) { #define MAX_TOTP_SKEW_HOURS (24 * 7) - assert(pins.size() == 2); + ceph_assert(pins.size() == 2); time_t start_time = ceph::real_clock::to_time_t(now); time_t time_ofs = 0, time_ofs_abs = 0; diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 6cce9f7c15408..14828ce9bad43 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1766,7 +1766,7 @@ int RGWDataChangesLog::renew_entries() void RGWDataChangesLog::_get_change(const rgw_bucket_shard& bs, ChangeStatusPtr& status) { - assert(lock.is_locked()); + ceph_assert(lock.is_locked()); if (!changes.find(bs, status)) { status = ChangeStatusPtr(new ChangeStatus); changes.add(bs, status); @@ -1830,7 +1830,7 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket, int shard_id) { if (status->pending) { cond = status->cond; - assert(cond); + ceph_assert(cond); status->cond->get(); status->lock->Unlock(); diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h index 6f904e01be68a..1f5af6769645b 100644 --- a/src/rgw/rgw_client_io.h +++ b/src/rgw/rgw_client_io.h @@ -354,20 +354,20 @@ public: /* Type conversions to work around lack of req_state type hierarchy matching * (e.g.) REST backends (may be replaced w/dynamic typed req_state). */ static inline rgw::io::RestfulClient* RESTFUL_IO(struct req_state* s) { - assert(dynamic_cast(s->cio) != nullptr); + ceph_assert(dynamic_cast(s->cio) != nullptr); return static_cast(s->cio); } static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) { auto ptr = dynamic_cast(s->cio); - assert(ptr != nullptr); + ceph_assert(ptr != nullptr); return ptr; } static inline RGWRestfulIO* AWS_AUTHv4_IO(const req_state* const s) { - assert(dynamic_cast(s->cio) != nullptr); + ceph_assert(dynamic_cast(s->cio) != nullptr); return static_cast(s->cio); } diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 2e544b43418eb..44d26de9f3d50 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -171,7 +171,7 @@ int rgw_perf_start(CephContext *cct) void rgw_perf_stop(CephContext *cct) { - assert(perfcounter); + ceph_assert(perfcounter); cct->get_perfcounters_collection()->remove(perfcounter); delete perfcounter; } diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 89f7b33d20580..ff30dc89a0185 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -110,7 +110,7 @@ void RGWCompletionManager::go_down() void RGWCompletionManager::wait_interval(void *opaque, const utime_t& interval, void *user_info) { Mutex::Locker l(lock); - assert(waiters.find(opaque) == waiters.end()); + ceph_assert(waiters.find(opaque) == waiters.end()); waiters[opaque] = user_info; timer.add_event_after(interval, new WaitContext(this, opaque)); } @@ -242,7 +242,7 @@ int RGWCoroutinesStack::operate(RGWCoroutinesEnv *_env) } /* should r ever be negative at this point? */ - assert(r >= 0); + ceph_assert(r >= 0); return 0; } @@ -530,7 +530,7 @@ bool RGWCoroutinesStack::consume_io_finish(const rgw_io_id& io_id) void RGWCoroutinesManager::handle_unblocked_stack(set& context_stacks, list& scheduled_stacks, RGWCompletionManager::io_completion& io, int *blocked_count) { - assert(lock.is_wlocked()); + ceph_assert(lock.is_wlocked()); RGWCoroutinesStack *stack = static_cast(io.user_info); if (context_stacks.find(stack) == context_stacks.end()) { return; @@ -562,7 +562,7 @@ void RGWCoroutinesManager::schedule(RGWCoroutinesEnv *env, RGWCoroutinesStack *s void RGWCoroutinesManager::_schedule(RGWCoroutinesEnv *env, RGWCoroutinesStack *stack) { - assert(lock.is_wlocked()); + ceph_assert(lock.is_wlocked()); if (!stack->is_scheduled) { env->scheduled_stacks->push_back(stack); stack->set_is_scheduled(true); @@ -732,7 +732,7 @@ next: lderr(cct) << __func__ << "(): ERROR: deadlock detected, dumping remaining coroutines:\n"; formatter.flush(*_dout); *_dout << dendl; - assert(context_stacks.empty() || going_down); // assert on deadlock + ceph_assert(context_stacks.empty() || going_down); // assert on deadlock } for (auto stack : context_stacks) { @@ -923,7 +923,7 @@ ostream& operator<<(ostream& out, const RGWCoroutine& cr) bool RGWCoroutine::drain_children(int num_cr_left, RGWCoroutinesStack *skip_stack) { bool done = false; - assert(num_cr_left >= 0); + ceph_assert(num_cr_left >= 0); if (num_cr_left == 0 && skip_stack) { num_cr_left = 1; } diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 13d6a29c32590..a8bf01f5f96bf 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -82,7 +82,7 @@ protected: void _process(RGWAsyncRadosRequest *req, ThreadPool::TPHandle& handle) override; void _dump_queue(); void _clear() override { - assert(processor->m_req_queue.empty()); + ceph_assert(processor->m_req_queue.empty()); } } req_wq; diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index ab6b27f13e060..12aa9da3b763b 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -987,7 +987,7 @@ namespace rgw { auto bl_iter_key1 = ux_key1->cbegin(); decode(fhk, bl_iter_key1); if (fhk.version >= 2) { - assert(this->fh.fh_hk == fhk.fh_hk); + ceph_assert(this->fh.fh_hk == fhk.fh_hk); } else { get<0>(dar) = true; } @@ -1290,8 +1290,8 @@ namespace rgw { s->bucket_info.placement_rule); /* not obviously supportable */ - assert(! dlo_manifest); - assert(! slo_info); + ceph_assert(! dlo_manifest); + ceph_assert(! slo_info); perfcounter->inc(l_rgw_put); op_ret = -EINVAL; @@ -1542,7 +1542,7 @@ void rgwfile_version(int *major, int *minor, int *extra) /* stash access data for "mount" */ RGWLibFS* new_fs = new RGWLibFS(static_cast(rgw), uid, acc_key, sec_key, "/"); - assert(new_fs); + ceph_assert(new_fs); rc = new_fs->authorize(rgwlib.get_store()); if (rc != 0) { @@ -1573,7 +1573,7 @@ int rgw_mount2(librgw_t rgw, const char *uid, const char *acc_key, /* stash access data for "mount" */ RGWLibFS* new_fs = new RGWLibFS(static_cast(rgw), uid, acc_key, sec_key, root); - assert(new_fs); + ceph_assert(new_fs); rc = new_fs->authorize(rgwlib.get_store()); if (rc != 0) { diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 6bbdb3f978f85..cc39c101e1bc2 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -637,7 +637,7 @@ namespace rgw { DECODE_START(2, bl); uint32_t fh_type; decode(fh_type, bl); - assert(fh.fh_type == fh_type); + ceph_assert(fh.fh_type == fh_type); decode(state.dev, bl); decode(state.size, bl); decode(state.nlink, bl); @@ -1266,7 +1266,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1402,7 +1402,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1436,7 +1436,7 @@ public: int operator()(const boost::string_ref name, const rgw_obj_key& marker, uint8_t type) { - assert(name.length() > 0); // XXX + ceph_assert(name.length() > 0); // XXX /* hash offset of name in parent (short name) for NFS readdir cookie */ uint64_t off = XXH64(name.data(), name.length(), fh_key::seed); @@ -1574,7 +1574,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1659,7 +1659,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1723,7 +1723,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1781,7 +1781,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED @@ -1879,7 +1879,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -1965,7 +1965,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2047,7 +2047,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2128,7 +2128,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2198,7 +2198,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2321,7 +2321,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2429,7 +2429,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED @@ -2512,7 +2512,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; @@ -2565,7 +2565,7 @@ public: RGWObjectCtx* rados_ctx = static_cast(get_state()->obj_ctx); // framework promises to call op_init after parent init - assert(rados_ctx); + ceph_assert(rados_ctx); RGWOp::init(rados_ctx->store, get_state(), this); op = this; // assign self as op: REQUIRED return 0; diff --git a/src/rgw/rgw_frontend.h b/src/rgw/rgw_frontend.h index 80746b955b56a..aec3943ca1ae4 100644 --- a/src/rgw/rgw_frontend.h +++ b/src/rgw/rgw_frontend.h @@ -163,7 +163,7 @@ public: } int run() override { - assert(pprocess); /* should have initialized by init() */ + ceph_assert(pprocess); /* should have initialized by init() */ thread = new RGWProcessControlThread(pprocess); thread->create("rgw_frontend"); return 0; diff --git a/src/rgw/rgw_gc.cc b/src/rgw/rgw_gc.cc index 2570a752e99a0..9c770ea621be0 100644 --- a/src/rgw/rgw_gc.cc +++ b/src/rgw/rgw_gc.cc @@ -180,7 +180,7 @@ public: } void handle_next_completion() { - assert(!ios.empty()); + ceph_assert(!ios.empty()); IO& io = ios.front(); io.c->wait_for_safe(); int ret = io.c->get_return_value(); diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index ffbc7bcd7579b..0002e5054548e 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -371,7 +371,7 @@ Mutex& RGWHTTPClient::get_req_lock() void RGWHTTPClient::_set_write_paused(bool pause) { - assert(req_data->lock.is_locked()); + ceph_assert(req_data->lock.is_locked()); RGWHTTPManager *mgr = req_data->mgr; if (pause == req_data->write_paused) { @@ -386,7 +386,7 @@ void RGWHTTPClient::_set_write_paused(bool pause) void RGWHTTPClient::_set_read_paused(bool pause) { - assert(req_data->lock.is_locked()); + ceph_assert(req_data->lock.is_locked()); RGWHTTPManager *mgr = req_data->mgr; if (pause == req_data->read_paused) { @@ -470,7 +470,7 @@ int RGWHTTPClient::get_req_retcode() */ int RGWHTTPClient::init_request(rgw_http_req_data *_req_data, bool send_data_hint) { - assert(!req_data); + ceph_assert(!req_data); _req_data->get(); req_data = _req_data; @@ -987,7 +987,7 @@ int RGWHTTPManager::set_request_state(RGWHTTPClient *client, RGWHTTPRequestSetSt { rgw_http_req_data *req_data = client->get_req_data(); - assert(req_data->lock.is_locked()); + ceph_assert(req_data->lock.is_locked()); /* can only do that if threaded */ if (!is_started) { diff --git a/src/rgw/rgw_keystone.cc b/src/rgw/rgw_keystone.cc index 19386239b918d..dda3947527799 100644 --- a/src/rgw/rgw_keystone.cc +++ b/src/rgw/rgw_keystone.cc @@ -415,7 +415,7 @@ bool TokenCache::find(const std::string& token_id, bool TokenCache::find_locked(const std::string& token_id, rgw::keystone::TokenEnvelope& token) { - assert(lock.is_locked_by_me()); + ceph_assert(lock.is_locked_by_me()); map::iterator iter = tokens.find(token_id); if (iter == tokens.end()) { if (perfcounter) perfcounter->inc(l_rgw_keystone_token_cache_miss); @@ -464,7 +464,7 @@ void TokenCache::add(const std::string& token_id, void TokenCache::add_locked(const std::string& token_id, const rgw::keystone::TokenEnvelope& token) { - assert(lock.is_locked_by_me()); + ceph_assert(lock.is_locked_by_me()); map::iterator iter = tokens.find(token_id); if (iter != tokens.end()) { token_entry& e = iter->second; @@ -479,7 +479,7 @@ void TokenCache::add_locked(const std::string& token_id, while (tokens_lru.size() > max) { list::reverse_iterator riter = tokens_lru.rbegin(); iter = tokens.find(*riter); - assert(iter != tokens.end()); + ceph_assert(iter != tokens.end()); tokens.erase(iter); tokens_lru.pop_back(); } diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 8ee97ce55496c..77064f351c3cb 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -550,7 +550,7 @@ Cursor find_oldest_period(RGWRados *store) } ldout(cct, 20) << "find_oldest_period advancing to " "predecessor period " << predecessor << dendl; - assert(cursor.has_prev()); + ceph_assert(cursor.has_prev()); } cursor.prev(); } @@ -993,7 +993,7 @@ int RGWMetadataManager::pre_modify(RGWMetadataHandler *handler, string& section, bufferlist logbl; encode(log_data, logbl); - assert(current_log); // must have called init() + ceph_assert(current_log); // must have called init() int ret = current_log->add_entry(handler, section, key, logbl); if (ret < 0) return ret; @@ -1012,7 +1012,7 @@ int RGWMetadataManager::post_modify(RGWMetadataHandler *handler, const string& s bufferlist logbl; encode(log_data, logbl); - assert(current_log); // must have called init() + ceph_assert(current_log); // must have called init() int r = current_log->add_entry(handler, section, key, logbl); if (ret < 0) return ret; diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 6e7d03d8b013b..707cc54fb6656 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -670,7 +670,7 @@ int OMAPReader::get_next(string *key, bufferlist *pbl, bool *done) int RGWOrphanSearch::compare_oid_indexes() { - assert(linked_objs_index.size() == all_objs_index.size()); + ceph_assert(linked_objs_index.size() == all_objs_index.size()); librados::IoCtx& ioctx = orphan_store.get_ioctx(); diff --git a/src/rgw/rgw_period_history.cc b/src/rgw/rgw_period_history.cc index 1f0dbee1cd012..d11cb3c356b5a 100644 --- a/src/rgw/rgw_period_history.cc +++ b/src/rgw/rgw_period_history.cc @@ -303,7 +303,7 @@ Cursor RGWPeriodHistory::Impl::insert_locked(RGWPeriod&& period) RGWPeriodHistory::Impl::Set::iterator RGWPeriodHistory::Impl::merge(Set::iterator dst, Set::iterator src) { - assert(dst->get_newest_epoch() + 1 == src->get_oldest_epoch()); + ceph_assert(dst->get_newest_epoch() + 1 == src->get_oldest_epoch()); // always merge into current_history if (src == current_history) { diff --git a/src/rgw/rgw_process.h b/src/rgw/rgw_process.h index ae0585c43cc95..fb73406cfaf25 100644 --- a/src/rgw/rgw_process.h +++ b/src/rgw/rgw_process.h @@ -98,7 +98,7 @@ protected: void _dump_queue(); void _clear() override { - assert(process->m_req_queue.empty()); + ceph_assert(process->m_req_queue.empty()); } } req_wq; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index b9a07a827cd24..b64b1cc0811a4 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1538,7 +1538,7 @@ int RGWPeriod::update_sync_status(const RGWPeriod ¤t_period, const auto current_epoch = current_period.get_realm_epoch(); if (current_epoch != status.sync_info.realm_epoch) { // no sync status markers for the current period - assert(current_epoch > status.sync_info.realm_epoch); + ceph_assert(current_epoch > status.sync_info.realm_epoch); const int behind = current_epoch - status.sync_info.realm_epoch; if (!force_if_stale && current_epoch > 1) { error_stream << "ERROR: This zone is " << behind << " period(s) behind " @@ -3387,7 +3387,7 @@ void RGWRados::wakeup_data_sync_shards(const string& source_zone, mapsecond; - assert(thread); + ceph_assert(thread); thread->wakeup_sync_shards(shard_ids); } @@ -6441,7 +6441,7 @@ int RGWRados::create_pools(vector& pools, vector& retcodes) vector::iterator citer; bool error = false; - assert(rets.size() == completions.size()); + ceph_assert(rets.size() == completions.size()); for (riter = rets.begin(), citer = completions.begin(); riter != rets.end(); ++riter, ++citer) { int r = *riter; PoolAsyncCompletion *c = *citer; @@ -6482,7 +6482,7 @@ int RGWRados::create_pools(vector& pools, vector& retcodes) completions.push_back(c); int ret = io_ctx.application_enable_async(pg_pool_t::APPLICATION_NAME_RGW, false, c); - assert(ret == 0); + ceph_assert(ret == 0); } retcodes.clear(); @@ -7553,7 +7553,7 @@ class RGWPutObj_Buffer : public RGWPutObj_Filter { public: RGWPutObj_Buffer(RGWPutObjDataProcessor* next, unsigned buffer_size) : RGWPutObj_Filter(next), buffer_size(buffer_size) { - assert(isp2(buffer_size)); // must be power of 2 + ceph_assert(isp2(buffer_size)); // must be power of 2 } int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, @@ -7661,7 +7661,7 @@ public: } } - assert(uint64_t(ofs) >= extra_data_len); + ceph_assert(uint64_t(ofs) >= extra_data_len); lofs = ofs - extra_data_len; @@ -9473,7 +9473,7 @@ static bool has_olh_tag(map& attrs) int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState *olh_state, RGWObjState **target_state) { - assert(olh_state->is_olh); + ceph_assert(olh_state->is_olh); rgw_obj target; int r = RGWRados::follow_olh(bucket_info, obj_ctx, olh_state, obj, &target); /* might return -EAGAIN */ @@ -10788,7 +10788,7 @@ struct get_obj_data : public RefCountedObject { const auto& io_iter = io_map.insert( map::value_type(ofs, get_obj_io())); - assert(io_iter.second); // assert new insertion + ceph_assert(io_iter.second); // assert new insertion get_obj_io& io = (io_iter.first)->second; *pbl = &io.bl; @@ -11197,7 +11197,7 @@ int RGWRados::olh_init_modification_impl(const RGWBucketInfo& bucket_info, RGWOb { ObjectWriteOperation op; - assert(olh_obj.key.instance.empty()); + ceph_assert(olh_obj.key.instance.empty()); bool has_tag = (state.exists && has_olh_tag(state.attrset)); @@ -11942,7 +11942,7 @@ int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx } map::iterator iter = state->attrset.find(RGW_ATTR_OLH_INFO); - assert(iter != state->attrset.end()); + ceph_assert(iter != state->attrset.end()); RGWOLHInfo olh; try { auto biter = iter->second.cbegin(); @@ -12019,7 +12019,7 @@ int RGWRados::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, string return r; } - assert(headers.size() == bucket_instance_ids.size()); + ceph_assert(headers.size() == bucket_instance_ids.size()); auto iter = headers.begin(); map::iterator viter = bucket_instance_ids.begin(); @@ -12058,7 +12058,7 @@ int RGWRados::get_bi_log_status(RGWBucketInfo& bucket_info, int shard_id, if (r < 0) return r; - assert(headers.size() == bucket_instance_ids.size()); + ceph_assert(headers.size() == bucket_instance_ids.size()); auto iter = headers.begin(); map::iterator viter = bucket_instance_ids.begin(); @@ -12116,7 +12116,7 @@ int RGWRados::get_bucket_stats_async(RGWBucketInfo& bucket_info, int shard_id, R { int num_aio = 0; RGWGetBucketStatsContext *get_ctx = new RGWGetBucketStatsContext(ctx, bucket_info.num_shards ? : 1); - assert(get_ctx); + ceph_assert(get_ctx); int r = cls_bucket_head_async(bucket_info, shard_id, get_ctx, &num_aio); if (r < 0) { ctx->put(); @@ -13509,7 +13509,7 @@ int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info, return r; const std::string& oid = oids[current_shard]; - assert(list_results.find(current_shard) != list_results.end()); + ceph_assert(list_results.find(current_shard) != list_results.end()); auto& result = list_results[current_shard]; for (auto& entry : result.dir.m) { rgw_bucket_dir_entry& dirent = entry.second; diff --git a/src/rgw/rgw_realm_watcher.cc b/src/rgw/rgw_realm_watcher.cc index ae77128e10a6e..57cdc85a9f9bb 100644 --- a/src/rgw/rgw_realm_watcher.cc +++ b/src/rgw/rgw_realm_watcher.cc @@ -123,7 +123,7 @@ int RGWRealmWatcher::watch_start(RGWRealm& realm) int RGWRealmWatcher::watch_restart() { - assert(!watch_oid.empty()); + ceph_assert(!watch_oid.empty()); int r = pool_ctx.unwatch2(watch_handle); if (r < 0) { lderr(cct) << "Failed to unwatch on " << watch_oid diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h index 3e45625d97151..c6e56e14fca31 100644 --- a/src/rgw/rgw_reshard.h +++ b/src/rgw/rgw_reshard.h @@ -114,7 +114,7 @@ class RGWReshardWait { public: explicit RGWReshardWait(RGWRados *_store) : store(_store) {} ~RGWReshardWait() { - assert(going_down); + ceph_assert(going_down); } int block_while_resharding(RGWRados::BucketShard *bs, string *new_bucket_id); diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 73833eef0fb20..e0a1900b57546 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -894,7 +894,7 @@ int RGWHTTPStreamRWRequest::receive_data(void *ptr, size_t len, bool *pause) in_data.clear(); } else { /* partial read */ - assert(in_data.length() <= orig_in_data_len); + ceph_assert(in_data.length() <= orig_in_data_len); len = ret; bufferlist bl; size_t left_to_read = orig_in_data_len - len; diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index bf0dde2dec5b2..70f9328399db5 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1493,7 +1493,7 @@ public: } map::iterator prev_iter = pos_to_prev.find(pos); - assert(prev_iter != pos_to_prev.end()); + ceph_assert(prev_iter != pos_to_prev.end()); /* * we should get -EAGAIN for transient errors, for which we want to retry, so we don't @@ -1510,7 +1510,7 @@ public: } pos_to_prev.erase(prev_iter); } else { - assert(pos_to_prev.size() > 1); + ceph_assert(pos_to_prev.size() > 1); pos_to_prev.erase(prev_iter); prev_iter = pos_to_prev.begin(); if (can_adjust_marker) { @@ -1660,7 +1660,7 @@ public: tn->log(10, "full sync complete"); // apply the sync marker update - assert(temp_marker); + ceph_assert(temp_marker); sync_marker = std::move(*temp_marker); temp_marker = boost::none; // must not yield after this point! @@ -1783,7 +1783,7 @@ public: raw_key = log_iter->section + ":" + log_iter->name; yield { RGWCoroutinesStack *stack = spawn(new RGWMetaSyncSingleEntryCR(sync_env, raw_key, log_iter->id, mdlog_entry.log_data.status, marker_tracker, tn), false); - assert(stack); + ceph_assert(stack); // stack_to_pos holds a reference to the stack stack_to_pos[stack] = log_iter->id; pos_to_prev[log_iter->id] = marker; @@ -1981,7 +1981,7 @@ public: return set_cr_error(ret); } // advance to the next period - assert(next); + ceph_assert(next); cursor = next; // write the updated sync info @@ -2508,7 +2508,7 @@ int PurgePeriodLogsCR::operate() if (retcode < 0) { return set_cr_error(retcode); } - assert(cursor); + ceph_assert(cursor); ldout(cct, 20) << "oldest log realm_epoch=" << cursor.get_epoch() << " period=" << cursor.get_period().get_id() << dendl; @@ -2549,7 +2549,7 @@ int PurgePeriodLogsCR::operate() *last_trim_epoch = cursor.get_epoch(); } - assert(cursor.has_next()); // get_current() should always come after + ceph_assert(cursor.has_next()); // get_current() should always come after cursor.next(); } return set_cr_done(); diff --git a/src/rgw/rgw_sync_log_trim.cc b/src/rgw/rgw_sync_log_trim.cc index 69deff51cb19d..cebc4aa05f095 100644 --- a/src/rgw/rgw_sync_log_trim.cc +++ b/src/rgw/rgw_sync_log_trim.cc @@ -621,7 +621,7 @@ int AsyncMetadataList::_send_request() marker = mgr->get_marker(handle); if (!keys.empty()) { - assert(keys.size() == 1); + ceph_assert(keys.size() == 1); auto& key = keys.front(); if (!callback(std::move(key), std::move(marker))) { return 0; @@ -657,7 +657,7 @@ int AsyncMetadataList::_send_request() marker = mgr->get_marker(handle); if (!keys.empty()) { - assert(keys.size() == 1); + ceph_assert(keys.size() == 1); auto& key = keys.front(); // stop at original marker if (marker >= start_marker) { @@ -938,7 +938,7 @@ class RecentEventList { /// insert an event at the given point in time. this time must be at least as /// recent as the last inserted event void insert(T&& value, const time_point& now) { - // assert(events.empty() || now >= events.back().time) + // ceph_assert(events.empty() || now >= events.back().time) events.push_back(Event{std::move(value), now}); } diff --git a/src/rgw/rgw_sync_module_aws.cc b/src/rgw/rgw_sync_module_aws.cc index 565536a772cc9..1cf07e71e95f1 100644 --- a/src/rgw/rgw_sync_module_aws.cc +++ b/src/rgw/rgw_sync_module_aws.cc @@ -672,7 +672,7 @@ struct AWSSyncInstanceEnv { void get_profile(const rgw_bucket& bucket, std::shared_ptr *ptarget) { conf.find_profile(bucket, ptarget); - assert(ptarget); + ceph_assert(ptarget); } }; -- 2.39.5