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;
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);
if (status->pending) {
cond = status->cond;
- assert(cond);
+ ceph_assert(cond);
status->cond->get();
status->lock->Unlock();
/* 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);
}
void rgw_perf_stop(CephContext *cct)
{
- assert(perfcounter);
+ ceph_assert(perfcounter);
cct->get_perfcounters_collection()->remove(perfcounter);
delete perfcounter;
}
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));
}
}
/* should r ever be negative at this point? */
- assert(r >= 0);
+ ceph_assert(r >= 0);
return 0;
}
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;
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);
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) {
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;
}
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;
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;
}
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;
/* 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) {
/* 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) {
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);
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;
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;
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);
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;
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;
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;
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
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;
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;
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;
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;
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;
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;
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
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;
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;
}
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;
}
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();
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) {
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) {
*/
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;
{
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) {
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);
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;
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();
}
}
ldout(cct, 20) << "find_oldest_period advancing to "
"predecessor period " << predecessor << dendl;
- assert(cursor.has_prev());
+ ceph_assert(cursor.has_prev());
}
cursor.prev();
}
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;
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;
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();
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) {
void _dump_queue();
void _clear() override {
- assert(process->m_req_queue.empty());
+ ceph_assert(process->m_req_queue.empty());
}
} req_wq;
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 "
}
RGWDataSyncProcessorThread *thread = iter->second;
- assert(thread);
+ ceph_assert(thread);
thread->wakeup_sync_shards(shard_ids);
}
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;
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();
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,
}
}
- assert(uint64_t(ofs) >= extra_data_len);
+ ceph_assert(uint64_t(ofs) >= extra_data_len);
lofs = ofs - extra_data_len;
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 */
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;
{
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));
}
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();
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();
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();
{
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();
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;
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
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);
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;
}
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
}
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) {
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!
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;
return set_cr_error(ret);
}
// advance to the next period
- assert(next);
+ ceph_assert(next);
cursor = next;
// write the updated sync info
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;
*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();
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;
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) {
/// 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});
}
void get_profile(const rgw_bucket& bucket, std::shared_ptr<AWSSyncConfig_Profile> *ptarget) {
conf.find_profile(bucket, ptarget);
- assert(ptarget);
+ ceph_assert(ptarget);
}
};