if (store->svc()->zone->zone_id() == master_zone) {
// read the current period
RGWPeriod current_period;
- int ret = current_period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+ int ret = current_period.init(g_ceph_context,
+ store->svc()->sysobj, realm.get_id(),
+ null_yield);
if (ret < 0) {
cerr << "Error initializing current period: "
<< cpp_strerror(-ret) << std::endl;
return ret;
}
// the master zone can commit locally
- ret = period.commit(store, realm, current_period, cerr, force);
+ ret = period.commit(store, realm, current_period, cerr, null_yield, force);
if (ret < 0) {
cerr << "failed to commit period: " << cpp_strerror(-ret) << std::endl;
}
}
// the master zone gave us back the period that it committed, so it's
// safe to save it as our latest epoch
- ret = period.store_info(false);
+ ret = period.store_info(false, null_yield);
if (ret < 0) {
cerr << "Error storing committed period " << period.get_id() << ": "
<< cpp_strerror(ret) << std::endl;
return ret;
}
- ret = period.set_latest_epoch(period.get_epoch());
+ ret = period.set_latest_epoch(null_yield, period.get_epoch());
if (ret < 0) {
cerr << "Error updating period epoch: " << cpp_strerror(ret) << std::endl;
return ret;
}
- ret = period.reflect();
+ ret = period.reflect(null_yield);
if (ret < 0) {
cerr << "Error updating local objects: " << cpp_strerror(ret) << std::endl;
return ret;
}
- realm.notify_new_period(period);
+ realm.notify_new_period(period, null_yield);
return ret;
}
Formatter *formatter, bool force)
{
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0 ) {
cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
return ret;
epoch = atoi(period_epoch.c_str());
}
RGWPeriod period(period_id, epoch);
- ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+ ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
if (ret < 0) {
cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
return ret;
}
period.fork();
- ret = period.update();
+ ret = period.update(null_yield);
if(ret < 0) {
// Dropping the error message here, as both the ret codes were handled in
// period.update()
return ret;
}
- ret = period.store_info(false);
+ ret = period.store_info(false, null_yield);
if (ret < 0) {
cerr << "failed to store period: " << cpp_strerror(-ret) << std::endl;
return ret;
cerr << "request failed: " << cpp_strerror(-ret) << std::endl;
return ret;
}
- ret = period->init(g_ceph_context, store->svc()->sysobj, false);
+ ret = period->init(g_ceph_context, store->svc()->sysobj, null_yield, false);
if (ret < 0) {
cerr << "faile to init period " << cpp_strerror(-ret) << std::endl;
return ret;
cout << "failed to decode JSON input: " << e.what() << std::endl;
return -EINVAL;
}
- ret = period->store_info(false);
+ ret = period->store_info(false, null_yield);
if (ret < 0) {
cerr << "Error storing period " << period->get_id() << ": " << cpp_strerror(ret) << std::endl;
}
// store latest epoch (ignore errors)
- period->update_latest_epoch(period->get_epoch());
+ period->update_latest_epoch(period->get_epoch(), null_yield);
return 0;
}
std::string* period_id)
{
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
std::cerr << "failed to read realm: " << cpp_strerror(-ret) << std::endl;
return ret;
bucket(_bucket) {}
int init() {
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return ret;
int write_policy() {
if (!bucket) {
- int ret = zonegroup.update();
+ int ret = zonegroup.update(null_yield);
if (ret < 0) {
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
return EINVAL;
}
RGWPeriod period(period_id);
- int ret = period.init(g_ceph_context, store->svc()->sysobj);
+ int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "period.init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = period.delete_obj();
+ ret = period.delete_obj(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't delete period: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (staging) {
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0 ) {
cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
return -ret;
epoch = 1;
}
RGWPeriod period(period_id, epoch);
- int ret = period.init(g_ceph_context, store->svc()->sysobj, realm_id, realm_name);
+ int ret = period.init(g_ceph_context, store->svc()->sysobj, realm_id,
+ null_yield, realm_name);
if (ret < 0) {
cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
if (url.empty()) {
// load current period for endpoints
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWPeriod current_period(realm.get_current_period());
- ret = current_period.init(g_ceph_context, store->svc()->sysobj);
+ ret = current_period.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init current period: " << cpp_strerror(-ret) << std::endl;
return -ret;
RGWRealm realm(g_ceph_context, store->svc()->sysobj);
if (!realm_name.empty()) {
// look up realm_id for the given realm_name
- int ret = realm.read_id(realm_name, realm_id);
+ int ret = realm.read_id(realm_name, realm_id, null_yield);
if (ret < 0) {
cerr << "ERROR: failed to read realm for " << realm_name
<< ": " << cpp_strerror(-ret) << std::endl;
}
} else {
// use default realm_id when none is given
- int ret = realm.read_default_id(realm_id);
+ int ret = realm.read_default_id(realm_id, null_yield);
if (ret < 0 && ret != -ENOENT) { // on ENOENT, use empty realm_id
cerr << "ERROR: failed to read default realm: "
<< cpp_strerror(-ret) << std::endl;
}
RGWPeriodConfig period_config;
- int ret = period_config.read(store->svc()->sysobj, realm_id);
+ int ret = period_config.read(store->svc()->sysobj, realm_id, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "ERROR: failed to read period config: "
<< cpp_strerror(-ret) << std::endl;
if (opt_cmd != OPT::GLOBAL_QUOTA_GET) {
// write the modified period config
- ret = period_config.write(store->svc()->sysobj, realm_id);
+ ret = period_config.write(store->svc()->sysobj, realm_id, null_yield);
if (ret < 0) {
cerr << "ERROR: failed to write period config: "
<< cpp_strerror(-ret) << std::endl;
}
RGWRealm realm(realm_name, g_ceph_context, store->svc()->sysobj);
- int ret = realm.create();
+ int ret = realm.create(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't create realm " << realm_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (set_default) {
- ret = realm.set_as_default();
+ ret = realm.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
cerr << "missing realm name or id" << std::endl;
return EINVAL;
}
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = realm.delete_obj();
+ ret = realm.delete_obj(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't : " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::REALM_GET:
{
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
if (ret == -ENOENT && realm_name.empty() && realm_id.empty()) {
cerr << "missing realm name or id, or default realm not found" << std::endl;
{
RGWRealm realm(g_ceph_context, store->svc()->sysobj);
string default_id;
- int ret = realm.read_default_id(default_id);
+ int ret = realm.read_default_id(default_id, null_yield);
if (ret == -ENOENT) {
cout << "No default realm is set" << std::endl;
return -ret;
{
RGWRealm realm(g_ceph_context, store->svc()->sysobj);
string default_id;
- int ret = realm.read_default_id(default_id);
+ int ret = realm.read_default_id(default_id, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "could not determine default realm: " << cpp_strerror(-ret) << std::endl;
}
return -ret;
}
list<string> periods;
- ret = store->svc()->zone->list_periods(period_id, periods);
+ ret = store->svc()->zone->list_periods(period_id, periods, null_yield);
if (ret < 0) {
cerr << "list periods failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
cerr << "missing realm name or id" << std::endl;
return EINVAL;
}
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = realm.rename(realm_new_name);
+ ret = realm.rename(realm_new_name, null_yield);
if (ret < 0) {
cerr << "realm.rename failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWRealm realm(realm_id, realm_name);
bool new_realm = false;
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
if (new_realm) {
cout << "clearing period and epoch for new realm" << std::endl;
realm.clear_current_period_and_epoch();
- ret = realm.create();
+ ret = realm.create(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't create new realm: " << cpp_strerror(-ret) << std::endl;
return 1;
}
} else {
- ret = realm.update();
+ ret = realm.update(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't store realm info: " << cpp_strerror(-ret) << std::endl;
return 1;
}
if (set_default) {
- ret = realm.set_as_default();
+ ret = realm.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
case OPT::REALM_DEFAULT:
{
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = realm.set_as_default();
+ ret = realm.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set realm as default: " << cpp_strerror(-ret) << std::endl;
return -ret;
return -ret;
}
RGWRealm realm;
- realm.init(g_ceph_context, store->svc()->sysobj, false);
+ realm.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
try {
decode_json_obj(realm, &p);
} catch (const JSONDecoder::err& e) {
return -ret;
}
}
- ret = realm.create(false);
+ ret = realm.create(null_yield, false);
if (ret < 0 && ret != -EEXIST) {
cerr << "Error storing realm " << realm.get_id() << ": "
<< cpp_strerror(ret) << std::endl;
return -ret;
} else if (ret ==-EEXIST) {
- ret = realm.update();
+ ret = realm.update(null_yield);
if (ret < 0) {
cerr << "Error storing realm " << realm.get_id() << ": "
<< cpp_strerror(ret) << std::endl;
}
if (set_default) {
- ret = realm.set_as_default();
+ ret = realm.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
}
RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to initialize zonegroup " << zonegroup_name << " id " << zonegroup_id << " :"
<< cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneParams zone(zone_id, zone_name);
- ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (zone.realm_id != zonegroup.realm_id) {
zone.realm_id = zonegroup.realm_id;
- ret = zone.update();
+ ret = zone.update(null_yield);
if (ret < 0) {
cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
return -ret;
endpoints, ptier_type,
psync_from_all, sync_from, sync_from_rm,
predirect_zone, bucket_index_max_shards,
- store->svc()->sync_modules->get_manager());
+ store->svc()->sync_modules->get_manager(),
+ null_yield);
if (ret < 0) {
cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": "
<< cpp_strerror(-ret) << std::endl;
return EINVAL;
}
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, store->svc()->sysobj, realm.get_id(), endpoints);
zonegroup.api_name = (api_name.empty() ? zonegroup_name : api_name);
- ret = zonegroup.create();
+ ret = zonegroup.create(null_yield);
if (ret < 0) {
cerr << "failed to create zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (set_default) {
- ret = zonegroup.set_as_default();
+ ret = zonegroup.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zonegroup.set_as_default();
+ ret = zonegroup.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zonegroup as default: " << cpp_strerror(-ret) << std::endl;
return -ret;
return EINVAL;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+ null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zonegroup.delete_obj();
+ ret = zonegroup.delete_obj(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't delete zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONEGROUP_GET:
{
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONEGROUP_LIST:
{
RGWZoneGroup zonegroup;
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, false);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+ null_yield, false);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
return -ret;
}
string default_zonegroup;
- ret = zonegroup.read_default_id(default_zonegroup);
+ ret = zonegroup.read_default_id(default_zonegroup, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "could not determine default zonegroup: " << cpp_strerror(-ret) << std::endl;
}
case OPT::ZONEGROUP_MODIFY:
{
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (is_master_set) {
- zonegroup.update_master(is_master);
+ zonegroup.update_master(is_master, null_yield);
need_update = true;
}
} else if (!realm_name.empty()) {
// get realm id from name
RGWRealm realm{g_ceph_context, store->svc()->sysobj};
- ret = realm.read_id(realm_name, zonegroup.realm_id);
+ ret = realm.read_id(realm_name, zonegroup.realm_id, null_yield);
if (ret < 0) {
cerr << "failed to find realm by name " << realm_name << std::endl;
return -ret;
}
if (need_update) {
- ret = zonegroup.update();
+ ret = zonegroup.update(null_yield);
if (ret < 0) {
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (set_default) {
- ret = zonegroup.set_as_default();
+ ret = zonegroup.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
case OPT::ZONEGROUP_SET:
{
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
- bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+ bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
if (ret < 0 && !default_realm_not_exist ) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
}
RGWZoneGroup zonegroup;
- ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, false);
+ ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+ null_yield, false);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
if (zonegroup.realm_id.empty() && !default_realm_not_exist) {
zonegroup.realm_id = realm.get_id();
}
- ret = zonegroup.create();
+ ret = zonegroup.create(null_yield);
if (ret < 0 && ret != -EEXIST) {
cerr << "ERROR: couldn't create zonegroup info: " << cpp_strerror(-ret) << std::endl;
return 1;
} else if (ret == -EEXIST) {
- ret = zonegroup.update();
+ ret = zonegroup.update(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't store zonegroup info: " << cpp_strerror(-ret) << std::endl;
return 1;
}
if (set_default) {
- ret = zonegroup.set_as_default();
+ ret = zonegroup.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
case OPT::ZONEGROUP_REMOVE:
{
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
}
- ret = zonegroup.remove_zone(zone_id);
+ ret = zonegroup.remove_zone(zone_id, null_yield);
if (ret < 0) {
cerr << "failed to remove zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
return EINVAL;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zonegroup.rename(zonegroup_new_name);
+ ret = zonegroup.rename(zonegroup_new_name, null_yield);
if (ret < 0) {
cerr << "failed to rename zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONEGROUP_PLACEMENT_LIST:
{
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+ null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
zonegroup.default_placement = rule;
}
- zonegroup.post_process_params();
- ret = zonegroup.update();
+ zonegroup.post_process_params(null_yield);
+ ret = zonegroup.update(null_yield);
if (ret < 0) {
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
/* if the user didn't provide zonegroup info , create stand alone zone */
if (!zonegroup_id.empty() || !zonegroup_name.empty()) {
- ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneParams zone(zone_id, zone_name);
- ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+ ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
}
- ret = zone.create();
+ ret = zone.create(null_yield);
if (ret < 0) {
cerr << "failed to create zone " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
psync_from_all,
sync_from, sync_from_rm,
predirect_zone, bucket_index_max_shards,
- store->svc()->sync_modules->get_manager());
+ store->svc()->sync_modules->get_manager(),
+ null_yield);
if (ret < 0) {
cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name()
<< ": " << cpp_strerror(-ret) << std::endl;
}
if (set_default) {
- ret = zone.set_as_default();
+ ret = zone.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
case OPT::ZONE_DEFAULT:
{
RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
}
return EINVAL;
}
RGWZoneParams zone(zone_id, zone_name);
- ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zone.set_as_default();
+ ret = zone.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zone as default: " << cpp_strerror(-ret) << std::endl;
return -ret;
return EINVAL;
}
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
for (list<string>::iterator iter = zonegroups.begin(); iter != zonegroups.end(); ++iter) {
RGWZoneGroup zonegroup(string(), *iter);
- int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
continue;
}
- ret = zonegroup.remove_zone(zone.get_id());
+ ret = zonegroup.remove_zone(zone.get_id(), null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "failed to remove zone " << zone_name << " from zonegroup " << zonegroup.get_name() << ": "
<< cpp_strerror(-ret) << std::endl;
}
}
- ret = zone.delete_obj();
+ ret = zone.delete_obj(null_yield);
if (ret < 0) {
cerr << "failed to delete zone " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONE_GET:
{
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONE_SET:
{
RGWZoneParams zone(zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield,
+ false);
if (ret < 0) {
return -ret;
}
- ret = zone.read();
+ ret = zone.read(null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "zone.read() returned ret=" << ret << std::endl;
return -ret;
if(zone.realm_id.empty()) {
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
cerr << "zone id " << zone.get_id();
- ret = zone.fix_pool_names();
+ ret = zone.fix_pool_names(null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't fix zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zone.write(false);
+ ret = zone.write(false, null_yield);
if (ret < 0) {
cerr << "ERROR: couldn't create zone: " << cpp_strerror(-ret) << std::endl;
return 1;
}
if (set_default) {
- ret = zone.set_as_default();
+ ret = zone.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
}
RGWZoneParams zone;
- ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+ ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
if (ret < 0) {
cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
string default_zone;
- ret = zone.read_default_id(default_zone);
+ ret = zone.read_default_id(default_zone, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "could not determine default zone: " << cpp_strerror(-ret) << std::endl;
}
case OPT::ZONE_MODIFY:
{
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
} else if (!realm_name.empty()) {
// get realm id from name
RGWRealm realm{g_ceph_context, store->svc()->sysobj};
- ret = realm.read_id(realm_name, zone.realm_id);
+ ret = realm.read_id(realm_name, zone.realm_id, null_yield);
if (ret < 0) {
cerr << "failed to find realm by name " << realm_name << std::endl;
return -ret;
}
if (need_zone_update) {
- ret = zone.update();
+ ret = zone.update(null_yield);
if (ret < 0) {
cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
endpoints, ptier_type,
psync_from_all, sync_from, sync_from_rm,
predirect_zone, bucket_index_max_shards,
- store->svc()->sync_modules->get_manager());
+ store->svc()->sync_modules->get_manager(),
+ null_yield);
if (ret < 0) {
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zonegroup.update();
+ ret = zonegroup.update(null_yield);
if (ret < 0) {
cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (set_default) {
- ret = zone.set_as_default();
+ ret = zone.set_as_default(null_yield);
if (ret < 0) {
cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
return EINVAL;
}
RGWZoneParams zone(zone_id,zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = zone.rename(zone_new_name);
+ ret = zone.rename(zone_new_name, null_yield);
if (ret < 0) {
cerr << "failed to rename zone " << zone_name << " to " << zone_new_name << ": " << cpp_strerror(-ret)
<< std::endl;
return -ret;
}
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
} else {
- ret = zonegroup.rename_zone(zone);
+ ret = zonegroup.rename_zone(zone, null_yield);
if (ret < 0) {
cerr << "Error in zonegroup rename for " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
if (opt_cmd == OPT::ZONE_PLACEMENT_ADD ||
opt_cmd == OPT::ZONE_PLACEMENT_MODIFY) {
RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
- ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+ ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
}
- ret = zone.update();
+ ret = zone.update(null_yield);
if (ret < 0) {
cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
return -ret;
case OPT::ZONE_PLACEMENT_LIST:
{
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWZoneParams zone(zone_id, zone_name);
- int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+ int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
// load the period
RGWPeriod period(period_id);
- int ret = period.init(g_ceph_context, store->svc()->sysobj);
+ int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
{
// read realm and staging period
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+ int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
if (ret < 0) {
cerr << "Error initializing realm: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
RGWPeriod period(RGWPeriod::get_staging_id(realm.get_id()), 1);
- ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+ ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
if (ret < 0) {
cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
return -ret;
}
- ret = sync.run();
+ ret = sync.run(null_yield);
if (ret < 0) {
cerr << "ERROR: sync.run() returned ret=" << ret << std::endl;
return -ret;
// add a watcher to respond to realm configuration changes
- RGWPeriodPusher pusher(store);
+ RGWPeriodPusher pusher(store, null_yield);
RGWFrontendPauser pauser(fes, implicit_tenant_context, &pusher);
auto reloader = std::make_unique<RGWRealmReloader>(store,
service_map_meta, &pauser);
~Impl();
Cursor get_current() const { return current_cursor; }
- Cursor attach(RGWPeriod&& period);
+ Cursor attach(RGWPeriod&& period, optional_yield y);
Cursor insert(RGWPeriod&& period);
Cursor lookup(epoch_t realm_epoch);
histories.clear_and_dispose(std::default_delete<History>{});
}
-Cursor RGWPeriodHistory::Impl::attach(RGWPeriod&& period)
+Cursor RGWPeriodHistory::Impl::attach(RGWPeriod&& period, optional_yield y)
{
if (current_history == histories.end()) {
return Cursor{-EINVAL};
}
// pull the period outside of the lock
- int r = puller->pull(predecessor_id, period);
+ int r = puller->pull(predecessor_id, period, y);
if (r < 0) {
return Cursor{r};
}
{
return impl->get_current();
}
-Cursor RGWPeriodHistory::attach(RGWPeriod&& period)
+Cursor RGWPeriodHistory::attach(RGWPeriod&& period, optional_yield y)
{
- return impl->attach(std::move(period));
+ return impl->attach(std::move(period), y);
}
Cursor RGWPeriodHistory::insert(RGWPeriod&& period)
{
#include <boost/intrusive/avl_set.hpp>
#include "include/ceph_assert.h"
#include "include/types.h"
+#include "common/async/yield_context.h"
namespace bi = boost::intrusive;
public:
virtual ~Puller() = default;
- virtual int pull(const std::string& period_id, RGWPeriod& period) = 0;
+ virtual int pull(const std::string& period_id, RGWPeriod& period,
+ optional_yield y) = 0;
};
RGWPeriodHistory(CephContext* cct, Puller* puller,
/// current_period and the given period, reading predecessor periods or
/// fetching them from the master as necessary. returns a cursor at the
/// given period that can be used to traverse the current_history
- Cursor attach(RGWPeriod&& period);
+ Cursor attach(RGWPeriod&& period, optional_yield y);
/// insert the given period into an existing history, or create a new
/// unconnected history. similar to attach(), but it doesn't try to fetch
} // anonymous namespace
-int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
+int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period,
+ optional_yield y)
{
// try to read the period from rados
period.set_id(period_id);
period.set_epoch(0);
- int r = period.init(cct, svc.sysobj);
+ int r = period.init(cct, svc.sysobj, y);
if (r < 0) {
if (svc.zone->is_meta_master()) {
// can't pull if we're the master
return r;
}
// write the period to rados
- r = period.store_info(true);
+ r = period.store_info(true, y);
if (r == -EEXIST) {
r = 0;
} else if (r < 0) {
return r;
}
// update latest epoch
- r = period.update_latest_epoch(period.get_epoch());
+ r = period.update_latest_epoch(period.get_epoch(), y);
if (r == -EEXIST) {
// already have this epoch (or a more recent one)
return 0;
}
// reflect period objects if this is the latest version
if (svc.zone->get_realm().get_current_period() == period_id) {
- r = period.reflect();
+ r = period.reflect(y);
if (r < 0) {
return r;
}
#include "rgw_period_history.h"
#include "include/common_fwd.h"
+#include "rgw/services/svc_sys_obj.h"
class RGWPeriod;
public:
explicit RGWPeriodPuller(RGWSI_Zone *zone_svc, RGWSI_SysObj *sysobj_svc);
- int pull(const std::string& period_id, RGWPeriod& period) override;
+ int pull(const std::string& period_id, RGWPeriod& period, optional_yield y) override;
};
#endif // CEPH_RGW_PERIOD_PULLER_H
};
-RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store)
+RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store,
+ optional_yield y)
: cct(store->ctx()), store(store)
{
const auto& realm = store->svc()->zone->get_realm();
// always send out the current period on startup
RGWPeriod period;
- int r = period.init(cct, store->svc()->sysobj, realm_id, realm.get_name());
+ int r = period.init(cct, store->svc()->sysobj, realm_id, y, realm.get_name());
if (r < 0) {
lderr(cct) << "failed to load period for realm " << realm_id << dendl;
return;
#include <mutex>
#include <vector>
+#include "common/async/yield_context.h"
#include "rgw_realm_reloader.h"
namespace rgw {
class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
public RGWRealmReloader::Pauser {
public:
- explicit RGWPeriodPusher(rgw::sal::RGWRadosStore* store);
+ explicit RGWPeriodPusher(rgw::sal::RGWRadosStore* store, optional_yield y);
~RGWPeriodPusher() override;
/// respond to realm notifications by pushing new periods to other zones
}
int process() override {
- sync.run();
+ sync.run(null_yield);
return 0;
}
};
#define dout_subsys ceph_subsys_rgw
void RGWOp_ZoneGroupMap_Get::execute(optional_yield y) {
- op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj);
+ op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj, y);
if (op_ret < 0) {
dout(5) << "failed to read zone_group map" << dendl;
}
period.set_id(period_id);
period.set_epoch(epoch);
- op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, realm_name);
+ op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, y, realm_name);
if (op_ret < 0)
ldout(store->ctx(), 5) << "failed to read period" << dendl;
}
auto cct = store->ctx();
// initialize the period without reading from rados
- period.init(cct, store->svc()->sysobj, false);
+ period.init(cct, store->svc()->sysobj, y, false);
// decode the period from input
const auto max_size = cct->_conf->rgw_max_put_param_size;
// period that we haven't restarted with yet. we also don't want to modify
// the objects in use by RGWRados
RGWRealm realm(period.get_realm());
- op_ret = realm.init(cct, store->svc()->sysobj);
+ op_ret = realm.init(cct, store->svc()->sysobj, y);
if (op_ret < 0) {
lderr(cct) << "failed to read current realm: "
<< cpp_strerror(-op_ret) << dendl;
}
RGWPeriod current_period;
- op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id());
+ op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id(), y);
if (op_ret < 0) {
lderr(cct) << "failed to read current period: "
<< cpp_strerror(-op_ret) << dendl;
// if period id is empty, handle as 'period commit'
if (period.get_id().empty()) {
- op_ret = period.commit(store, realm, current_period, error_stream);
+ op_ret = period.commit(store, realm, current_period, error_stream, y);
if (op_ret < 0) {
lderr(cct) << "master zone failed to commit period" << dendl;
}
}
// write the period to rados
- op_ret = period.store_info(false);
+ op_ret = period.store_info(false, y);
if (op_ret < 0) {
lderr(cct) << "failed to store period " << period.get_id() << dendl;
return;
}
// set as latest epoch
- op_ret = period.update_latest_epoch(period.get_epoch());
+ op_ret = period.update_latest_epoch(period.get_epoch(), y);
if (op_ret == -EEXIST) {
// already have this epoch (or a more recent one)
ldout(cct, 4) << "already have epoch >= " << period.get_epoch()
return;
}
// attach a copy of the period into the period history
- auto cursor = period_history->attach(RGWPeriod{period});
+ auto cursor = period_history->attach(RGWPeriod{period}, y);
if (!cursor) {
// we're missing some history between the new period and current_period
op_ret = cursor.get_error();
return;
}
// set as current period
- op_ret = realm.set_current_period(period);
+ op_ret = realm.set_current_period(period, y);
if (op_ret < 0) {
lderr(cct) << "failed to update realm's current period" << dendl;
return;
ldout(cct, 4) << "period " << period.get_id()
<< " is newer than current period " << current_period.get_id()
<< ", updating realm's current period and notifying zone" << dendl;
- realm.notify_new_period(period);
+ realm.notify_new_period(period, y);
return;
}
// reflect the period into our local objects
- op_ret = period.reflect();
+ op_ret = period.reflect(y);
if (op_ret < 0) {
lderr(cct) << "failed to update local objects: "
<< cpp_strerror(-op_ret) << dendl;
ldout(cct, 4) << "period epoch " << period.get_epoch()
<< " is newer than current epoch " << current_period.get_epoch()
<< ", updating period's latest epoch and notifying zone" << dendl;
- realm.notify_new_period(period);
+ realm.notify_new_period(period, y);
// update the period history
period_history->insert(RGWPeriod{period});
}
// read realm
realm.reset(new RGWRealm(id, name));
- op_ret = realm->init(g_ceph_context, store->svc()->sysobj);
+ op_ret = realm->init(g_ceph_context, store->svc()->sysobj, y);
if (op_ret < 0)
lderr(store->ctx()) << "failed to read realm id=" << id
<< " name=" << name << dendl;
{
// read default realm
RGWRealm realm(store->ctx(), store->svc()->sysobj);
- [[maybe_unused]] int ret = realm.read_default_id(default_id);
+ [[maybe_unused]] int ret = realm.read_default_id(default_id, y);
}
op_ret = store->svc()->zone->list_realms(realms);
if (op_ret < 0)
// return a cursor to the period at our sync position
static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
- const rgw_meta_sync_info& info)
+ const rgw_meta_sync_info& info,
+ optional_yield y)
{
if (info.period.empty()) {
// return an empty cursor with error=0
// read the period from rados or pull it from the master
RGWPeriod period;
- int r = store->svc()->mdlog->pull_period(info.period, period);
+ int r = store->svc()->mdlog->pull_period(info.period, period, y);
if (r < 0) {
lderr(store->ctx()) << "ERROR: failed to read period id "
<< info.period << ": " << cpp_strerror(r) << dendl;
return RGWPeriodHistory::Cursor{r};
}
// attach the period to our history
- cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period));
+ cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period), y);
if (!cursor) {
r = cursor.get_error();
lderr(store->ctx()) << "ERROR: failed to read period history back to "
return cursor;
}
-int RGWRemoteMetaLog::run_sync()
+int RGWRemoteMetaLog::run_sync(optional_yield y)
{
if (store->svc()->zone->is_meta_master()) {
return 0;
case rgw_meta_sync_info::StateSync:
tn->log(20, "sync");
// find our position in the period history (if any)
- cursor = get_period_at(store, sync_status.sync_info);
+ cursor = get_period_at(store, sync_status.sync_info, y);
r = cursor.get_error();
if (r < 0) {
return r;
int read_master_log_shards_next(const string& period, map<int, string> shard_markers, map<int, rgw_mdlog_shard_data> *result);
int read_sync_status(rgw_meta_sync_status *sync_status);
int init_sync_status();
- int run_sync();
+ int run_sync(optional_yield y);
void wakeup(int shard_id);
return master_log.read_master_log_shards_next(period, shard_markers, result);
}
- int run() { return master_log.run_sync(); }
+ int run(optional_yield y) { return master_log.run_sync(y); }
// implements DoutPrefixProvider
return rgw_pool(cct_->_conf->rgw_zonegroup_root_pool);
}
-int RGWZoneGroup::create_default(bool old_format)
+int RGWZoneGroup::create_default(optional_yield y, bool old_format)
{
name = default_zonegroup_name;
api_name = default_zonegroup_name;
RGWZoneParams zone_params(default_zone_name);
- int r = zone_params.init(cct, sysobj_svc, false);
+ int r = zone_params.init(cct, sysobj_svc, y, false);
if (r < 0) {
ldout(cct, 0) << "create_default: error initializing zone params: " << cpp_strerror(-r) << dendl;
return r;
}
- r = zone_params.create_default();
+ r = zone_params.create_default(y);
if (r < 0 && r != -EEXIST) {
ldout(cct, 0) << "create_default: error in create_default zone params: " << cpp_strerror(-r) << dendl;
return r;
} else if (r == -EEXIST) {
ldout(cct, 10) << "zone_params::create_default() returned -EEXIST, we raced with another default zone_params creation" << dendl;
zone_params.clear_id();
- r = zone_params.init(cct, sysobj_svc);
+ r = zone_params.init(cct, sysobj_svc, y);
if (r < 0) {
ldout(cct, 0) << "create_default: error in init existing zone params: " << cpp_strerror(-r) << dendl;
return r;
default_zone.id = zone_params.get_id();
master_zone = default_zone.id;
- r = create();
+ r = create(y);
if (r < 0 && r != -EEXIST) {
ldout(cct, 0) << "error storing zone group info: " << cpp_strerror(-r) << dendl;
return r;
if (r == -EEXIST) {
ldout(cct, 10) << "create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl;
id.clear();
- r = init(cct, sysobj_svc);
+ r = init(cct, sysobj_svc, y);
if (r < 0) {
return r;
}
name = id;
}
- post_process_params();
+ post_process_params(y);
return 0;
}
const list<string>& endpoints, const string *ptier_type,
bool *psync_from_all, list<string>& sync_from, list<string>& sync_from_rm,
string *predirect_zone, std::optional<int> bucket_index_max_shards,
- RGWSyncModulesManager *sync_mgr)
+ RGWSyncModulesManager *sync_mgr,
+ optional_yield y)
{
auto& zone_id = zone_params.get_id();
auto& zone_name = zone_params.get_name();
zone.sync_from.erase(rm);
}
- post_process_params();
+ post_process_params(y);
- return update();
+ return update(y);
}
-int RGWZoneGroup::rename_zone(const RGWZoneParams& zone_params)
-{
+int RGWZoneGroup::rename_zone(const RGWZoneParams& zone_params,
+ optional_yield y)
+{
RGWZone& zone = zones[zone_params.get_id()];
zone.name = zone_params.get_name();
-
- return update();
+
+ return update(y);
}
-void RGWZoneGroup::post_process_params()
+void RGWZoneGroup::post_process_params(optional_yield y)
{
bool log_data = zones.size() > 1;
zone.log_data = log_data;
RGWZoneParams zone_params(zone.id, zone.name);
- int ret = zone_params.init(cct, sysobj_svc);
+ int ret = zone_params.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: could not read zone params for zone id=" << zone.id << " name=" << zone.name << dendl;
continue;
}
}
-int RGWZoneGroup::remove_zone(const std::string& zone_id)
+int RGWZoneGroup::remove_zone(const std::string& zone_id, optional_yield y)
{
auto iter = zones.find(zone_id);
if (iter == zones.end()) {
zones.erase(iter);
- post_process_params();
+ post_process_params(y);
- return update();
+ return update(y);
}
-int RGWZoneGroup::read_default_id(string& default_id, bool old_format)
+int RGWZoneGroup::read_default_id(string& default_id, optional_yield y,
+ bool old_format)
{
if (realm_id.empty()) {
/* try using default realm */
RGWRealm realm;
- int ret = realm.init(cct, sysobj_svc);
+ int ret = realm.init(cct, sysobj_svc, y);
// no default realm exist
if (ret < 0) {
- return read_id(default_zonegroup_name, default_id);
+ return read_id(default_zonegroup_name, default_id, y);
}
realm_id = realm.get_id();
}
- return RGWSystemMetaObj::read_default_id(default_id, old_format);
+ return RGWSystemMetaObj::read_default_id(default_id, y, old_format);
}
-int RGWZoneGroup::set_as_default(bool exclusive)
+int RGWZoneGroup::set_as_default(optional_yield y, bool exclusive)
{
if (realm_id.empty()) {
/* try using default realm */
RGWRealm realm;
- int ret = realm.init(cct, sysobj_svc);
+ int ret = realm.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl;
return -EINVAL;
realm_id = realm.get_id();
}
- return RGWSystemMetaObj::set_as_default(exclusive);
+ return RGWSystemMetaObj::set_as_default(y, exclusive);
}
void RGWSystemMetaObj::reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_svc)
zone_svc = _sysobj_svc->get_zone_svc();
}
-int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj, bool old_format)
+int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+ optional_yield y,
+ bool setup_obj, bool old_format)
{
reinit_instance(_cct, _sysobj_svc);
name = get_predefined_name(cct);
}
if (name.empty()) {
- r = use_default(old_format);
+ r = use_default(y, old_format);
if (r < 0) {
return r;
}
} else if (!old_format) {
- r = read_id(name, id);
+ r = read_id(name, id, y);
if (r < 0) {
if (r != -ENOENT) {
ldout(cct, 0) << "error in read_id for object name: " << name << " : " << cpp_strerror(-r) << dendl;
}
}
- return read_info(id, old_format);
+ return read_info(id, y, old_format);
}
-int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info, const string& oid)
+int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info,
+ const string& oid, optional_yield y)
{
using ceph::decode;
auto pool = get_pool(cct);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0)
return ret;
return 0;
}
-int RGWSystemMetaObj::read_default_id(string& default_id, bool old_format)
+int RGWSystemMetaObj::read_default_id(string& default_id, optional_yield y,
+ bool old_format)
{
RGWDefaultSystemMetaObjInfo default_info;
- int ret = read_default(default_info, get_default_oid(old_format));
+ int ret = read_default(default_info, get_default_oid(old_format), y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWSystemMetaObj::use_default(bool old_format)
+int RGWSystemMetaObj::use_default(optional_yield y, bool old_format)
{
- return read_default_id(id, old_format);
+ return read_default_id(id, y, old_format);
}
-int RGWSystemMetaObj::set_as_default(bool exclusive)
+int RGWSystemMetaObj::set_as_default(optional_yield y, bool exclusive)
{
using ceph::encode;
string oid = get_default_oid();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
int ret = sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
if (ret < 0)
return ret;
return 0;
}
-int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id)
+int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id,
+ optional_yield y)
{
using ceph::decode;
rgw_pool pool(get_pool(cct));
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWSystemMetaObj::delete_obj(bool old_format)
+int RGWSystemMetaObj::delete_obj(optional_yield y, bool old_format)
{
rgw_pool pool(get_pool(cct));
/* check to see if obj is the default */
RGWDefaultSystemMetaObjInfo default_info;
- int ret = read_default(default_info, get_default_oid(old_format));
+ int ret = read_default(default_info, get_default_oid(old_format), y);
if (ret < 0 && ret != -ENOENT)
return ret;
if (default_info.default_id == id || (old_format && default_info.default_id == name)) {
string oid = get_default_oid(old_format);
rgw_raw_obj default_named_obj(pool, oid);
auto sysobj = sysobj_svc->get_obj(obj_ctx, default_named_obj);
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "Error delete default obj name " << name << ": " << cpp_strerror(-ret) << dendl;
return ret;
string oid = get_names_oid_prefix() + name;
rgw_raw_obj object_name(pool, oid);
auto sysobj = sysobj_svc->get_obj(obj_ctx, object_name);
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "Error delete obj name " << name << ": " << cpp_strerror(-ret) << dendl;
return ret;
rgw_raw_obj object_id(pool, oid);
auto sysobj = sysobj_svc->get_obj(obj_ctx, object_id);
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "Error delete object id " << id << ": " << cpp_strerror(-ret) << dendl;
}
return ret;
}
-int RGWSystemMetaObj::store_name(bool exclusive)
+int RGWSystemMetaObj::store_name(bool exclusive, optional_yield y)
{
rgw_pool pool(get_pool(cct));
string oid = get_names_oid_prefix() + name;
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
return sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
}
-int RGWSystemMetaObj::rename(const string& new_name)
+int RGWSystemMetaObj::rename(const string& new_name, optional_yield y)
{
string new_id;
- int ret = read_id(new_name, new_id);
+ int ret = read_id(new_name, new_id, y);
if (!ret) {
return -EEXIST;
}
}
string old_name = name;
name = new_name;
- ret = update();
+ ret = update(y);
if (ret < 0) {
ldout(cct, 0) << "Error storing new obj info " << new_name << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = store_name(true);
+ ret = store_name(true, y);
if (ret < 0) {
ldout(cct, 0) << "Error storing new name " << new_name << ": " << cpp_strerror(-ret) << dendl;
return ret;
rgw_raw_obj old_name_obj(pool, oid);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, old_name_obj);
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "Error delete old obj name " << old_name << ": " << cpp_strerror(-ret) << dendl;
return ret;
return ret;
}
-int RGWSystemMetaObj::read_info(const string& obj_id, bool old_format)
+int RGWSystemMetaObj::read_info(const string& obj_id, optional_yield y,
+ bool old_format)
{
rgw_pool pool(get_pool(cct));
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0) {
ldout(cct, 0) << "failed reading obj info from " << pool << ":" << oid << ": " << cpp_strerror(-ret) << dendl;
return ret;
return 0;
}
-int RGWSystemMetaObj::read()
+int RGWSystemMetaObj::read(optional_yield y)
{
- int ret = read_id(name, id);
+ int ret = read_id(name, id, y);
if (ret < 0) {
return ret;
}
- return read_info(id);
+ return read_info(id, y);
}
-int RGWSystemMetaObj::create(bool exclusive)
+int RGWSystemMetaObj::create(optional_yield y, bool exclusive)
{
int ret;
-
+
/* check to see the name is not used */
- ret = read_id(name, id);
+ ret = read_id(name, id, y);
if (exclusive && ret == 0) {
ldout(cct, 10) << "ERROR: name " << name << " already in use for obj id " << id << dendl;
return -EEXIST;
id = uuid_str;
}
- ret = store_info(exclusive);
+ ret = store_info(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing info for " << id << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
- return store_name(exclusive);
+ return store_name(exclusive, y);
}
-int RGWSystemMetaObj::store_info(bool exclusive)
+int RGWSystemMetaObj::store_info(bool exclusive, optional_yield y)
{
rgw_pool pool(get_pool(cct));
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
return sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
}
-int RGWSystemMetaObj::write(bool exclusive)
+int RGWSystemMetaObj::write(bool exclusive, optional_yield y)
{
- int ret = store_info(exclusive);
+ int ret = store_info(exclusive, y);
if (ret < 0) {
ldout(cct, 20) << __func__ << "(): store_info() returned ret=" << ret << dendl;
return ret;
}
- ret = store_name(exclusive);
+ ret = store_name(exclusive, y);
if (ret < 0) {
ldout(cct, 20) << __func__ << "(): store_name() returned ret=" << ret << dendl;
return ret;
return cct->_conf->rgw_realm;
}
-int RGWRealm::create(bool exclusive)
+int RGWRealm::create(optional_yield y, bool exclusive)
{
- int ret = RGWSystemMetaObj::create(exclusive);
+ int ret = RGWSystemMetaObj::create(y, exclusive);
if (ret < 0) {
ldout(cct, 0) << "ERROR creating new realm object " << name << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
// create the control object for watch/notify
- ret = create_control(exclusive);
+ ret = create_control(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR creating control for new realm " << name << ": " << cpp_strerror(-ret) << dendl;
return ret;
RGWPeriod period;
if (current_period.empty()) {
/* create new period for the realm */
- ret = period.init(cct, sysobj_svc, id, name, false);
+ ret = period.init(cct, sysobj_svc, id, y, name, false);
if (ret < 0 ) {
return ret;
}
- ret = period.create(true);
+ ret = period.create(y, true);
if (ret < 0) {
ldout(cct, 0) << "ERROR: creating new period for realm " << name << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
} else {
period = RGWPeriod(current_period, 0);
- int ret = period.init(cct, sysobj_svc, id, name);
+ int ret = period.init(cct, sysobj_svc, id, y, name);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to init period " << current_period << dendl;
return ret;
}
}
- ret = set_current_period(period);
+ ret = set_current_period(period, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed set current period " << current_period << dendl;
return ret;
}
// try to set as default. may race with another create, so pass exclusive=true
// so we don't override an existing default
- ret = set_as_default(true);
+ ret = set_as_default(y, true);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << "WARNING: failed to set realm as default realm, ret=" << ret << dendl;
}
return 0;
}
-int RGWRealm::delete_obj()
+int RGWRealm::delete_obj(optional_yield y)
{
- int ret = RGWSystemMetaObj::delete_obj();
+ int ret = RGWSystemMetaObj::delete_obj(y);
if (ret < 0) {
return ret;
}
- return delete_control();
+ return delete_control(y);
}
-int RGWRealm::create_control(bool exclusive)
+int RGWRealm::create_control(bool exclusive, optional_yield y)
{
auto pool = rgw_pool{get_pool(cct)};
auto oid = get_control_oid();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
return sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
}
-int RGWRealm::delete_control()
+int RGWRealm::delete_control(optional_yield y)
{
auto pool = rgw_pool{get_pool(cct)};
auto obj = rgw_raw_obj{pool, get_control_oid()};
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, obj);
- return sysobj.wop().remove(null_yield);
+ return sysobj.wop().remove(y);
}
rgw_pool RGWRealm::get_pool(CephContext *cct) const
return realm_info_oid_prefix;
}
-int RGWRealm::set_current_period(RGWPeriod& period)
+int RGWRealm::set_current_period(RGWPeriod& period, optional_yield y)
{
// update realm epoch to match the period's
if (epoch > period.get_realm_epoch()) {
epoch = period.get_realm_epoch();
current_period = period.get_id();
- int ret = update();
+ int ret = update(y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: period update: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = period.reflect();
+ ret = period.reflect(y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: period.reflect(): " << cpp_strerror(-ret) << dendl;
return ret;
return get_info_oid_prefix() + id + ".control";
}
-int RGWRealm::notify_zone(bufferlist& bl)
+int RGWRealm::notify_zone(bufferlist& bl, optional_yield y)
{
rgw_pool pool{get_pool(cct)};
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_control_oid()});
- int ret = sysobj.wn().notify(bl, 0, nullptr, null_yield);
+ int ret = sysobj.wn().notify(bl, 0, nullptr, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRealm::notify_new_period(const RGWPeriod& period)
+int RGWRealm::notify_new_period(const RGWPeriod& period, optional_yield y)
{
bufferlist bl;
using ceph::encode;
// reload the gateway with the new period
encode(RGWRealmNotify::Reload, bl);
- return notify_zone(bl);
+ return notify_zone(bl, y);
}
std::string RGWPeriodConfig::get_oid(const std::string& realm_id)
return {pool_name};
}
-int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
+int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id,
+ optional_yield y)
{
const auto& pool = get_pool(sysobj_svc->ctx());
const auto& oid = get_oid(realm_id);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWPeriodConfig::write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
+int RGWPeriodConfig::write(RGWSI_SysObj *sysobj_svc,
+ const std::string& realm_id, optional_yield y)
{
const auto& pool = get_pool(sysobj_svc->ctx());
const auto& oid = get_oid(realm_id);
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
return sysobj.wop()
.set_exclusive(false)
- .write(bl, null_yield);
+ .write(bl, y);
}
-int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const string& period_realm_id,
+int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+ const string& period_realm_id, optional_yield y,
const string& period_realm_name, bool setup_obj)
{
cct = _cct;
if (!setup_obj)
return 0;
- return init(_cct, _sysobj_svc, setup_obj);
+ return init(_cct, _sysobj_svc, y, setup_obj);
}
-int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj)
+int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+ optional_yield y, bool setup_obj)
{
cct = _cct;
sysobj_svc = _sysobj_svc;
if (id.empty()) {
RGWRealm realm(realm_id, realm_name);
- int ret = realm.init(cct, sysobj_svc);
+ int ret = realm.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << "RGWPeriod::init failed to init realm " << realm_name << " id " << realm_id << " : " <<
cpp_strerror(-ret) << dendl;
}
if (!epoch) {
- int ret = use_latest_epoch();
+ int ret = use_latest_epoch(y);
if (ret < 0) {
ldout(cct, 0) << "failed to use_latest_epoch period id " << id << " realm " << realm_name << " id " << realm_id
<< " : " << cpp_strerror(-ret) << dendl;
}
}
- return read_info();
+ return read_info(y);
}
}
int RGWPeriod::read_latest_epoch(RGWPeriodLatestEpochInfo& info,
+ optional_yield y,
RGWObjVersionTracker *objv)
{
string oid = get_period_oid_prefix() + get_latest_epoch_oid();
bufferlist bl;
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0) {
ldout(cct, 1) << "error read_lastest_epoch " << pool << ":" << oid << dendl;
return ret;
return 0;
}
-int RGWPeriod::get_latest_epoch(epoch_t& latest_epoch)
+int RGWPeriod::get_latest_epoch(epoch_t& latest_epoch, optional_yield y)
{
RGWPeriodLatestEpochInfo info;
- int ret = read_latest_epoch(info);
+ int ret = read_latest_epoch(info, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWPeriod::use_latest_epoch()
+int RGWPeriod::use_latest_epoch(optional_yield y)
{
RGWPeriodLatestEpochInfo info;
- int ret = read_latest_epoch(info);
+ int ret = read_latest_epoch(info, y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWPeriod::set_latest_epoch(epoch_t epoch, bool exclusive,
+int RGWPeriod::set_latest_epoch(optional_yield y,
+ epoch_t epoch, bool exclusive,
RGWObjVersionTracker *objv)
{
string oid = get_period_oid_prefix() + get_latest_epoch_oid();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
return sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
}
-int RGWPeriod::update_latest_epoch(epoch_t epoch)
+int RGWPeriod::update_latest_epoch(epoch_t epoch, optional_yield y)
{
static constexpr int MAX_RETRIES = 20;
bool exclusive = false;
// read existing epoch
- int r = read_latest_epoch(info, &objv);
+ int r = read_latest_epoch(info, y, &objv);
if (r == -ENOENT) {
// use an exclusive create to set the epoch atomically
exclusive = true;
<< " -> " << epoch << " on period=" << id << dendl;
}
- r = set_latest_epoch(epoch, exclusive, &objv);
+ r = set_latest_epoch(y, epoch, exclusive, &objv);
if (r == -EEXIST) {
continue; // exclusive create raced with another update, retry
} else if (r == -ECANCELED) {
return -ECANCELED; // fail after max retries
}
-int RGWPeriod::delete_obj()
+int RGWPeriod::delete_obj(optional_yield y)
{
rgw_pool pool(get_pool(cct));
rgw_raw_obj oid{pool, p.get_period_oid()};
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, oid);
- int ret = sysobj.wop().remove(null_yield);
+ int ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: failed to delete period object " << oid
<< ": " << cpp_strerror(-ret) << dendl;
rgw_raw_obj oid{pool, get_period_oid_prefix() + get_latest_epoch_oid()};
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, oid);
- int ret = sysobj.wop().remove(null_yield);
+ int ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: failed to delete period object " << oid
<< ": " << cpp_strerror(-ret) << dendl;
return ret;
}
-int RGWPeriod::read_info()
+int RGWPeriod::read_info(optional_yield y)
{
rgw_pool pool(get_pool(cct));
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_period_oid()});
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0) {
ldout(cct, 0) << "failed reading obj info from " << pool << ":" << get_period_oid() << ": " << cpp_strerror(-ret) << dendl;
return ret;
return 0;
}
-int RGWPeriod::create(bool exclusive)
+int RGWPeriod::create(optional_yield y, bool exclusive)
{
int ret;
epoch = FIRST_EPOCH;
period_map.id = id;
-
- ret = store_info(exclusive);
+
+ ret = store_info(exclusive, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: storing info for " << id << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = set_latest_epoch(epoch);
+ ret = set_latest_epoch(y, epoch);
if (ret < 0) {
ldout(cct, 0) << "ERROR: setting latest epoch " << id << ": " << cpp_strerror(-ret) << dendl;
}
return ret;
}
-int RGWPeriod::store_info(bool exclusive)
+int RGWPeriod::store_info(bool exclusive, optional_yield y)
{
rgw_pool pool(get_pool(cct));
auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
return sysobj.wop()
.set_exclusive(exclusive)
- .write(bl, null_yield);
+ .write(bl, y);
}
rgw_pool RGWPeriod::get_pool(CephContext *cct) const
return rgw_pool(cct->_conf->rgw_period_root_pool);
}
-int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup)
+int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup, optional_yield y)
{
if (zonegroup.realm_id != realm_id) {
return 0;
return ret;
}
- return store_info(false);
+ return store_info(false, y);
}
-int RGWPeriod::update()
+int RGWPeriod::update(optional_yield y)
{
auto zone_svc = sysobj_svc->get_zone_svc();
ldout(cct, 20) << __func__ << " realm " << realm_id << " period " << get_id() << dendl;
for (auto& iter : zonegroups) {
RGWZoneGroup zg(string(), iter);
- ret = zg.init(cct, sysobj_svc);
+ ret = zg.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: zg.init() failed: " << cpp_strerror(-ret) << dendl;
continue;
}
}
- ret = period_config.read(sysobj_svc, realm_id);
+ ret = period_config.read(sysobj_svc, realm_id, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "ERROR: failed to read period config: "
<< cpp_strerror(ret) << dendl;
return 0;
}
-int RGWPeriod::reflect()
+int RGWPeriod::reflect(optional_yield y)
{
for (auto& iter : period_map.zonegroups) {
RGWZoneGroup& zg = iter.second;
zg.reinit_instance(cct, sysobj_svc);
- int r = zg.write(false);
+ int r = zg.write(false, y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to store zonegroup info for zonegroup=" << iter.first << ": " << cpp_strerror(-r) << dendl;
return r;
}
if (zg.is_master_zonegroup()) {
// set master as default if no default exists
- r = zg.set_as_default(true);
+ r = zg.set_as_default(y, true);
if (r == 0) {
ldout(cct, 1) << "Set the period's master zonegroup " << zg.get_id()
<< " as the default" << dendl;
}
}
- int r = period_config.write(sysobj_svc, realm_id);
+ int r = period_config.write(sysobj_svc, realm_id, y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to store period config: "
<< cpp_strerror(-r) << dendl;
int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
RGWRealm& realm, const RGWPeriod& current_period,
- std::ostream& error_stream, bool force_if_stale)
+ std::ostream& error_stream, optional_yield y,
+ bool force_if_stale)
{
auto zone_svc = sysobj_svc->get_zone_svc();
ldout(cct, 20) << __func__ << " realm " << realm.get_id() << " period " << current_period.get_id() << dendl;
return r;
}
// create an object with a new period id
- r = create(true);
+ r = create(y, true);
if (r < 0) {
ldout(cct, 0) << "failed to create new period: " << cpp_strerror(-r) << dendl;
return r;
}
// set as current period
- r = realm.set_current_period(*this);
+ r = realm.set_current_period(*this, y);
if (r < 0) {
ldout(cct, 0) << "failed to update realm's current period: "
<< cpp_strerror(-r) << dendl;
}
ldout(cct, 4) << "Promoted to master zone and committed new period "
<< id << dendl;
- realm.notify_new_period(*this);
+ realm.notify_new_period(*this, y);
return 0;
}
// period must be based on current epoch
set_predecessor(current_period.get_predecessor());
realm_epoch = current_period.get_realm_epoch();
// write the period to rados
- int r = store_info(false);
+ int r = store_info(false, y);
if (r < 0) {
ldout(cct, 0) << "failed to store period: " << cpp_strerror(-r) << dendl;
return r;
}
// set as latest epoch
- r = update_latest_epoch(epoch);
+ r = update_latest_epoch(epoch, y);
if (r == -EEXIST) {
// already have this epoch (or a more recent one)
return 0;
ldout(cct, 0) << "failed to set latest epoch: " << cpp_strerror(-r) << dendl;
return r;
}
- r = reflect();
+ r = reflect(y);
if (r < 0) {
ldout(cct, 0) << "failed to update local objects: " << cpp_strerror(-r) << dendl;
return r;
}
ldout(cct, 4) << "Committed new epoch " << epoch
<< " for period " << id << dendl;
- realm.notify_new_period(*this);
+ realm.notify_new_period(*this, y);
return 0;
}
-int RGWZoneParams::create_default(bool old_format)
+int RGWZoneParams::create_default(optional_yield y, bool old_format)
{
name = default_zone_name;
- int r = create();
+ int r = create(y);
if (r < 0) {
return r;
}
}
+namespace {
int get_zones_pool_set(CephContext* cct,
RGWSI_SysObj* sysobj_svc,
const list<string>& zones,
const string& my_zone_id,
- set<rgw_pool>& pool_names)
+ set<rgw_pool>& pool_names,
+ optional_yield y)
{
for(auto const& iter : zones) {
RGWZoneParams zone(iter);
- int r = zone.init(cct, sysobj_svc);
+ int r = zone.init(cct, sysobj_svc, y);
if (r < 0) {
ldout(cct, 0) << "Error: init zone " << iter << ":" << cpp_strerror(-r) << dendl;
return r;
}
}
}
+}
-int RGWZoneParams::fix_pool_names()
+int RGWZoneParams::fix_pool_names(optional_yield y)
{
list<string> zones;
}
set<rgw_pool> pools;
- r = get_zones_pool_set(cct, sysobj_svc, zones, id, pools);
+ r = get_zones_pool_set(cct, sysobj_svc, zones, id, pools, y);
if (r < 0) {
ldout(cct, 0) << "Error: get_zones_pool_names" << r << dendl;
return r;
return 0;
}
-int RGWZoneParams::create(bool exclusive)
+int RGWZoneParams::create(optional_yield y, bool exclusive)
{
/* check for old pools config */
rgw_raw_obj obj(domain_root, avail_pools);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = sysobj_svc->get_obj(obj_ctx, obj);
- int r = sysobj.rop().stat(null_yield);
+ int r = sysobj.rop().stat(y);
if (r < 0) {
ldout(cct, 10) << "couldn't find old data placement pools config, setting up new ones for the zone" << dendl;
/* a new system, let's set new placement info */
placement_pools["default-placement"] = default_placement;
}
- r = fix_pool_names();
+ r = fix_pool_names(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: fix_pool_names returned r=" << r << dendl;
return r;
}
- r = RGWSystemMetaObj::create(exclusive);
+ r = RGWSystemMetaObj::create(y, exclusive);
if (r < 0) {
return r;
}
// try to set as default. may race with another create, so pass exclusive=true
// so we don't override an existing default
- r = set_as_default(true);
+ r = set_as_default(y, true);
if (r < 0 && r != -EEXIST) {
ldout(cct, 10) << "WARNING: failed to set zone as default, r=" << r << dendl;
}
return cct->_conf->rgw_zone;
}
-int RGWZoneParams::init(CephContext *cct, RGWSI_SysObj *sysobj_svc, bool setup_obj, bool old_format)
+int RGWZoneParams::init(CephContext *cct, RGWSI_SysObj *sysobj_svc,
+ optional_yield y, bool setup_obj, bool old_format)
{
if (name.empty()) {
name = cct->_conf->rgw_zone;
}
- return RGWSystemMetaObj::init(cct, sysobj_svc, setup_obj, old_format);
+ return RGWSystemMetaObj::init(cct, sysobj_svc, y, setup_obj, old_format);
}
-int RGWZoneParams::read_default_id(string& default_id, bool old_format)
+int RGWZoneParams::read_default_id(string& default_id, optional_yield y,
+ bool old_format)
{
if (realm_id.empty()) {
/* try using default realm */
RGWRealm realm;
- int ret = realm.init(cct, sysobj_svc);
+ int ret = realm.init(cct, sysobj_svc, y);
//no default realm exist
if (ret < 0) {
- return read_id(default_zone_name, default_id);
+ return read_id(default_zone_name, default_id, y);
}
realm_id = realm.get_id();
}
- return RGWSystemMetaObj::read_default_id(default_id, old_format);
+ return RGWSystemMetaObj::read_default_id(default_id, y, old_format);
}
-int RGWZoneParams::set_as_default(bool exclusive)
+int RGWZoneParams::set_as_default(optional_yield y, bool exclusive)
{
if (realm_id.empty()) {
/* try using default realm */
RGWRealm realm;
- int ret = realm.init(cct, sysobj_svc);
+ int ret = realm.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl;
return -EINVAL;
realm_id = realm.get_id();
}
- return RGWSystemMetaObj::set_as_default(exclusive);
+ return RGWSystemMetaObj::set_as_default(y, exclusive);
}
const string& RGWZoneParams::get_compression_type(const rgw_placement_rule& placement_rule) const
return i->second;
}
-int RGWZoneGroupMap::read(CephContext *cct, RGWSI_SysObj *sysobj_svc)
+int RGWZoneGroupMap::read(CephContext *cct, RGWSI_SysObj *sysobj_svc, optional_yield y)
{
RGWPeriod period;
- int ret = period.init(cct, sysobj_svc);
+ int ret = period.init(cct, sysobj_svc, y);
if (ret < 0) {
cerr << "failed to read current period info: " << cpp_strerror(ret);
return ret;
}
-
+
bucket_quota = period.get_config().bucket_quota;
user_quota = period.get_config().user_quota;
zonegroups = period.get_map().zonegroups;
RGWSI_SysObj *sysobj_svc{nullptr};
RGWSI_Zone *zone_svc{nullptr};
- int store_name(bool exclusive);
- int store_info(bool exclusive);
- int read_info(const std::string& obj_id, bool old_format = false);
- int read_id(const std::string& obj_name, std::string& obj_id);
+ int store_name(bool exclusive, optional_yield y);
+ int store_info(bool exclusive, optional_yield y);
+ int read_info(const std::string& obj_id, optional_yield y, bool old_format = false);
+ int read_id(const std::string& obj_name, std::string& obj_id, optional_yield y);
int read_default(RGWDefaultSystemMetaObjInfo& default_info,
- const std::string& oid);
+ const std::string& oid,
+ optional_yield y);
/* read and use default id */
- int use_default(bool old_format = false);
+ int use_default(optional_yield y, bool old_format = false);
public:
RGWSystemMetaObj() {}
}
void reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_svc);
- int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true, bool old_format = false);
- virtual int read_default_id(std::string& default_id, bool old_format = false);
- virtual int set_as_default(bool exclusive = false);
+ int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+ optional_yield y,
+ bool setup_obj = true, bool old_format = false);
+ virtual int read_default_id(std::string& default_id, optional_yield y,
+ bool old_format = false);
+ virtual int set_as_default(optional_yield y, bool exclusive = false);
int delete_default();
- virtual int create(bool exclusive = true);
- int delete_obj(bool old_format = false);
- int rename(const std::string& new_name);
- int update() { return store_info(false);}
- int update_name() { return store_name(false);}
- int read();
- int write(bool exclusive);
+ virtual int create(optional_yield y, bool exclusive = true);
+ int delete_obj(optional_yield y, bool old_format = false);
+ int rename(const std::string& new_name, optional_yield y);
+ int update(optional_yield y) { return store_info(false, y);}
+ int update_name(optional_yield y) { return store_name(false, y);}
+ int read(optional_yield y);
+ int write(bool exclusive, optional_yield y);
virtual rgw_pool get_pool(CephContext *cct) const = 0;
virtual const std::string get_default_oid(bool old_format = false) const = 0;
const std::string& get_info_oid_prefix(bool old_format = false) const override;
const std::string& get_predefined_name(CephContext *cct) const override;
- int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true,
- bool old_format = false);
+ int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y,
+ bool setup_obj = true, bool old_format = false);
using RGWSystemMetaObj::init;
- int read_default_id(std::string& default_id, bool old_format = false) override;
- int set_as_default(bool exclusive = false) override;
- int create_default(bool old_format = false);
- int create(bool exclusive = true) override;
- int fix_pool_names();
+ int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override;
+ int set_as_default(optional_yield y, bool exclusive = false) override;
+ int create_default(optional_yield y, bool old_format = false);
+ int create(optional_yield y, bool exclusive = true) override;
+ int fix_pool_names(optional_yield y);
const string& get_compression_type(const rgw_placement_rule& placement_rule) const;
realm_id(_realm_id) {}
bool is_master_zonegroup() const { return is_master;}
- void update_master(bool _is_master) {
+ void update_master(bool _is_master, optional_yield y) {
is_master = _is_master;
- post_process_params();
+ post_process_params(y);
}
- void post_process_params();
+ void post_process_params(optional_yield y);
void encode(bufferlist& bl) const override {
ENCODE_START(5, 1, bl);
DECODE_FINISH(bl);
}
- int read_default_id(std::string& default_id, bool old_format = false) override;
- int set_as_default(bool exclusive = false) override;
- int create_default(bool old_format = false);
+ int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override;
+ int set_as_default(optional_yield y, bool exclusive = false) override;
+ int create_default(optional_yield y, bool old_format = false);
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,
- 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);
+ std::optional<int> bucket_index_max_shards, RGWSyncModulesManager *sync_mgr,
+ optional_yield y);
+ int remove_zone(const std::string& zone_id, optional_yield y);
+ int rename_zone(const RGWZoneParams& zone_params, optional_yield y);
rgw_pool get_pool(CephContext *cct) const override;
const std::string get_default_oid(bool old_region_format = false) const override;
const std::string& get_info_oid_prefix(bool old_region_format = false) const override;
// the period config must be stored in a local object outside of the period,
// so that it can be used in a default configuration where no realm/period
// exists
- int read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id);
- int write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id);
+ int read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id, optional_yield y);
+ int write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id, optional_yield y);
static std::string get_oid(const std::string& realm_id);
static rgw_pool get_pool(CephContext *cct);
RGWQuotaInfo user_quota;
/* construct the map */
- int read(CephContext *cct, RGWSI_SysObj *sysobj_svc);
+ int read(CephContext *cct, RGWSI_SysObj *sysobj_svc, optional_yield y);
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator& bl);
std::string current_period;
epoch_t epoch{0}; //< realm epoch, incremented for each new period
- int create_control(bool exclusive);
- int delete_control();
+ int create_control(bool exclusive, optional_yield y);
+ int delete_control(optional_yield y);
public:
RGWRealm() {}
RGWRealm(const std::string& _id, const std::string& _name = "") : RGWSystemMetaObj(_id, _name) {}
DECODE_FINISH(bl);
}
- int create(bool exclusive = true) override;
- int delete_obj();
+ int create(optional_yield y, bool exclusive = true) override;
+ int delete_obj(optional_yield y);
rgw_pool get_pool(CephContext *cct) const override;
const std::string get_default_oid(bool old_format = false) const override;
const std::string& get_names_oid_prefix() const override;
const std::string& get_current_period() const {
return current_period;
}
- int set_current_period(RGWPeriod& period);
+ int set_current_period(RGWPeriod& period, optional_yield y);
void clear_current_period_and_epoch() {
current_period.clear();
epoch = 0;
std::string get_control_oid() const;
/// send a notify on the realm control object
- int notify_zone(bufferlist& bl);
+ int notify_zone(bufferlist& bl, optional_yield y);
/// notify the zone of a new period
- int notify_new_period(const RGWPeriod& period);
+ int notify_new_period(const RGWPeriod& period, optional_yield y);
};
WRITE_CLASS_ENCODER(RGWRealm)
CephContext *cct{nullptr};
RGWSI_SysObj *sysobj_svc{nullptr};
- int read_info();
+ int read_info(optional_yield y);
int read_latest_epoch(RGWPeriodLatestEpochInfo& epoch_info,
+ optional_yield y,
RGWObjVersionTracker *objv = nullptr);
- int use_latest_epoch();
+ int use_latest_epoch(optional_yield y);
int use_current_period();
const std::string get_period_oid() const;
realm_id = _realm_id;
}
- int reflect();
+ int reflect(optional_yield y);
int get_zonegroup(RGWZoneGroup& zonegroup,
const std::string& zonegroup_id) const;
return false;
}
- int get_latest_epoch(epoch_t& epoch);
- int set_latest_epoch(epoch_t epoch, bool exclusive = false,
+ int get_latest_epoch(epoch_t& epoch, optional_yield y);
+ int set_latest_epoch(optional_yield y,
+ epoch_t epoch, bool exclusive = false,
RGWObjVersionTracker *objv = nullptr);
// update latest_epoch if the given epoch is higher, else return -EEXIST
- int update_latest_epoch(epoch_t epoch);
+ int update_latest_epoch(epoch_t epoch, optional_yield y);
- int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const std::string &period_realm_id, const std::string &period_realm_name = "",
- bool setup_obj = true);
- int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true);
+ int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const std::string &period_realm_id, optional_yield y,
+ const std::string &period_realm_name = "", bool setup_obj = true);
+ int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y, bool setup_obj = true);
- int create(bool exclusive = true);
- int delete_obj();
- int store_info(bool exclusive);
- int add_zonegroup(const RGWZoneGroup& zonegroup);
+ int create(optional_yield y, bool exclusive = true);
+ int delete_obj(optional_yield y);
+ int store_info(bool exclusive, optional_yield y);
+ int add_zonegroup(const RGWZoneGroup& zonegroup, optional_yield y);
void fork();
- int update();
+ int update(optional_yield y);
// commit a staging period; only for use on master zone
int commit(rgw::sal::RGWRadosStore *store,
RGWRealm& realm, const RGWPeriod ¤t_period,
- std::ostream& error_stream, bool force_if_stale = false);
+ std::ostream& error_stream, optional_yield y,
+ bool force_if_stale = false);
void encode(bufferlist& bl) const {
ENCODE_START(1, 1, bl);
// traverse all the way back to the beginning of the period history, and
// return a cursor to the first period in a fully attached history
-Cursor RGWSI_MDLog::find_oldest_period()
+Cursor RGWSI_MDLog::find_oldest_period(optional_yield y)
{
auto cursor = period_history->get_current();
}
// pull the predecessor and add it to our history
RGWPeriod period;
- int r = period_puller->pull(predecessor, period);
+ int r = period_puller->pull(predecessor, period, y);
if (r < 0) {
return cursor;
}
if (ret == -ENOENT) {
// initialize the mdlog history and write it
ldout(cct, 10) << "initializing mdlog history" << dendl;
- auto cursor = find_oldest_period();
+ auto cursor = find_oldest_period(y);
if (!cursor) {
return cursor;
}
if (cursor) {
return cursor;
} else {
- cursor = find_oldest_period();
+ cursor = find_oldest_period(y);
state.oldest_realm_epoch = cursor.get_epoch();
state.oldest_period_id = cursor.get_period().get_id();
ldout(cct, 10) << "rewriting mdlog history" << dendl;
// pull the oldest period by id
RGWPeriod period;
- ret = period_puller->pull(state.oldest_period_id, period);
+ ret = period_puller->pull(state.oldest_period_id, period, y);
if (ret < 0) {
ldout(cct, 1) << "failed to read period id=" << state.oldest_period_id
<< " for mdlog history: " << cpp_strerror(ret) << dendl;
return Cursor{-EINVAL};
}
// attach the period to our history
- return period_history->attach(std::move(period));
+ return period_history->attach(std::move(period), y);
}
Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y) const
return current_log->get_shard_id(hash_key, shard_id);
}
-int RGWSI_MDLog::pull_period(const std::string& period_id, RGWPeriod& period)
+int RGWSI_MDLog::pull_period(const std::string& period_id, RGWPeriod& period,
+ optional_yield y)
{
- return period_puller->pull(period_id, period);
+ return period_puller->pull(period_id, period, y);
}
// traverse all the way back to the beginning of the period history, and
// return a cursor to the first period in a fully attached history
- RGWPeriodHistory::Cursor find_oldest_period();
+ RGWPeriodHistory::Cursor find_oldest_period(optional_yield y);
/// initialize the oldest log period if it doesn't exist, and attach it to
/// our current history
return period_history.get();
}
- int pull_period(const std::string& period_id, RGWPeriod& period);
+ int pull_period(const std::string& period_id, RGWPeriod& period, optional_yield y);
/// find or create the metadata log for the given period
RGWMetadataLog* get_log(const std::string& period);
return ret;
}
- ret = realm->init(cct, sysobj_svc);
+ ret = realm->init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
} else if (ret != -ENOENT) {
ldout(cct, 20) << "realm " << realm->get_name() << " " << realm->get_id() << dendl;
- ret = current_period->init(cct, sysobj_svc, realm->get_id(), realm->get_name());
+ ret = current_period->init(cct, sysobj_svc, realm->get_id(), y,
+ realm->get_name());
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl;
return ret;
bool zg_initialized = false;
if (!current_period->get_id().empty()) {
- ret = init_zg_from_period(&zg_initialized);
+ ret = init_zg_from_period(&zg_initialized, y);
if (ret < 0) {
return ret;
}
bool using_local = (!zg_initialized);
if (using_local) {
ldout(cct, 10) << " cannot find current period zonegroup using local zonegroup" << dendl;
- ret = init_zg_from_local(&creating_defaults);
+ ret = init_zg_from_local(&creating_defaults, y);
if (ret < 0) {
return ret;
}
// read period_config into current_period
auto& period_config = current_period->get_config();
- ret = period_config.read(sysobj_svc, zonegroup->realm_id);
+ ret = period_config.read(sysobj_svc, zonegroup->realm_id, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "ERROR: failed to read period config: "
<< cpp_strerror(ret) << dendl;
zone_params->set_name(default_zone_name);
}
- ret = zone_params->init(cct, sysobj_svc);
+ ret = zone_params->init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
lderr(cct) << "failed reading zone info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
return -EINVAL;
}
ldout(cct, 1) << "Cannot find zone id=" << zone_params->get_id() << " (name=" << zone_params->get_name() << "), switching to local zonegroup configuration" << dendl;
- ret = init_zg_from_local(&creating_defaults);
+ ret = init_zg_from_local(&creating_defaults, y);
if (ret < 0) {
return ret;
}
}
-int RGWSI_Zone::list_periods(const string& current_period, list<string>& periods)
+int RGWSI_Zone::list_periods(const string& current_period, list<string>& periods, optional_yield y)
{
int ret = 0;
string period_id = current_period;
while(!period_id.empty()) {
RGWPeriod period(period_id);
- ret = period.init(cct, sysobj_svc);
+ ret = period.init(cct, sysobj_svc, y);
if (ret < 0) {
return ret;
}
periods.push_back(period.get_id());
period_id = period.get_predecessor();
}
-
+
return ret;
}
}
string default_region;
- ret = default_zonegroup.init(cct, sysobj_svc, false, true);
+ ret = default_zonegroup.init(cct, sysobj_svc, y, false, true);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed init default region: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
- }
- ret = default_zonegroup.read_default_id(default_region, true);
+ }
+ ret = default_zonegroup.read_default_id(default_region, y, true);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << " failed reading old default region: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
return ret;
} else if (ret == -ENOENT || regions.empty()) {
RGWZoneParams zoneparams(default_zone_name);
- int ret = zoneparams.init(cct, sysobj_svc);
+ int ret = zoneparams.init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << ": error initializing default zone params: " << cpp_strerror(-ret) << dendl;
return ret;
}
/* update master zone */
RGWZoneGroup default_zg(default_zonegroup_name);
- ret = default_zg.init(cct, sysobj_svc);
+ ret = default_zg.init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << ": error in initializing default zonegroup: " << cpp_strerror(-ret) << dendl;
return ret;
}
if (ret != -ENOENT && default_zg.master_zone.empty()) {
default_zg.master_zone = zoneparams.get_id();
- return default_zg.update();
+ return default_zg.update(y);
}
return 0;
}
for (list<string>::iterator iter = regions.begin(); iter != regions.end(); ++iter) {
if (*iter != default_zonegroup_name){
RGWZoneGroup region(*iter);
- int ret = region.init(cct, sysobj_svc, true, true);
+ int ret = region.init(cct, sysobj_svc, y, true, true);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed init region "<< *iter << ": " << cpp_strerror(-ret) << dendl;
return ret;
buf_to_hex(md5, CEPH_CRYPTO_MD5_DIGESTSIZE, md5_str);
string new_realm_id(md5_str);
RGWRealm new_realm(new_realm_id,new_realm_name);
- ret = new_realm.init(cct, sysobj_svc, false);
+ ret = new_realm.init(cct, sysobj_svc, y, false);
if (ret < 0) {
ldout(cct, 0) << __func__ << " Error initing new realm: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = new_realm.create();
+ ret = new_realm.create(y);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << __func__ << " Error creating new realm: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = new_realm.set_as_default();
+ ret = new_realm.set_as_default(y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " Error setting realm as default: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = realm->init(cct, sysobj_svc);
+ ret = realm->init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " Error initing realm: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = current_period->init(cct, sysobj_svc, realm->get_id(), realm->get_name());
+ ret = current_period->init(cct, sysobj_svc, realm->get_id(), y,
+ realm->get_name());
if (ret < 0) {
ldout(cct, 0) << __func__ << " Error initing current period: " << cpp_strerror(-ret) << dendl;
return ret;
ldout(cct, 0) << __func__ << " Converting " << *iter << dendl;
/* check to see if we don't have already a zonegroup with this name */
RGWZoneGroup new_zonegroup(*iter);
- ret = new_zonegroup.init(cct , sysobj_svc);
+ ret = new_zonegroup.init(cct , sysobj_svc, y);
if (ret == 0 && new_zonegroup.get_id() != *iter) {
ldout(cct, 0) << __func__ << " zonegroup "<< *iter << " already exists id " << new_zonegroup.get_id () <<
" skipping conversion " << dendl;
}
RGWZoneGroup zonegroup(*iter);
zonegroup.set_id(*iter);
- int ret = zonegroup.init(cct, sysobj_svc, true, true);
+ int ret = zonegroup.init(cct, sysobj_svc, y, true, true);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed init zonegroup: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
ldout(cct, 0) << __func__ << " Setting default zone as master for default region" << dendl;
zonegroup.master_zone = default_zone_name;
}
- ret = zonegroup.update();
+ ret = zonegroup.update(y);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << __func__ << " failed to update zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return ret;
}
- ret = zonegroup.update_name();
+ ret = zonegroup.update_name(y);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << __func__ << " failed to update_name for zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return ret;
}
if (zonegroup.get_name() == default_region) {
- ret = zonegroup.set_as_default();
+ ret = zonegroup.set_as_default(y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed to set_as_default " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
RGWZoneParams zoneparams(iter->first, iter->second.name);
zoneparams.set_id(iter->first.id);
zoneparams.realm_id = realm->get_id();
- ret = zoneparams.init(cct, sysobj_svc);
+ ret = zoneparams.init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << " failed to init zoneparams " << iter->first << ": " << cpp_strerror(-ret) << dendl;
return ret;
continue;
}
zonegroup.realm_id = realm->get_id();
- ret = zoneparams.update();
+ ret = zoneparams.update(y);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << __func__ << " failed to update zoneparams " << iter->first << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = zoneparams.update_name();
+ ret = zoneparams.update_name(y);
if (ret < 0 && ret != -EEXIST) {
ldout(cct, 0) << __func__ << " failed to init zoneparams " << iter->first << ": " << cpp_strerror(-ret) << dendl;
return ret;
}
if (!current_period->get_id().empty()) {
- ret = current_period->add_zonegroup(zonegroup);
+ ret = current_period->add_zonegroup(zonegroup, y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed to add zonegroup to current_period: " << cpp_strerror(-ret) << dendl;
return ret;
}
if (!current_period->get_id().empty()) {
- ret = current_period->update();
+ ret = current_period->update(y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed to update new period: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = current_period->store_info(false);
+ ret = current_period->store_info(false, y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed to store new period: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = current_period->reflect();
+ ret = current_period->reflect(y);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed to update local objects: " << cpp_strerror(-ret) << dendl;
return ret;
for (auto const& iter : regions) {
RGWZoneGroup zonegroup(iter);
- int ret = zonegroup.init(cct, sysobj_svc, true, true);
+ int ret = zonegroup.init(cct, sysobj_svc, y, true, true);
if (ret < 0) {
ldout(cct, 0) << __func__ << " failed init zonegroup" << iter << ": ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = zonegroup.delete_obj(true);
+ ret = zonegroup.delete_obj(y, true);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << " failed to delete region " << iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
if (iterZoneGroup != zonegroup_conn_map.end()) {
delete iterZoneGroup->second;
}
-
+
// Add new connection to connections map
zonegroup_conn_map[zonegroup.get_id()] = new_connection;
}
-int RGWSI_Zone::init_zg_from_period(bool *initialized)
+int RGWSI_Zone::init_zg_from_period(bool *initialized, optional_yield y)
{
*initialized = false;
return 0;
}
- int ret = zonegroup->init(cct, sysobj_svc);
+ int ret = zonegroup->init(cct, sysobj_svc, y);
ldout(cct, 20) << "period zonegroup init ret " << ret << dendl;
if (ret == -ENOENT) {
return 0;
if (iter != current_period->get_map().zonegroups.end()) {
ldout(cct, 20) << "using current period zonegroup " << zonegroup->get_name() << dendl;
*zonegroup = iter->second;
- ret = zonegroup->init(cct, sysobj_svc, false);
+ ret = zonegroup->init(cct, sysobj_svc, y, false);
if (ret < 0) {
ldout(cct, 0) << "failed init zonegroup: " << " " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = zone_params->init(cct, sysobj_svc);
+ ret = zone_params->init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "failed reading zone params info: " << " " << cpp_strerror(-ret) << dendl;
return ret;
} if (ret ==-ENOENT && zonegroup->get_name() == default_zonegroup_name) {
ldout(cct, 10) << " Using default name "<< default_zone_name << dendl;
zone_params->set_name(default_zone_name);
- ret = zone_params->init(cct, sysobj_svc);
+ ret = zone_params->init(cct, sysobj_svc, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "failed reading zone params info: " << " " << cpp_strerror(-ret) << dendl;
return ret;
master->second.name << " id:" << master->second.id << " as master" << dendl;
if (zonegroup->get_id() == zg.get_id()) {
zonegroup->master_zone = master->second.id;
- ret = zonegroup->update();
+ ret = zonegroup->update(y);
if (ret < 0) {
ldout(cct, 0) << "error updating zonegroup : " << cpp_strerror(-ret) << dendl;
return ret;
}
} else {
RGWZoneGroup fixed_zg(zg.get_id(),zg.get_name());
- ret = fixed_zg.init(cct, sysobj_svc);
+ ret = fixed_zg.init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
return ret;
}
fixed_zg.master_zone = master->second.id;
- ret = fixed_zg.update();
+ ret = fixed_zg.update(y);
if (ret < 0) {
ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
return ret;
return 0;
}
-int RGWSI_Zone::init_zg_from_local(bool *creating_defaults)
+int RGWSI_Zone::init_zg_from_local(bool *creating_defaults, optional_yield y)
{
- int ret = zonegroup->init(cct, sysobj_svc);
+ int ret = zonegroup->init(cct, sysobj_svc, y);
if ( (ret < 0 && ret != -ENOENT) || (ret == -ENOENT && !cct->_conf->rgw_zonegroup.empty())) {
ldout(cct, 0) << "failed reading zonegroup info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
} else if (ret == -ENOENT) {
*creating_defaults = true;
ldout(cct, 10) << "Creating default zonegroup " << dendl;
- ret = zonegroup->create_default();
+ ret = zonegroup->create_default(y);
if (ret < 0) {
ldout(cct, 0) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return ret;
}
- ret = zonegroup->init(cct, sysobj_svc);
+ ret = zonegroup->init(cct, sysobj_svc, y);
if (ret < 0) {
ldout(cct, 0) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
ldout(cct, 0) << "zonegroup " << zonegroup->get_name() << " missing master_zone, setting zone " <<
master->second.name << " id:" << master->second.id << " as master" << dendl;
zonegroup->master_zone = master->second.id;
- ret = zonegroup->update();
+ ret = zonegroup->update(y);
if (ret < 0) {
ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
return ret;
for (map<string, RGWZoneGroup>::iterator iter = zonegroupmap.zonegroups.begin();
iter != zonegroupmap.zonegroups.end(); ++iter) {
RGWZoneGroup& zonegroup = iter->second;
- ret = zonegroup.init(cct, sysobj_svc, false);
- ret = zonegroup.update();
+ ret = zonegroup.init(cct, sysobj_svc, y, false);
+ ret = zonegroup.update(y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "Error could not update zonegroup " << zonegroup.get_name() << ": " <<
cpp_strerror(-ret) << dendl;
return ret;
} else if (ret == -ENOENT) {
- ret = zonegroup.create();
+ ret = zonegroup.create(y);
if (ret < 0) {
ldout(cct, 0) << "Error could not create " << zonegroup.get_name() << ": " <<
cpp_strerror(-ret) << dendl;
void shutdown() override;
int replace_region_with_zonegroup(optional_yield y);
- int init_zg_from_period(bool *initialized);
- int init_zg_from_local(bool *creating_defaults);
+ int init_zg_from_period(bool *initialized, optional_yield y);
+ int init_zg_from_local(bool *creating_defaults, optional_yield y);
int convert_regionmap(optional_yield y);
int update_placement_map(optional_yield y);
int list_zones(list<string>& zones);
int list_realms(list<string>& realms);
int list_periods(list<string>& periods);
- int list_periods(const string& current_period, list<string>& periods);
+ int list_periods(const string& current_period, list<string>& periods, optional_yield y);
};
// mock puller that throws an exception if it's called
struct ErrorPuller : public RGWPeriodHistory::Puller {
- int pull(const std::string& id, RGWPeriod& period) override {
+ int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
throw std::runtime_error("unexpected call to pull");
}
};
public:
explicit RecordingPuller(int error) : error(error) {}
Ids ids;
- int pull(const std::string& id, RGWPeriod& period) override {
+ int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
ids.push_back(id);
return error;
}
// mock puller that returns a fake period by parsing the period id
struct NumericPuller : public RGWPeriodHistory::Puller {
- int pull(const std::string& id, RGWPeriod& period) override {
+ int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
// relies on numeric period ids to divine the realm_epoch
auto realm_epoch = boost::lexical_cast<epoch_t>(id);
auto predecessor = boost::lexical_cast<std::string>(realm_epoch-1);
// create a disjoint history at 1 and verify that periods are requested
// backwards from current_period
- auto c1 = history.attach(make_period("1", 1, ""));
+ auto c1 = history.attach(make_period("1", 1, ""), null_yield);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids{"4"}, puller.ids);
auto c4 = history.insert(make_period("4", 4, "3"));
ASSERT_TRUE(c4);
- c1 = history.attach(make_period("1", 1, ""));
+ c1 = history.attach(make_period("1", 1, ""), null_yield);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids({"4", "3"}), puller.ids);
auto c3 = history.insert(make_period("3", 3, "2"));
ASSERT_TRUE(c3);
- c1 = history.attach(make_period("1", 1, ""));
+ c1 = history.attach(make_period("1", 1, ""), null_yield);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
auto c2 = history.insert(make_period("2", 2, "1"));
ASSERT_TRUE(c2);
- c1 = history.attach(make_period("1", 1, ""));
+ c1 = history.attach(make_period("1", 1, ""), null_yield);
ASSERT_TRUE(c1);
ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
}
// create a disjoint history at 9 and verify that periods are requested
// backwards down to current_period
- auto c9 = history.attach(make_period("9", 9, "8"));
+ auto c9 = history.attach(make_period("9", 9, "8"), null_yield);
ASSERT_FALSE(c9);
ASSERT_EQ(-EFAULT, c9.get_error());
ASSERT_EQ(Ids{"8"}, puller.ids);
- auto c8 = history.attach(make_period("8", 8, "7"));
+ auto c8 = history.attach(make_period("8", 8, "7"), null_yield);
ASSERT_FALSE(c8);
ASSERT_EQ(-EFAULT, c8.get_error());
ASSERT_EQ(Ids({"8", "7"}), puller.ids);
- auto c7 = history.attach(make_period("7", 7, "6"));
+ auto c7 = history.attach(make_period("7", 7, "6"), null_yield);
ASSERT_FALSE(c7);
ASSERT_EQ(-EFAULT, c7.get_error());
ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
- auto c6 = history.attach(make_period("6", 6, "5"));
+ auto c6 = history.attach(make_period("6", 6, "5"), null_yield);
ASSERT_TRUE(c6);
ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
}
NumericPuller puller;
RGWPeriodHistory history(g_ceph_context, &puller, current_period);
- auto c1 = history.attach(make_period("1", 1, ""));
+ auto c1 = history.attach(make_period("1", 1, ""), null_yield);
ASSERT_TRUE(c1);
// verify that we pulled and merged all periods from 1-5
NumericPuller puller;
RGWPeriodHistory history(g_ceph_context, &puller, current_period);
- auto c9 = history.attach(make_period("9", 9, "8"));
+ auto c9 = history.attach(make_period("9", 9, "8"), null_yield);
ASSERT_TRUE(c9);
// verify that we pulled and merged all periods from 5-9