diff options
author | Kalpesh Pandya <kapandya@redhat.com> | 2023-02-23 12:09:25 +0100 |
---|---|---|
committer | Kalpesh Pandya <kapandya@redhat.com> | 2023-06-19 23:48:30 +0200 |
commit | 05ddbb712bc7138af35dbb1973a6810951d97359 (patch) | |
tree | 11334dfc9052aac1162d967fed8e369ad3831d54 | |
parent | src/rgw: Changing null_yield to optional_yield (diff) | |
download | ceph-05ddbb712bc7138af35dbb1973a6810951d97359.tar.xz ceph-05ddbb712bc7138af35dbb1973a6810951d97359.zip |
src/rgw: Additional changes based on comments
Signed-off-by: Kalpesh Pandya <kapandya@redhat.com>
-rw-r--r-- | src/rgw/driver/rados/rgw_bucket.cc | 16 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_bucket.h | 2 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_gc.cc | 16 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_notify.cc | 2 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_object_expirer_core.cc | 8 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_putobj_processor.cc | 4 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_rados.cc | 4 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_sal_rados.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_admin.cc | 4 | ||||
-rw-r--r-- | src/rgw/rgw_crypt.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_op.cc | 20 | ||||
-rw-r--r-- | src/test/rgw/rgw_cr_test.cc | 4 | ||||
-rw-r--r-- | src/test/rgw/test_d4n_filter.cc | 2 | ||||
-rw-r--r-- | src/test/rgw/test_rgw_lua.cc | 2 |
14 files changed, 44 insertions, 44 deletions
diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index f5f0ee177f1..b1dd9fe1cda 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -1333,16 +1333,16 @@ int RGWBucketAdminOp::clear_stale_instances(rgw::sal::Driver* driver, RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y) { - auto process_f = [dpp](const bucket_instance_ls& lst, + auto process_f = [dpp, y](const bucket_instance_ls& lst, Formatter *formatter, rgw::sal::Driver* driver){ for (const auto &binfo: lst) { std::unique_ptr<rgw::sal::Bucket> bucket; driver->get_bucket(nullptr, binfo, &bucket); - int ret = bucket->purge_instance(dpp, null_yield); + int ret = bucket->purge_instance(dpp, y); if (ret == 0){ auto md_key = "bucket.instance:" + binfo.bucket.get_key(); - ret = driver->meta_remove(dpp, md_key, null_yield); + ret = driver->meta_remove(dpp, md_key, y); } formatter->open_object_section("delete_status"); formatter->dump_string("bucket_instance", binfo.bucket.get_key()); @@ -1386,16 +1386,16 @@ static void process_single_lc_entry(rgw::sal::Driver* driver, Formatter *formatter, const std::string& tenant_name, const std::string& bucket_name, - const DoutPrefixProvider *dpp) + const DoutPrefixProvider *dpp, optional_yield y) { - int ret = fix_single_bucket_lc(driver, tenant_name, bucket_name, dpp, null_yield); + int ret = fix_single_bucket_lc(driver, tenant_name, bucket_name, dpp, y); format_lc_status(formatter, tenant_name, bucket_name, -ret); } int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, - const DoutPrefixProvider *dpp) + const DoutPrefixProvider *dpp, optional_yield y) { std::string marker; void *handle; @@ -1406,7 +1406,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver, if (const std::string& bucket_name = op_state.get_bucket_name(); ! bucket_name.empty()) { const rgw_user user_id = op_state.get_user_id(); - process_single_lc_entry(driver, formatter, user_id.tenant, bucket_name, dpp); + process_single_lc_entry(driver, formatter, user_id.tenant, bucket_name, dpp, y); formatter->flush(cout); } else { int ret = driver->meta_list_keys_init(dpp, "bucket", marker, &handle); @@ -1431,7 +1431,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver, } if (ret != -ENOENT) { for (const auto &key:keys) { auto [tenant_name, bucket_name] = split_tenant(key); - process_single_lc_entry(driver, formatter, tenant_name, bucket_name, dpp); + process_single_lc_entry(driver, formatter, tenant_name, bucket_name, dpp, y); } } formatter->flush(cout); // regularly flush every 1k entries diff --git a/src/rgw/driver/rados/rgw_bucket.h b/src/rgw/driver/rados/rgw_bucket.h index ce968275e6b..7fffdb788e8 100644 --- a/src/rgw/driver/rados/rgw_bucket.h +++ b/src/rgw/driver/rados/rgw_bucket.h @@ -386,7 +386,7 @@ public: static int clear_stale_instances(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y); static int fix_lc_shards(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y); static int fix_obj_expiry(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y, bool dry_run = false); diff --git a/src/rgw/driver/rados/rgw_gc.cc b/src/rgw/driver/rados/rgw_gc.cc index 321f2c4f07c..4705c46fff4 100644 --- a/src/rgw/driver/rados/rgw_gc.cc +++ b/src/rgw/driver/rados/rgw_gc.cc @@ -51,7 +51,7 @@ void RGWGC::initialize(CephContext *_cct, RGWRados *_store, optional_yield y) { op.create(false); const uint64_t queue_size = cct->_conf->rgw_gc_max_queue_size, num_deferred_entries = cct->_conf->rgw_gc_max_deferred; gc_log_init2(op, queue_size, num_deferred_entries); - store->gc_operate(this, obj_names[i], &op, null_yield); + store->gc_operate(this, obj_names[i], &op, y); } } @@ -88,7 +88,7 @@ std::tuple<int, std::optional<cls_rgw_obj_chain>> RGWGC::send_split_chain(const broken_chain.objs.pop_back(); --it; ldpp_dout(this, 20) << "RGWGC::send_split_chain - more than, dont add to broken chain and send chain" << dendl; - auto ret = send_chain(broken_chain, tag, null_yield); + auto ret = send_chain(broken_chain, tag, y); if (ret < 0) { broken_chain.objs.insert(broken_chain.objs.end(), it, chain.objs.end()); // add all the remainder objs to the list to be deleted inline ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl; @@ -99,14 +99,14 @@ std::tuple<int, std::optional<cls_rgw_obj_chain>> RGWGC::send_split_chain(const } if (!broken_chain.objs.empty()) { //when the chain is smaller than or equal to rgw_max_chunk_size ldpp_dout(this, 20) << "RGWGC::send_split_chain - sending leftover objects" << dendl; - auto ret = send_chain(broken_chain, tag, null_yield); + auto ret = send_chain(broken_chain, tag, y); if (ret < 0) { ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl; return {ret, {broken_chain}}; } } } else { - auto ret = send_chain(chain, tag, null_yield); + auto ret = send_chain(chain, tag, y); if (ret < 0) { ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl; return {ret, {std::move(chain)}}; @@ -127,13 +127,13 @@ int RGWGC::send_chain(const cls_rgw_obj_chain& chain, const string& tag, optiona ldpp_dout(this, 20) << "RGWGC::send_chain - on object name: " << obj_names[i] << "tag is: " << tag << dendl; - auto ret = store->gc_operate(this, obj_names[i], &op, null_yield); + auto ret = store->gc_operate(this, obj_names[i], &op, y); if (ret != -ECANCELED && ret != -EPERM) { return ret; } ObjectWriteOperation set_entry_op; cls_rgw_gc_set_entry(set_entry_op, cct->_conf->rgw_gc_obj_min_wait, info); - return store->gc_operate(this, obj_names[i], &set_entry_op, null_yield); + return store->gc_operate(this, obj_names[i], &set_entry_op, y); } struct defer_chain_state { @@ -240,7 +240,7 @@ int RGWGC::remove(int index, int num_entries, optional_yield y) ObjectWriteOperation op; cls_rgw_gc_queue_remove_entries(op, num_entries); - return store->gc_operate(this, obj_names[index], &op, null_yield); + return store->gc_operate(this, obj_names[index], &op, y); } int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue) @@ -733,7 +733,7 @@ int RGWGC::process(bool expired_only, optional_yield y) for (int i = 0; i < max_objs; i++) { int index = (i + start) % max_objs; - int ret = process(index, max_secs, expired_only, io_manager, null_yield); + int ret = process(index, max_secs, expired_only, io_manager, y); if (ret < 0) return ret; } diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 8116945479c..b1835016ec0 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -792,7 +792,7 @@ static inline bool notification_match(reservation_t& res, const RGWPubSub ps(res.store, res.user_tenant); const RGWPubSub::Bucket ps_bucket(ps, res.bucket); rgw_pubsub_bucket_topics bucket_topics; - auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.s->yield); + auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.yield); if (rc < 0) { // failed to fetch bucket topics return rc; diff --git a/src/rgw/driver/rados/rgw_object_expirer_core.cc b/src/rgw/driver/rados/rgw_object_expirer_core.cc index 0df1553beef..2c931cf909d 100644 --- a/src/rgw/driver/rados/rgw_object_expirer_core.cc +++ b/src/rgw/driver/rados/rgw_object_expirer_core.cc @@ -188,7 +188,7 @@ int RGWObjExpStore::objexp_hint_trim(const DoutPrefixProvider *dpp, } auto& ref = obj.get_ref(); int ret = cls_timeindex_trim_repeat(dpp, ref, oid, utime_t(start_time), utime_t(end_time), - from_marker, to_marker, null_yield); + from_marker, to_marker, y); if ((ret < 0 ) && (ret != -ENOENT)) { return ret; } @@ -273,7 +273,7 @@ void RGWObjectExpirer::trim_chunk(const DoutPrefixProvider *dpp, real_time rt_to = to.to_real_time(); int ret = exp_store.objexp_hint_trim(dpp, shard, rt_from, rt_to, - from_marker, to_marker, null_yield); + from_marker, to_marker, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR during trim: " << ret << dendl; } @@ -327,7 +327,7 @@ bool RGWObjectExpirer::process_single_shard(const DoutPrefixProvider *dpp, garbage_chunk(dpp, entries, need_trim); if (need_trim) { - trim_chunk(dpp, shard, last_run, round_start, marker, out_marker, null_yield); + trim_chunk(dpp, shard, last_run, round_start, marker, out_marker, y); } utime_t now = ceph_clock_now(); @@ -358,7 +358,7 @@ bool RGWObjectExpirer::inspect_all_shards(const DoutPrefixProvider *dpp, ldpp_dout(dpp, 20) << "processing shard = " << shard << dendl; - if (! process_single_shard(dpp, shard, last_run, round_start, null_yield)) { + if (! process_single_shard(dpp, shard, last_run, round_start, y)) { all_done = false; } } diff --git a/src/rgw/driver/rados/rgw_putobj_processor.cc b/src/rgw/driver/rados/rgw_putobj_processor.cc index 01e5ae6fdf3..9eb2ef26668 100644 --- a/src/rgw/driver/rados/rgw_putobj_processor.cc +++ b/src/rgw/driver/rados/rgw_putobj_processor.cc @@ -203,7 +203,7 @@ RadosWriter::~RadosWriter() continue; } - int r = store->delete_raw_obj(dpp, obj, null_yield); + int r = store->delete_raw_obj(dpp, obj, y); if (r < 0 && r != -ENOENT) { ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << obj << "), leaked" << dendl; } @@ -212,7 +212,7 @@ RadosWriter::~RadosWriter() if (need_to_remove_head) { std::string version_id; ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl; - int r = store->delete_obj(dpp, obj_ctx, bucket_info, head_obj, 0, 0); + int r = store->delete_obj(dpp, obj_ctx, bucket_info, head_obj, 0, y, 0); if (r < 0 && r != -ENOENT) { ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl; } diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 0c930581189..b6c76831a20 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -3993,7 +3993,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, if (copy_if_newer) { /* need to get mtime for destination */ - ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, y, stat_follow_olh, null_yield); + ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y); if (ret < 0) goto set_err_state; @@ -4182,7 +4182,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, if (copy_if_newer && canceled) { ldpp_dout(dpp, 20) << "raced with another write of obj: " << dest_obj << dendl; obj_ctx.invalidate(dest_obj); /* object was overwritten */ - ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, y, stat_follow_olh, null_yield); + ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl; goto set_err_state; diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index f9f0886b199..e1d2f72369a 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -2420,7 +2420,7 @@ int RadosMultipartUpload::cleanup_part_history(const DoutPrefixProvider* dpp, store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id()); } else { // use upload id as tag and do it synchronously - auto [ret, leftover_chain] = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id()); + auto [ret, leftover_chain] = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id(), y); if (ret < 0 && leftover_chain) { ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl; if (ret == -ENOENT) { diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index cab4e1c6282..96742ad20ba 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -8368,7 +8368,7 @@ next: } RGWRados* store = rados_store->getRados(); - int ret = store->process_gc(!include_all); + int ret = store->process_gc(!include_all, null_yield); if (ret < 0) { cerr << "ERROR: gc processing returned error: " << cpp_strerror(-ret) << std::endl; return 1; @@ -8465,7 +8465,7 @@ next: } if (opt_cmd == OPT::LC_RESHARD_FIX) { - ret = RGWBucketAdminOp::fix_lc_shards(driver, bucket_op, stream_flusher, dpp()); + ret = RGWBucketAdminOp::fix_lc_shards(driver, bucket_op, stream_flusher, dpp(), null_yield); if (ret < 0) { cerr << "ERROR: fixing lc shards: " << cpp_strerror(-ret) << std::endl; } diff --git a/src/rgw/rgw_crypt.cc b/src/rgw/rgw_crypt.cc index 18b23575655..d2c3edb0d55 100644 --- a/src/rgw/rgw_crypt.cc +++ b/src/rgw/rgw_crypt.cc @@ -1004,7 +1004,7 @@ static int get_sse_s3_bucket_key(req_state *s, if (res != -ECANCELED) { break; } - res = s->bucket->try_refresh_info(s, nullptr, null_yield); + res = s->bucket->try_refresh_info(s, nullptr, s->yield); if (res != 0) { break; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 5e4ba6f3c6e..4114dc85284 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1303,7 +1303,7 @@ void RGWPutBucketReplication::execute(optional_yield y) { return; } - op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { auto sync_policy = (s->bucket->get_info().sync_policy ? *s->bucket->get_info().sync_policy : rgw_sync_policy_info()); for (auto& group : sync_policy_groups) { @@ -1312,7 +1312,7 @@ void RGWPutBucketReplication::execute(optional_yield y) { s->bucket->get_info().set_sync_policy(std::move(sync_policy)); - int ret = s->bucket->put_info(this, false, real_time(), null_yield); + int ret = s->bucket->put_info(this, false, real_time(), y); if (ret < 0) { ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl; return ret; @@ -1345,7 +1345,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { if (!s->bucket->get_info().sync_policy) { return 0; } @@ -1356,7 +1356,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y) s->bucket->get_info().set_sync_policy(std::move(sync_policy)); - int ret = s->bucket->put_info(this, false, real_time(), null_yield); + int ret = s->bucket->put_info(this, false, real_time(), y); if (ret < 0) { ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl; return ret; @@ -2880,10 +2880,10 @@ void RGWSetBucketWebsite::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { s->bucket->get_info().has_website = true; s->bucket->get_info().website_conf = website_conf; - op_ret = s->bucket->put_info(this, false, real_time(), null_yield); + op_ret = s->bucket->put_info(this, false, real_time(), y); return op_ret; }, y); @@ -2923,10 +2923,10 @@ void RGWDeleteBucketWebsite::execute(optional_yield y) << "returned err=" << op_ret << dendl; return; } - op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { s->bucket->get_info().has_website = false; s->bucket->get_info().website_conf = RGWBucketWebsiteConf(); - op_ret = s->bucket->put_info(this, false, real_time(), null_yield); + op_ret = s->bucket->put_info(this, false, real_time(), y); return op_ret; }, y); if (op_ret < 0) { @@ -8400,9 +8400,9 @@ void RGWPutBucketObjectLock::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { s->bucket->get_info().obj_lock = obj_lock; - op_ret = s->bucket->put_info(this, false, real_time(), null_yield); + op_ret = s->bucket->put_info(this, false, real_time(), y); return op_ret; }, y); return; diff --git a/src/test/rgw/rgw_cr_test.cc b/src/test/rgw/rgw_cr_test.cc index 6535a300f14..37120925291 100644 --- a/src/test/rgw/rgw_cr_test.cc +++ b/src/test/rgw/rgw_cr_test.cc @@ -328,8 +328,8 @@ int main(int argc, const char **argv) false, false, false, - false, null_yield, - true, + false, + true, null_yield, false)); if (!store) { std::cerr << "couldn't init storage provider" << std::endl; diff --git a/src/test/rgw/test_d4n_filter.cc b/src/test/rgw/test_d4n_filter.cc index d62c85f245b..b4d37bc698d 100644 --- a/src/test/rgw/test_d4n_filter.cc +++ b/src/test/rgw/test_d4n_filter.cc @@ -65,7 +65,7 @@ class Environment : public ::testing::Environment { false, false, false, - false, + false, null_yield, false); ASSERT_NE(driver, nullptr); diff --git a/src/test/rgw/test_rgw_lua.cc b/src/test/rgw/test_rgw_lua.cc index a539c025b50..00b252e5d85 100644 --- a/src/test/rgw/test_rgw_lua.cc +++ b/src/test/rgw/test_rgw_lua.cc @@ -102,7 +102,7 @@ public: return 0; } - virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) override { + virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch, optional_yield y) override { return 0; } |