string dialect;
+ string req_id;
+
req_state(CephContext *_cct, struct RGWEnv *e);
~req_state();
};
s->obj_ctx = store->create_context(s);
store->set_intent_cb(s->obj_ctx, call_log_intent);
+ s->req_id = store->unique_id(req->id);
+
req->log(s, "initializing");
RGWOp *op = NULL;
extra_params.data = &first_chunk;
extra_params.manifest = &manifest;
+ extra_params.ptag = &s->req_id; /* use req_id as operation tag */
int r = store->put_obj_meta(s->obj_ctx, head_obj, obj_len, attrs,
RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE,
if_match,
if_nomatch,
replace_attrs,
- attrs, RGW_OBJ_CATEGORY_MAIN, &s->err);
+ attrs, RGW_OBJ_CATEGORY_MAIN,
+ &s->req_id, /* use req_id as tag */
+ &s->err);
}
int RGWGetACLs::verify_permission()
extra_params.manifest = &manifest;
extra_params.remove_objs = &remove_objs;
+ extra_params.ptag = &s->req_id; /* use req_id as operation tag */
+
ret = store->put_obj_meta(s->obj_ctx, target_obj, ofs, attrs,
RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE,
extra_params);
bool replace_attrs,
map<string, bufferlist>& attrs,
RGWObjCategory category,
+ string *ptag,
struct rgw_err *err)
{
int ret;
}
if (copy_data) { /* refcounting tail wouldn't work here, just copy the data */
- return copy_obj_data(ctx, handle, end, dest_obj, src_obj, mtime, attrset, category, err);
+ return copy_obj_data(ctx, handle, end, dest_obj, src_obj, mtime, attrset, category, ptag, err);
}
map<uint64_t, RGWObjManifestPart>::iterator miter = astate->manifest.objs.begin();
bufferlist first_chunk;
- string tag;
bool copy_itself = (dest_obj == src_obj);
RGWObjManifest *pmanifest;
ldout(cct, 0) << "dest_obj=" << dest_obj << " src_obj=" << src_obj << " copy_itself=" << (int)copy_itself << dendl;
- if (!copy_itself) {
+
+ string tag;
+
+ if (ptag)
+ tag = *ptag;
+
+ if (tag.empty()) {
append_rand_alpha(cct, tag, tag, 32);
+ }
+ if (!copy_itself) {
for (; miter != astate->manifest.objs.end(); ++miter) {
RGWObjManifestPart& part = miter->second;
ObjectWriteOperation op;
pmanifest = &manifest;
} else {
pmanifest = &astate->manifest;
- tag = astate->obj_tag.c_str();
-
/* don't send the object's tail for garbage collection */
astate->keep_tail = true;
}
time_t *mtime,
map<string, bufferlist>& attrs,
RGWObjCategory category,
+ string *ptag,
struct rgw_err *err)
{
bufferlist first_chunk;
RGWObjManifest manifest;
RGWObjManifestPart *first_part;
+ map<string, bufferlist>::iterator iter;
rgw_obj shadow_obj = dest_obj;
string shadow_oid;
ep.data = &first_chunk;
ep.manifest = &manifest;
+ ep.ptag = ptag;
ret = put_obj_meta(ctx, dest_obj, end + 1, attrs, category, PUT_OBJ_CREATE, ep);
if (mtime)
buf[len] = '\0';
tag = buf;
} else {
- append_rand_alpha(cct, tag, tag, 32);
+ if (tag.empty()) {
+ append_rand_alpha(cct, tag, tag, 32);
+ }
}
int ret = cls_obj_prepare_op(bucket, CLS_RGW_OP_ADD, tag,
obj.object, obj.key);
bool replace_attrs,
map<std::string, bufferlist>& attrs,
RGWObjCategory category,
+ string *ptag,
struct rgw_err *err);
int copy_obj_data(void *ctx,
time_t *mtime,
map<string, bufferlist>& attrs,
RGWObjCategory category,
+ string *ptag,
struct rgw_err *err);
/**
* Delete a bucket.
int bucket_rebuild_index(rgw_bucket& bucket);
int remove_objs_from_index(rgw_bucket& bucket, list<string>& oid_list);
+ string unique_id(uint64_t unique_num) {
+ char buf[32];
+ snprintf(buf, sizeof(buf), ".%llu.%llu", (unsigned long long)instance_id(), (unsigned long long)unique_num);
+ string s = zone.name + buf;
+ return s;
+ }
+
private:
int process_intent_log(rgw_bucket& bucket, string& oid,
time_t epoch, int flags, bool purge);
uint64_t instance_id();
uint64_t next_bucket_id();
-
};
class RGWStoreManager {