mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
radosgw-admin: allow zone[group] modify to configure index shards
Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
fba41d6a84
commit
f57bf02370
@ -728,6 +728,13 @@ Options
|
||||
|
||||
Remove the zones from list of zones to sync from.
|
||||
|
||||
.. option:: --bucket-index-max-shards
|
||||
|
||||
Override a zone's or zonegroup's default number of bucket index shards. This
|
||||
option is accepted by the 'zone create', 'zone modify', 'zonegroup add',
|
||||
and 'zonegroup modify' commands, and applies to buckets that are created
|
||||
after the zone/zonegroup changes take effect.
|
||||
|
||||
.. option:: --fix
|
||||
|
||||
Besides checking bucket index, will also fix it.
|
||||
|
@ -350,6 +350,7 @@ void usage()
|
||||
cout << " set list of zones to sync from\n";
|
||||
cout << " --sync-from-rm=[zone-name][,...]\n";
|
||||
cout << " remove zones from list of zones to sync from\n";
|
||||
cout << " --bucket-index-max-shards override a zone/zonegroup's default bucket index shard count\n";
|
||||
cout << " --fix besides checking bucket index, will also fix it\n";
|
||||
cout << " --check-objects bucket check: rebuilds bucket index according to\n";
|
||||
cout << " actual objects state\n";
|
||||
@ -3157,6 +3158,7 @@ int main(int argc, const char **argv)
|
||||
string job_id;
|
||||
int num_shards = 0;
|
||||
bool num_shards_specified = false;
|
||||
std::optional<int> bucket_index_max_shards;
|
||||
int max_concurrent_ios = 32;
|
||||
uint64_t orphan_stale_secs = (24 * 3600);
|
||||
int detail = false;
|
||||
@ -3360,6 +3362,12 @@ int main(int argc, const char **argv)
|
||||
return EINVAL;
|
||||
}
|
||||
num_shards_specified = true;
|
||||
} else if (ceph_argparse_witharg(args, i, &val, "--bucket-index-max-shards", (char*)NULL)) {
|
||||
bucket_index_max_shards = (int)strict_strtol(val.c_str(), 10, &err);
|
||||
if (!err.empty()) {
|
||||
cerr << "ERROR: failed to parse bucket-index-max-shards: " << err << std::endl;
|
||||
return EINVAL;
|
||||
}
|
||||
} else if (ceph_argparse_witharg(args, i, &val, "--max-concurrent-ios", (char*)NULL)) {
|
||||
max_concurrent_ios = (int)strict_strtol(val.c_str(), 10, &err);
|
||||
if (!err.empty()) {
|
||||
@ -4435,7 +4443,7 @@ int main(int argc, const char **argv)
|
||||
(is_read_only_set ? &read_only : NULL),
|
||||
endpoints, ptier_type,
|
||||
psync_from_all, sync_from, sync_from_rm,
|
||||
predirect_zone,
|
||||
predirect_zone, bucket_index_max_shards,
|
||||
store->svc()->sync_modules->get_manager());
|
||||
if (ret < 0) {
|
||||
cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": "
|
||||
@ -4611,6 +4619,13 @@ int main(int argc, const char **argv)
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (bucket_index_max_shards) {
|
||||
for (auto& [name, zone] : zonegroup.zones) {
|
||||
zone.bucket_index_max_shards = *bucket_index_max_shards;
|
||||
}
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (need_update) {
|
||||
ret = zonegroup.update();
|
||||
if (ret < 0) {
|
||||
@ -4905,7 +4920,7 @@ int main(int argc, const char **argv)
|
||||
ptier_type,
|
||||
psync_from_all,
|
||||
sync_from, sync_from_rm,
|
||||
predirect_zone,
|
||||
predirect_zone, bucket_index_max_shards,
|
||||
store->svc()->sync_modules->get_manager());
|
||||
if (ret < 0) {
|
||||
cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name()
|
||||
@ -5188,7 +5203,7 @@ int main(int argc, const char **argv)
|
||||
(is_read_only_set ? &read_only : NULL),
|
||||
endpoints, ptier_type,
|
||||
psync_from_all, sync_from, sync_from_rm,
|
||||
predirect_zone,
|
||||
predirect_zone, bucket_index_max_shards,
|
||||
store->svc()->sync_modules->get_manager());
|
||||
if (ret < 0) {
|
||||
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
|
||||
|
@ -179,7 +179,8 @@ int RGWZoneGroup::equals(const string& other_zonegroup) const
|
||||
int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only,
|
||||
const list<string>& endpoints, const string *ptier_type,
|
||||
bool *psync_from_all, list<string>& sync_from, list<string>& sync_from_rm,
|
||||
string *predirect_zone, RGWSyncModulesManager *sync_mgr)
|
||||
string *predirect_zone, std::optional<int> bucket_index_max_shards,
|
||||
RGWSyncModulesManager *sync_mgr)
|
||||
{
|
||||
auto& zone_id = zone_params.get_id();
|
||||
auto& zone_name = zone_params.get_name();
|
||||
@ -234,6 +235,10 @@ int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bo
|
||||
zone.redirect_zone = *predirect_zone;
|
||||
}
|
||||
|
||||
if (bucket_index_max_shards) {
|
||||
zone.bucket_index_max_shards = *bucket_index_max_shards;
|
||||
}
|
||||
|
||||
for (auto add : sync_from) {
|
||||
zone.sync_from.insert(add);
|
||||
}
|
||||
|
@ -799,8 +799,9 @@ struct RGWZoneGroup : public RGWSystemMetaObj {
|
||||
int equals(const std::string& other_zonegroup) const;
|
||||
int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only,
|
||||
const list<std::string>& endpoints, const std::string *ptier_type,
|
||||
bool *psync_from_all, list<std::string>& sync_from, list<std::string>& sync_from_rm,
|
||||
std::string *predirect_zone, RGWSyncModulesManager *sync_mgr);
|
||||
bool *psync_from_all, list<std::string>& sync_from,
|
||||
list<std::string>& sync_from_rm, std::string *predirect_zone,
|
||||
std::optional<int> bucket_index_max_shards, RGWSyncModulesManager *sync_mgr);
|
||||
int remove_zone(const std::string& zone_id);
|
||||
int rename_zone(const RGWZoneParams& zone_params);
|
||||
rgw_pool get_pool(CephContext *cct) const override;
|
||||
|
@ -245,6 +245,7 @@
|
||||
set list of zones to sync from
|
||||
--sync-from-rm=[zone-name][,...]
|
||||
remove zones from list of zones to sync from
|
||||
--bucket-index-max-shards override a zone/zonegroup's default bucket index shard count
|
||||
--fix besides checking bucket index, will also fix it
|
||||
--check-objects bucket check: rebuilds bucket index according to
|
||||
actual objects state
|
||||
|
Loading…
Reference in New Issue
Block a user