return 0;
}
+ if (! is_layout_reshardable(bucket_info.layout)) {
+ return 0;
+ }
+
bool need_resharding = false;
uint32_t num_source_shards = rgw::current_num_shards(bucket_info.layout);
const uint32_t max_dynamic_shards =
return 0;
} // execute
-bool RGWBucketReshard::can_reshard(const RGWBucketInfo& bucket,
- const RGWSI_Zone* zone_svc)
+bool RGWBucketReshard::should_zone_reshard_now(const RGWBucketInfo& bucket,
+ const RGWSI_Zone* zone_svc)
{
return !zone_svc->need_to_log_data() ||
- bucket.layout.logs.size() < max_bilog_history;
+ bucket.layout.logs.size() < max_bilog_history;
}
return 0;
}
- if (!RGWBucketReshard::can_reshard(bucket_info, store->svc()->zone)) {
+ if (!RGWBucketReshard::should_zone_reshard_now(bucket_info, store->svc()->zone)) {
ldpp_dout(dpp, 1) << "Bucket " << bucket_info.bucket << " is not "
"eligible for resharding until peer zones finish syncing one "
"or more of its old log generations" << dendl;
// too large by refusing to reshard the bucket until the old logs get trimmed
static constexpr size_t max_bilog_history = 4;
- static bool can_reshard(const RGWBucketInfo& bucket,
- const RGWSI_Zone* zone_svc);
+ static bool should_zone_reshard_now(const RGWBucketInfo& bucket,
+ const RGWSI_Zone* zone_svc);
}; // RGWBucketReshard
return ret;
}
+ if (! is_layout_reshardable((*bucket)->get_info().layout)) {
+ std::cerr << "Bucket '" << (*bucket)->get_name() <<
+ "' currently has layout '" <<
+ current_layout_desc((*bucket)->get_info().layout) <<
+ "', which does not support resharding." << std::endl;
+ return -EINVAL;
+ }
+
int num_source_shards = rgw::current_num_shards((*bucket)->get_info().layout);
if (num_shards <= num_source_shards && !yes_i_really_mean_it) {
"have the resharding feature enabled." << std::endl;
return ENOTSUP;
}
- if (!RGWBucketReshard::can_reshard(bucket->get_info(), zone_svc) &&
+
+ if (!RGWBucketReshard::should_zone_reshard_now(bucket->get_info(), zone_svc) &&
!yes_i_really_mean_it) {
std::cerr << "Bucket '" << bucket->get_name() << "' already has too many "
"log generations (" << bucket->get_info().layout.logs.size() << ") "
inline bool is_layout_indexless(const bucket_index_layout_generation& layout) {
return layout.layout.type == BucketIndexType::Indexless;
}
+inline bool is_layout_reshardable(const bucket_index_layout_generation& layout) {
+ return layout.layout.type == BucketIndexType::Normal;
+}
+inline bool is_layout_reshardable(const BucketLayout& layout) {
+ return is_layout_reshardable(layout.current_index);
+}
+inline std::string_view current_layout_desc(const BucketLayout& layout) {
+ return rgw::to_string(layout.current_index.layout.type);
+}
} // namespace rgw