int rgw_remove_uid_index(RGWRados *store, rgw_user& uid)
{
- RGWObjVersionTracker objv_tracker;
- RGWUserInfo info;
- int ret = rgw_get_user_info_by_uid(store, uid, info, &objv_tracker, NULL);
- if (ret < 0)
- return ret;
-
- string oid = uid.to_str();
- ret = store->meta_mgr->remove_entry(user_meta_handler, oid, &objv_tracker);
- if (ret < 0)
- return ret;
+ return store->meta_mgr->remove_entry(user_meta_handler, uid.to_str(), nullptr);
+}
- return 0;
+int rgw_remove_user_buckets_index(RGWRados *store, rgw_user& uid)
+{
+ string buckets_obj_id;
+ rgw_get_buckets_obj(uid, buckets_obj_id);
+ rgw_raw_obj uid_bucks(store->svc.zone->get_zone_params().user_uid_pool, buckets_obj_id);
+ auto obj_ctx = store->svc.sysobj->init_obj_ctx();
+ auto sysobj = obj_ctx.get_obj(uid_bucks);
+ return sysobj.wop().remove(null_yield);
}
int rgw_remove_email_index(RGWRados *store, string& email)
return ret;
}
- string buckets_obj_id;
- rgw_get_buckets_obj(info.user_id, buckets_obj_id);
- rgw_raw_obj uid_bucks(store->svc.zone->get_zone_params().user_uid_pool, buckets_obj_id);
ldout(store->ctx(), 10) << "removing user buckets index" << dendl;
- auto obj_ctx = store->svc.sysobj->init_obj_ctx();
- auto sysobj = obj_ctx.get_obj(uid_bucks);
- ret = sysobj.wop().remove(null_yield);
+ ret = rgw_remove_user_buckets_index(store, info.user_id);
if (ret < 0 && ret != -ENOENT) {
- ldout(store->ctx(), 0) << "ERROR: could not remove " << info.user_id << ":" << uid_bucks << ", should be fixed (err=" << ret << ")" << dendl;
+ ldout(store->ctx(), 0) << "ERROR: could not remove user buckets index object for "
+ << info.user_id << ": " << ret << dendl;
return ret;
}
- string key;
- info.user_id.to_str(key);
-
- rgw_raw_obj uid_obj(store->svc.zone->get_zone_params().user_uid_pool, key);
ldout(store->ctx(), 10) << "removing user index: " << info.user_id << dendl;
- ret = store->meta_mgr->remove_entry(user_meta_handler, key, &objv_tracker);
- if (ret < 0 && ret != -ENOENT && ret != -ECANCELED) {
- ldout(store->ctx(), 0) << "ERROR: could not remove " << info.user_id << ":" << uid_obj << ", should be fixed (err=" << ret << ")" << dendl;
+ ret = rgw_remove_uid_index(store, info.user_id);
+ if (ret < 0 && ret != -ENOENT) {
+ ldout(store->ctx(), 0) << "ERROR: could not remove " << info.user_id
+ << ": " << ret << dendl;
return ret;
}
set_err_msg(err_msg, "ERROR: could not remove index for uid " + old_info.user_id.to_str());
success = false;
}
+ ret = rgw_remove_user_buckets_index(store, old_info.user_id);
+ if (ret < 0 && ret != -ENOENT) {
+ set_err_msg(err_msg, "ERROR: could not remove buckets index for uid " + old_info.user_id.to_str());
+ success = false;
+ }
}
if (!old_info.user_email.empty() &&