return 0;
}
-int RGWRados::bucket_set_reshard(const DoutPrefixProvider *dpp,
- const RGWBucketInfo& bucket_info,
- const cls_rgw_bucket_instance_entry& entry)
-{
- librados::IoCtx index_pool;
- map<int, string> bucket_objs;
-
- int r = svc.bi_rados->open_bucket_index(dpp, bucket_info, std::nullopt, bucket_info.layout.current_index, &index_pool, &bucket_objs, nullptr);
- if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: " << __func__ <<
- ": unable to open bucket index, r=" << r << " (" <<
- cpp_strerror(-r) << ")" << dendl;
- return r;
- }
-
- maybe_warn_about_blocking(dpp); // TODO: use AioTrottle
- r = CLSRGWIssueSetBucketResharding(index_pool, bucket_objs, entry, cct->_conf->rgw_bucket_index_max_aio)();
- if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: " << __func__ <<
- ": unable to issue set bucket resharding, r=" << r << " (" <<
- cpp_strerror(-r) << ")" << dendl;
- }
- return r;
-}
-
int RGWRados::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx* octx, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y)
{
std::string oid, key;
outer_reshard_lock(_outer_reshard_lock)
{ }
-// sets reshard status of bucket index shards for the current index layout
-static int set_resharding_status(const DoutPrefixProvider *dpp,
- rgw::sal::RadosStore* store,
- const RGWBucketInfo& bucket_info,
- cls_rgw_reshard_status status)
-{
- cls_rgw_bucket_instance_entry instance_entry;
- instance_entry.set_status(status);
-
- int ret = store->getRados()->bucket_set_reshard(dpp, bucket_info, instance_entry);
- if (ret < 0) {
- ldpp_dout(dpp, 0) << "RGWReshard::" << __func__ << " ERROR: error setting bucket resharding flag on bucket index: "
- << cpp_strerror(-ret) << dendl;
- return ret;
- }
- return 0;
-}
-
static int remove_old_reshard_instance(rgw::sal::RadosStore* store,
const rgw_bucket& bucket,
const DoutPrefixProvider* dpp, optional_yield y)
if (support_logrecord) {
if (ret = fault.check("logrecord_writes");
ret == 0) { // no fault injected, record log with writing to the current index shards
- ret = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::IN_LOGRECORD);
+ ret = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::IN_LOGRECORD);
}
} else {
- ret = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::IN_PROGRESS);
+ ret = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::IN_PROGRESS);
}
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: " << __func__ << " failed to pause "
bucket_info.layout = std::move(prev); // restore in-memory layout
// unblock writes to the current index shard objects
- int ret2 = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::NOT_RESHARDING);
+ int ret2 = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::NOT_RESHARDING);
if (ret2 < 0) {
ldpp_dout(dpp, 1) << "WARNING: " << __func__ << " failed to unblock "
"writes to current index objects: " << cpp_strerror(ret2) << dendl;
if (ret = fault.check("block_writes");
ret == 0) { // no fault injected, block writes to the current index shards
- ret = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::IN_PROGRESS);
+ ret = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::IN_PROGRESS);
}
if (ret < 0) {
const DoutPrefixProvider *dpp, optional_yield y)
{
// unblock writes to the current index shard objects
- int ret = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::NOT_RESHARDING);
+ int ret = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::NOT_RESHARDING);
if (ret < 0) {
ldpp_dout(dpp, 1) << "WARNING: " << __func__ << " failed to unblock "
"writes to current index objects: " << cpp_strerror(ret) << dendl;
bucket_info.layout = std::move(prev); // restore in-memory layout
// unblock writes to the current index shard objects
- int ret2 = set_resharding_status(dpp, store, bucket_info,
- cls_rgw_reshard_status::NOT_RESHARDING);
+ int ret2 = store->svc()->bi_rados->set_reshard_status(
+ dpp, bucket_info, cls_rgw_reshard_status::NOT_RESHARDING);
if (ret2 < 0) {
ldpp_dout(dpp, 1) << "WARNING: " << __func__ << " failed to unblock "
"writes to current index objects: " << cpp_strerror(ret2) << dendl;
#include "rgw_datalog.h"
#include "cls/rgw/cls_rgw_client.h"
+#include "common/errno.h"
#define dout_subsys ceph_subsys_rgw
return 0;
}
+int RGWSI_BucketIndex_RADOS::set_reshard_status(const DoutPrefixProvider *dpp,
+ const RGWBucketInfo& bucket_info,
+ cls_rgw_reshard_status status)
+{
+ const auto entry = cls_rgw_bucket_instance_entry{.reshard_status = status};
+
+ librados::IoCtx index_pool;
+ map<int, string> bucket_objs;
+
+ int r = open_bucket_index(dpp, bucket_info, std::nullopt, bucket_info.layout.current_index, &index_pool, &bucket_objs, nullptr);
+ if (r < 0) {
+ ldpp_dout(dpp, 0) << "ERROR: " << __func__ <<
+ ": unable to open bucket index, r=" << r << " (" <<
+ cpp_strerror(-r) << ")" << dendl;
+ return r;
+ }
+
+ maybe_warn_about_blocking(dpp); // TODO: use AioTrottle
+ r = CLSRGWIssueSetBucketResharding(index_pool, bucket_objs, entry, cct->_conf->rgw_bucket_index_max_aio)();
+ if (r < 0) {
+ ldpp_dout(dpp, 0) << "ERROR: " << __func__ <<
+ ": unable to issue set bucket resharding, r=" << r << " (" <<
+ cpp_strerror(-r) << ")" << dendl;
+ }
+ return r;
+}
+
int RGWSI_BucketIndex_RADOS::handle_overwrite(const DoutPrefixProvider *dpp,
const RGWBucketInfo& info,
const RGWBucketInfo& orig_info,