return ret;
}
+ auto zone_svc = static_cast<rgw::sal::RadosStore*>(store)->svc()->zone;
+ if (!RGWBucketReshard::can_reshard(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() << ") "
+ "from previous reshards that peer zones haven't finished syncing. "
+ "Resharding is not recommended until the old generations sync, but "
+ "you can force a reshard with --yes-i-really-mean-it." << std::endl;
+ return -EINVAL;
+ }
+
RGWBucketReshard br(static_cast<rgw::sal::RadosStore*>(store), bucket->get_info(), nullptr /* no callback */);
#define DEFAULT_RESHARD_MAX_ENTRIES 1000
return 0;
} // execute
+bool RGWBucketReshard::can_reshard(const RGWBucketInfo& bucket,
+ const RGWSI_Zone* zone_svc)
+{
+ return !zone_svc->need_to_log_data() ||
+ bucket.layout.logs.size() < max_bilog_history;
+}
+
RGWReshard::RGWReshard(rgw::sal::RadosStore* _store, bool _verbose, ostream *_out,
Formatter *_formatter) :
return 0;
}
+ if (!RGWBucketReshard::can_reshard(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;
+ return remove(dpp, entry);
+ }
+
RGWBucketReshard br(store, bucket_info, nullptr);
ReshardFaultInjector f; // no fault injected
return final_num_shards;
}
+
+ // for multisite, the RGWBucketInfo keeps a history of old log generations
+ // until all peers are done with them. prevent this log history from growing
+ // 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);
}; // RGWBucketReshard