]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Use ceph_assert for asserts.
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 23 Aug 2018 15:21:04 +0000 (11:21 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 27 Aug 2018 13:35:43 +0000 (09:35 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
23 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket.cc
src/rgw/rgw_client_io.h
src/rgw/rgw_common.cc
src/rgw/rgw_coroutine.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/rgw/rgw_frontend.h
src/rgw/rgw_gc.cc
src/rgw/rgw_http_client.cc
src/rgw/rgw_keystone.cc
src/rgw/rgw_metadata.cc
src/rgw/rgw_orphan.cc
src/rgw/rgw_period_history.cc
src/rgw/rgw_process.h
src/rgw/rgw_rados.cc
src/rgw/rgw_realm_watcher.cc
src/rgw/rgw_reshard.h
src/rgw/rgw_rest_client.cc
src/rgw/rgw_sync.cc
src/rgw/rgw_sync_log_trim.cc
src/rgw/rgw_sync_module_aws.cc

index 1797051a5eb6c790b18d784478dac0c3b88a5d6d..3cd7e2674112010ea23ec18740bf69ce9d1263ea 100644 (file)
@@ -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;
index 6cce9f7c154088ee8ada1d9c0ad7c4de471151d7..14828ce9bad431b8a2cc80a4b6521c800a070501 100644 (file)
@@ -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();
index 6f904e01be68a17fa5492cf03d25d4caafdbb7dd..1f5af6769645b0661cdf1ebc6a8b074997c4667b 100644 (file)
@@ -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<rgw::io::RestfulClient*>(s->cio) != nullptr);
+  ceph_assert(dynamic_cast<rgw::io::RestfulClient*>(s->cio) != nullptr);
 
   return static_cast<rgw::io::RestfulClient*>(s->cio);
 }
 
 static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) {
   auto ptr = dynamic_cast<rgw::io::Accounter*>(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<RGWRestfulIO*>(s->cio) != nullptr);
+  ceph_assert(dynamic_cast<RGWRestfulIO*>(s->cio) != nullptr);
 
   return static_cast<RGWRestfulIO*>(s->cio);
 }
index 2e544b43418eb9f025ead4e15d3b7786e029ad03..44d26de9f3d5092c1d05d254e2ed078c58619dda 100644 (file)
@@ -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;
 }
index 89f7b33d20580c1ac1f787cf5e52587290995c51..ff30dc89a0185571d5c8d427af7bce58e147fa28 100644 (file)
@@ -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<RGWCoroutinesStack *>& context_stacks, list<RGWCoroutinesStack *>& scheduled_stacks,
                                                   RGWCompletionManager::io_completion& io, int *blocked_count)
 {
-  assert(lock.is_wlocked());
+  ceph_assert(lock.is_wlocked());
   RGWCoroutinesStack *stack = static_cast<RGWCoroutinesStack *>(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;
   }
index 13d6a29c325909261f56bc4973af8770b1ce236d..a8bf01f5f96bf2dcefff7ef608045f0b36cf029c 100644 (file)
@@ -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;
 
index ab6b27f13e06040ba1251f3c343e01839407e4ac..12aa9da3b763b29e4de17cf4c891a851c30d4204 100644 (file)
@@ -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<CephContext*>(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<CephContext*>(rgw), uid, acc_key,
                                  sec_key, root);
-  assert(new_fs);
+  ceph_assert(new_fs);
 
   rc = new_fs->authorize(rgwlib.get_store());
   if (rc != 0) {
index 6bbdb3f978f858a9746faf515a0498893a86344d..cc39c101e1bc2163b5c61e4f46ec719868b27076 100644 (file)
@@ -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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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<RGWObjectCtx*>(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;
index 80746b955b56ac249742a4459ee5eaa2716fc68d..aec3943ca1ae4a5627c24a59d85f03d683631b8e 100644 (file)
@@ -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;
index 2570a752e99a0959b082c5433e3290109348665a..9c770ea621be080eab55e3058eddb6dd5244d619 100644 (file)
@@ -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();
index ffbc7bcd7579b21bfadcddf6556d9577ca8b9639..0002e5054548ee5d2c07808e0fe6d4671272c536 100644 (file)
@@ -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) {
index 19386239b918d0fa6fefe9316c1989f8402cd4be..dda394752779902314c963cbead5297c2e9b42d8 100644 (file)
@@ -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<string, token_entry>::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<string, token_entry>::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<string>::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();
   }
index 8ee97ce55496ca8df7ed58f6e678cccacb009c4f..77064f351c3cb7bedeb1047750f27ec93a700802 100644 (file)
@@ -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;
index 6e7d03d8b013bb4ea947669e3f18464f56b06e0a..707cc54fb6656ebdd5a93833e6e459b55c254bd5 100644 (file)
@@ -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();
 
index 1f0dbee1cd01252200eff855af5dab67b1f619b5..d11cb3c356b5af565f2004c90f6e453d7f8a6589 100644 (file)
@@ -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) {
index ae0585c43cc95c474981f5416b6095d380dcfb9f..fb73406cfaf25fc5e4543f71bc2ee7c4179f60c2 100644 (file)
@@ -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;
 
index b9a07a827cd24bcf2b3be3c1f6f241c57a362bb0..b64b1cc0811a4e68d973aeb81f76453e23808eca 100644 (file)
@@ -1538,7 +1538,7 @@ int RGWPeriod::update_sync_status(const RGWPeriod &current_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, map<int, set<s
   }
 
   RGWDataSyncProcessorThread *thread = iter->second;
-  assert(thread);
+  ceph_assert(thread);
   thread->wakeup_sync_shards(shard_ids);
 }
 
@@ -6441,7 +6441,7 @@ int RGWRados::create_pools(vector<rgw_pool>& pools, vector<int>& retcodes)
   vector<librados::PoolAsyncCompletion *>::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<rgw_pool>& pools, vector<int>& 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<string, bufferlist>& 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<off_t, get_obj_io>::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<string, bufferlist>::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<int, string>::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<int, string>::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;
index ae77128e10a6e6b148779c9ef0c7c40d378a86aa..57cdc85a9f9bb264931561b725ed36197f64ef5e 100644 (file)
@@ -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
index 3e45625d97151aeeef9345f0303e84aa1fe335ba..c6e56e14fca3196d413f2cb57aaef7b9a3a7af8a 100644 (file)
@@ -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);
 
index 73833eef0fb2031748515d34e036d04a83f6dcca..e0a1900b5754699965dc45449aa7f84716ddce2f 100644 (file)
@@ -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;
index bf0dde2dec5b2402db63c8f861db84a5cfc68173..70f9328399db5ccf84a106a950cef2d0a9139f6d 100644 (file)
@@ -1493,7 +1493,7 @@ public:
       }
 
       map<string, string>::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();
index 69deff51cb19d5c2d45dcb6a7c877aeb60f27ab1..cebc4aa05f095635a1cee93937f4c503e8272201 100644 (file)
@@ -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});
   }
 
index 565536a772cc93625b0fc03108161122494aa401..1cf07e71e95f1af91c1f1bbac5b4a863b2ba7cee 100644 (file)
@@ -672,7 +672,7 @@ struct AWSSyncInstanceEnv {
 
   void get_profile(const rgw_bucket& bucket, std::shared_ptr<AWSSyncConfig_Profile> *ptarget) {
     conf.find_profile(bucket, ptarget);
-    assert(ptarget);
+    ceph_assert(ptarget);
   }
 };