#include "rgw_sal_rados.h"
#include "services/svc_zone.h"
-#include "services/svc_sys_obj.h"
#define dout_subsys ceph_subsys_rgw
int RGWOrphanStore::init(const DoutPrefixProvider *dpp)
{
- const rgw_pool& log_pool = store->get_zone()->get_params().log_pool;
+ const rgw_pool& log_pool = static_cast<rgw::sal::RadosStore*>(store)->svc()->zone->get_zone_params().log_pool;
int r = rgw_init_ioctx(dpp, static_cast<rgw::sal::RadosStore*>(store)->getRados()->get_rados_handle(), log_pool, ioctx);
if (r < 0) {
cerr << "ERROR: failed to open log pool (" << log_pool << " ret=" << r << std::endl;
RGWObjManifest::obj_iterator miter;
for (miter = manifest.obj_begin(dpp); miter != manifest.obj_end(dpp); ++miter) {
- const rgw_raw_obj& loc = miter.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
+ const rgw_raw_obj& loc = miter.get_location().get_raw_obj(store->getRados());
string s = loc.oid;
obj_oids.insert(obj_fingerprint(s));
}
return 0;
}
- if (cur_bucket->get_info().reshard_status == cls_rgw_reshard_status::IN_PROGRESS) {
+ if (cur_bucket->get_info().layout.resharding != rgw::BucketReshardState::None) {
ldpp_dout(dpp, 0) << __func__ << ": reshard in progress. Skipping "
<< orphan_bucket.name << ": "
<< orphan_bucket.bucket_id << dendl;
RGWObjManifest::obj_iterator miter;
for (miter = manifest.obj_begin(dpp); miter != manifest.obj_end(dpp); ++miter) {
const rgw_raw_obj& loc =
- miter.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
+ miter.get_location().get_raw_obj(store->getRados());
string s = loc.oid;
obj_oids.insert(s);
}
", entries_filter.size=" << entries_filter.size() << dendl;
RGWBucketInfo bucket_info;
- RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx();
- int ret = store->getRados()->get_bucket_instance_info(sys_obj_ctx,
- bucket_instance_id,
+ int ret = store->getRados()->get_bucket_instance_info(bucket_instance_id,
bucket_info,
nullptr,
nullptr,
continue;
}
+ std::unique_ptr<rgw::sal::Bucket> bucket;
+ store->get_bucket(nullptr, bucket_info, &bucket);
// we need to do this in two cases below, so use a lambda
auto do_stat_key =
[&](const rgw_obj_key& key) -> int {
}
-int RGWRadosList::run(const DoutPrefixProvider *dpp)
+int RGWRadosList::run(const DoutPrefixProvider *dpp,
+ const bool yes_i_really_mean_it)
{
int ret;
void* handle = nullptr;
return ret;
}
- const int max_keys = 1000;
+ constexpr int max_keys = 1000;
bool truncated = true;
+ bool warned_indexless = false;
do {
std::list<std::string> buckets;
ret = store->meta_list_keys_next(dpp, handle, max_keys, buckets, &truncated);
for (std::string& bucket_id : buckets) {
- ret = run(dpp, bucket_id);
+ ret = run(dpp, bucket_id, true);
if (ret == -ENOENT) {
continue;
+ } else if (ret == -EINVAL) {
+ if (! warned_indexless) {
+ if (yes_i_really_mean_it) {
+ std::cerr <<
+ "WARNING: because there is at least one indexless bucket (" <<
+ bucket_id <<
+ ") the results of radoslist are *incomplete*; continuing due to --yes-i-really-mean-it" <<
+ std::endl;
+ warned_indexless = true;
+ } else {
+ std::cerr << "ERROR: because there is at least one indexless bucket (" <<
+ bucket_id <<
+ ") the results of radoslist are *incomplete*; use --yes-i-really-mean-it to bypass error" <<
+ std::endl;
+ return ret;
+ }
+ }
+ continue;
} else if (ret < 0) {
return ret;
}
} while (truncated);
return 0;
-} // RGWRadosList::run()
+} // RGWRadosList::run(DoutPrefixProvider, bool)
-int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bucket_name)
+int RGWRadosList::run(const DoutPrefixProvider *dpp,
+ const std::string& start_bucket_name,
+ const bool silent_indexless)
{
- RGWObjectCtx obj_ctx(store);
- std::unique_ptr<rgw::sal::Bucket> bucket;
int ret;
add_bucket_entire(start_bucket_name);
std::cerr << "ERROR: could not get info for bucket " << bucket_name <<
" -- " << cpp_strerror(-ret) << std::endl;
return ret;
+ } else if (bucket->get_info().is_indexless()) {
+ if (! silent_indexless) {
+ std::cerr << "ERROR: unable to run radoslist on indexless bucket " <<
+ bucket_name << std::endl;
+ }
+ return -EINVAL;
}
const std::string bucket_id = bucket->get_key().get_key();
} // while (! bucket_process_map.empty())
if (include_rgw_obj_name) {
- goto done;
+ return 0;
}
// now handle incomplete multipart uploads by going back to the
// initial bucket
+ std::unique_ptr<rgw::sal::Bucket> bucket;
ret = store->get_bucket(dpp, nullptr, tenant_name, start_bucket_name, &bucket, null_yield);
if (ret == -ENOENT) {
// bucket deletion race?
return ret;
}
-done:
-
return 0;
-} // RGWRadosList::run(string)
+} // RGWRadosList::run(DoutPrefixProvider, string, bool)
int RGWRadosList::do_incomplete_multipart(const DoutPrefixProvider *dpp,
obj_it != manifest.obj_end(dpp);
++obj_it) {
const rgw_raw_obj& loc =
- obj_it.get_location().get_raw_obj(static_cast<rgw::sal::RadosStore*>(store));
+ obj_it.get_location().get_raw_obj(store->getRados());
std::cout << loc.oid << std::endl;
} // for (auto obj_it
} // for (auto& p