Rados *rados = NULL;
static string notify_oid = "notify";
+static string shadow_ns = "shadow";
class RGWWatcher : public librados::WatchCtx {
RGWRados *rados;
if (r < 0)
return r;
- if (list_ctx.objects_begin() != list_ctx.objects_end())
- return -ENOTEMPTY;
+ ObjectIterator iter = list_ctx.objects_begin();
+ string ns;
+ for (; iter != list_ctx.objects_end(); iter++) {
+ string obj = *iter;
+ if (rgw_obj::translate_raw_obj(obj, ns))
+ return -ENOTEMPTY;
+ }
r = rados->pool_delete(bucket.c_str());
if (r < 0)
} else {
RGW_LOG(0) << "cloning object " << obj << " to name=" << state->shadow_obj << dendl;
rgw_obj dest_obj(obj.bucket, state->shadow_obj);
+ dest_obj.set_ns(shadow_ns);
if (obj.key.size())
dest_obj.set_key(obj.key);
else
if (r == -ECANCELED) {
/* a race! object was replaced, we need to set attr on the original obj */
dout(0) << "RGWRados::set_attr: raced with another process, going to the shadow obj instead" << dendl;
- rgw_obj shadow(obj.bucket, state->shadow_obj, obj.key);
+ rgw_obj shadow(obj.bucket, state->shadow_obj, obj.key, shadow_ns);
r = set_attr(NULL, shadow, name, bl);
}
if (r == -ECANCELED) {
/* a race! object was replaced, we need to set attr on the original obj */
dout(0) << "RGWRados::get_obj: raced with another process, going to the shadow obj instead" << dendl;
- rgw_obj shadow(obj.bucket, astate->shadow_obj, obj.key);
+ rgw_obj shadow(obj.bucket, astate->shadow_obj, obj.key, shadow_ns);
r = get_obj(NULL, handle, shadow, data, ofs, end);
return r;
}
if (r == -ECANCELED) {
/* a race! object was replaced, we need to set attr on the original obj */
dout(0) << "RGWRados::get_obj: raced with another process, going to the shadow obj instead" << dendl;
- rgw_obj shadow(obj.bucket, astate->shadow_obj, obj.key);
+ rgw_obj shadow(obj.bucket, astate->shadow_obj, obj.key, shadow_ns);
r = read(NULL, shadow, ofs, size, bl);
}
return r;