const RGWBucketInfo& bucket_info = bucket->get_info();
- const auto& index = bucket->get_info().get_current_index();
+ const auto& index = bucket_info.get_current_index();
if (is_layout_indexless(index)) {
cerr << "error, indexless buckets do not maintain stats; bucket=" <<
bucket->get_name() << std::endl;
bucket->versioned()
? (bucket->versioning_enabled() ? "enabled" : "suspended")
: "off");
- formatter->dump_string("zonegroup", bucket->get_info().zonegroup);
- formatter->dump_string("placement_rule", bucket->get_info().placement_rule.to_str());
+ formatter->dump_string("zonegroup", bucket_info.zonegroup);
+ formatter->dump_string("placement_rule", bucket_info.placement_rule.to_str());
::encode_json("explicit_placement", bucket->get_key().explicit_placement, formatter);
formatter->dump_string("id", bucket->get_bucket_id());
formatter->dump_string("marker", bucket->get_marker());
- formatter->dump_stream("index_type") << bucket->get_info().layout.current_index.layout.type;
- formatter->dump_int("index_generation", bucket->get_info().layout.current_index.gen);
+ formatter->dump_stream("index_type") << bucket_info.layout.current_index.layout.type;
+ formatter->dump_int("index_generation", bucket_info.layout.current_index.gen);
formatter->dump_int("num_shards",
- bucket->get_info().layout.current_index.layout.normal.num_shards);
+ bucket_info.layout.current_index.layout.normal.num_shards);
+ formatter->dump_string("reshard_status", to_string(bucket_info.reshard_status));
formatter->dump_bool("object_lock_enabled", bucket_info.obj_lock_enabled());
formatter->dump_bool("mfa_enabled", bucket_info.mfa_enabled());
- ::encode_json("owner", bucket->get_info().owner, formatter);
+ ::encode_json("owner", bucket_info.owner, formatter);
formatter->dump_string("ver", bucket_ver);
formatter->dump_string("master_ver", master_ver);
ut.gmtime(formatter->dump_stream("mtime"));
ctime_ut.gmtime(formatter->dump_stream("creation_time"));
formatter->dump_string("max_marker", max_marker);
dump_bucket_usage(stats, formatter);
- encode_json("bucket_quota", bucket->get_info().quota, formatter);
+ encode_json("bucket_quota", bucket_info.quota, formatter);
// bucket tags
auto iter = bucket->get_attrs().find(RGW_ATTR_TAGS);
RGWBucketInfo& bucket_info,
std::map<std::string, bufferlist>& bucket_attrs,
ReshardFaultInjector& fault,
- uint32_t new_num_shards,
+ const uint32_t new_num_shards,
const DoutPrefixProvider* dpp, optional_yield y)
{
auto prev = bucket_info.layout; // make a copy for cleanup
RGWBucketInfo& bucket_info,
std::map<std::string, bufferlist>& bucket_attrs,
ReshardFaultInjector& fault,
- uint32_t new_num_shards,
+ const uint32_t new_num_shards,
const DoutPrefixProvider *dpp, optional_yield y)
{
if (new_num_shards == 0) {
revert_target_layout(store, bucket_info, bucket_attrs, fault, dpp, y);
return ret;
}
+
return 0;
} // init_reshard
int RGWBucketReshard::do_reshard(const rgw::bucket_index_layout_generation& current,
const rgw::bucket_index_layout_generation& target,
- int max_entries,
+ int max_op_entries, // max num to process per op
bool verbose,
ostream *out,
Formatter *formatter,
/* update bucket info -- in progress*/
list<rgw_cls_bi_entry> entries;
- if (max_entries < 0) {
+ if (max_op_entries <= 0) {
ldpp_dout(dpp, 0) << __func__ <<
- ": can't reshard, negative max_entries" << dendl;
+ ": can't reshard, non-positive max_op_entries" << dendl;
return -EINVAL;
}
const std::string null_object_filter; // empty string since we're not filtering by object
while (is_truncated) {
entries.clear();
- int ret = store->getRados()->bi_list(dpp, bucket_info, i, null_object_filter, marker, max_entries, &entries, &is_truncated, y);
+ int ret = store->getRados()->bi_list(
+ dpp, bucket_info, i, null_object_filter, marker, max_op_entries,
+ &entries, &is_truncated, y);
if (ret == -ENOENT) {
ldpp_dout(dpp, 1) << "WARNING: " << __func__ << " failed to find shard "
<< i << ", skipping" << dendl;
int RGWBucketReshard::execute(int num_shards,
ReshardFaultInjector& fault,
- int max_op_entries,
+ int max_op_entries, // max num to process per op
const cls_rgw_reshard_initiator initiator,
const DoutPrefixProvider *dpp,
optional_yield y,
}
int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry,
- int max_entries,
+ int max_op_entries, // max num to process per op
const DoutPrefixProvider* dpp,
optional_yield y)
{
RGWBucketReshard br(store, bucket_info, bucket_attrs, nullptr);
ReshardFaultInjector f; // no fault injected
- ret = br.execute(entry.new_num_shards, f, max_entries, entry.initiator,
+ ret = br.execute(entry.new_num_shards, f, max_op_entries, entry.initiator,
dpp, y, false, nullptr, nullptr, this);
if (ret < 0) {
ldpp_dout(dpp, 0) << __func__ <<
int RGWReshard::process_single_logshard(int logshard_num, const DoutPrefixProvider *dpp, optional_yield y)
{
- string marker;
- bool truncated = true;
+ std::string marker;
+ bool is_truncated = true;
- constexpr uint32_t max_entries = 1000;
+ // This is the number to request per op, whether it's reshard queue
+ // entries or bucket index entries. Should not be confused with the
+ // number of entries we allow in a bucket index shard. This value is
+ // passed in and used deeper into the call chain as well.
+ constexpr uint32_t max_op_entries = 1000;
string logshard_oid;
get_logshard_oid(logshard_num, &logshard_oid);
do {
std::list<cls_rgw_reshard_entry> entries;
- ret = list(dpp, logshard_num, marker, max_entries, entries, &truncated);
+ ret = list(dpp, logshard_num, marker, max_op_entries, entries, &is_truncated);
if (ret < 0) {
ldpp_dout(dpp, 10) << "cannot list all reshards in logshard oid=" <<
logshard_oid << dendl;
continue;
}
- for(auto& entry : entries) { // logshard entries
- process_entry(entry, max_entries, dpp, y);
+ for(const auto& entry : entries) { // logshard entries
+ process_entry(entry, max_op_entries, dpp, y);
Clock::time_point now = Clock::now();
if (logshard_lock.should_renew(now)) {
entry.get_key(&marker);
} // entry for loop
- } while (truncated);
+ } while (is_truncated);
logshard_lock.unlock();
return 0;
utime_t start = ceph_clock_now();
reshard->process_all_logshards(this, null_yield);
- if (reshard->going_down())
+ if (reshard->going_down()) {
break;
+ }
utime_t end = ceph_clock_now();
utime_t elapsed = end - start;