]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't record fetch remote obj in new multisite
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 18 Mar 2016 20:55:55 +0000 (13:55 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 18 Mar 2016 20:58:06 +0000 (13:58 -0700)
No need to record the ops status in new multisite. It was used in v1
to record fetching remote objs during the operation, since these could
time out (were triggered by RESTful copy object that could take too long).
With v2 it can't time out, so no need to make it stateful.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index ee32052cadb6adc01dbb9f5df87b4f0634483b3d..4b91acf3d18312389296cdec1e72f11e964a1623 100644 (file)
@@ -460,6 +460,7 @@ int RGWAsyncFetchRemoteObj::_send_request()
                        user_id,
                        client_id,
                        op_id,
+                       false, /* don't record op state in ops log */
                        NULL, /* req_info */
                        source_zone,
                        dest_obj,
index 6d5856498d314e5cb83b19d57e46d15138465388..6af2440868ad00bb2d459dbb1d564b1280c938f1 100644 (file)
@@ -6338,6 +6338,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
                const rgw_user& user_id,
                const string& client_id,
                const string& op_id,
+               bool record_op_state,
                req_info *info,
                const string& source_zone,
                rgw_obj& dest_obj,
@@ -6411,14 +6412,20 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
 
   string obj_name = dest_obj.bucket.name + "/" + dest_obj.get_object();
 
-  RGWOpStateSingleOp opstate(this, client_id, op_id, obj_name);
+  RGWOpStateSingleOp *opstate = NULL;
 
-  ret = opstate.set_state(RGWOpState::OPSTATE_IN_PROGRESS);
-  if (ret < 0) {
-    ldout(cct, 0) << "ERROR: failed to set opstate ret=" << ret << dendl;
-    return ret;
+  if (record_op_state) {
+    opstate = new RGWOpStateSingleOp(this, client_id, op_id, obj_name);
+
+    ret = opstate->set_state(RGWOpState::OPSTATE_IN_PROGRESS);
+    if (ret < 0) {
+      ldout(cct, 0) << "ERROR: failed to set opstate ret=" << ret << dendl;
+      delete opstate;
+      return ret;
+    }
   }
-  RGWRadosPutObj cb(&processor, &opstate, progress_cb, progress_data);
+
+  RGWRadosPutObj cb(&processor, opstate, progress_cb, progress_data);
   string etag;
   map<string, string> req_headers;
   real_time set_mtime;
@@ -6547,21 +6554,27 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
     goto set_err_state;
   }
 
-  ret = opstate.set_state(RGWOpState::OPSTATE_COMPLETE);
-  if (ret < 0) {
-    ldout(cct, 0) << "ERROR: failed to set opstate ret=" << ret << dendl;
+  if (opstate) {
+    ret = opstate->set_state(RGWOpState::OPSTATE_COMPLETE);
+    if (ret < 0) {
+      ldout(cct, 0) << "ERROR: failed to set opstate ret=" << ret << dendl;
+    }
+    delete opstate;
   }
 
   return 0;
 set_err_state:
-  RGWOpState::OpState state = RGWOpState::OPSTATE_ERROR;
-  if (copy_if_newer && ret == -ERR_NOT_MODIFIED) {
-    state = RGWOpState::OPSTATE_COMPLETE;
-    ret = 0;
-  }
-  int r = opstate.set_state(state);
-  if (r < 0) {
-    ldout(cct, 0) << "ERROR: failed to set opstate r=" << ret << dendl;
+  if (opstate) {
+    RGWOpState::OpState state = RGWOpState::OPSTATE_ERROR;
+    if (copy_if_newer && ret == -ERR_NOT_MODIFIED) {
+      state = RGWOpState::OPSTATE_COMPLETE;
+      ret = 0;
+    }
+    int r = opstate->set_state(state);
+    if (r < 0) {
+      ldout(cct, 0) << "ERROR: failed to set opstate r=" << ret << dendl;
+    }
+    delete opstate;
   }
   return ret;
 }
@@ -6662,7 +6675,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
   ldout(cct, 5) << "Copy object " << src_obj.bucket << ":" << src_obj.get_object() << " => " << dest_obj.bucket << ":" << dest_obj.get_object() << dendl;
 
   if (remote_src || !source_zone.empty()) {
-    return fetch_remote_obj(obj_ctx, user_id, client_id, op_id, info, source_zone,
+    return fetch_remote_obj(obj_ctx, user_id, client_id, op_id, true, info, source_zone,
                dest_obj, src_obj, dest_bucket_info, src_bucket_info, src_mtime, mtime, mod_ptr,
                unmod_ptr, high_precision_time,
                if_match, if_nomatch, attrs_mod, copy_if_newer, attrs, category,
index 8a2db376d29bd7ce24d90314927cca1b6b3e52b2..0735ad21b3b64998d332c45df68648df85d36959 100644 (file)
@@ -2427,6 +2427,7 @@ public:
                        const rgw_user& user_id,
                        const string& client_id,
                        const string& op_id,
+                       bool record_op_state,
                        req_info *info,
                        const string& source_zone,
                        rgw_obj& dest_obj,