]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: multipart meta object uses extra data pool
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 11 Mar 2014 20:24:55 +0000 (13:24 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 24 Mar 2014 21:58:05 +0000 (14:58 -0700)
Fixes: #7676
We need the extra data pool since EC backends cannot handle the omap
operations that are needed for the multipart meta object.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_common.h
src/rgw/rgw_op.cc
src/rgw/rgw_rados.h

index 77a67155e6cbd183c223bae0fa93995ce41c92a3..788aa840fb905566b04357aa63ae7563ed887caf 100644 (file)
@@ -1016,23 +1016,25 @@ public:
   std::string ns;
   std::string object;
 
-  rgw_obj() {}
-  rgw_obj(const char *b, const char *o) {
+  bool in_extra_data; /* in-memory only member, does not serialize */
+
+  rgw_obj() : in_extra_data(false) {}
+  rgw_obj(const char *b, const char *o) : in_extra_data(false) {
     rgw_bucket _b(b);
     std::string _o(o);
     init(_b, _o);
   }
-  rgw_obj(rgw_bucket& b, const char *o) {
+  rgw_obj(rgw_bucket& b, const char *o) : in_extra_data(false) {
     std::string _o(o);
     init(b, _o);
   }
-  rgw_obj(rgw_bucket& b, const std::string& o) {
+  rgw_obj(rgw_bucket& b, const std::string& o) : in_extra_data(false) {
     init(b, o);
   }
-  rgw_obj(rgw_bucket& b, const std::string& o, const std::string& k) {
+  rgw_obj(rgw_bucket& b, const std::string& o, const std::string& k) : in_extra_data(false) {
     init(b, o, k);
   }
-  rgw_obj(rgw_bucket& b, const std::string& o, const std::string& k, const std::string& n) {
+  rgw_obj(rgw_bucket& b, const std::string& o, const std::string& k, const std::string& n) : in_extra_data(false) {
     init(b, o, k, n);
   }
   void init(rgw_bucket& b, const std::string& o, const std::string& k, const std::string& n) {
@@ -1176,6 +1178,14 @@ public:
     return true;
   }
 
+  void set_in_extra_data(bool val) {
+    in_extra_data = val;
+  }
+
+  bool is_in_extra_data() const {
+    return in_extra_data;
+  }
+
   void encode(bufferlist& bl) const {
     ENCODE_START(3, 3, bl);
     ::encode(bucket.name, bl);
index 074e7d81bcdca071aaaf66d76963fb95cd932aa8..f3501fbd93b2873da3bda22cd408524568cb3fd7 100644 (file)
@@ -280,6 +280,7 @@ static int read_policy(RGWRados *store, struct req_state *s,
     RGWMPObj mp(oid, upload_id);
     oid = mp.get_meta();
     obj.init_ns(bucket, oid, mp_ns);
+    obj.set_in_extra_data(true);
   } else {
     obj.init(bucket, oid);
   }
@@ -1457,6 +1458,7 @@ int RGWPutObjProcessor_Multipart::do_complete(string& etag, time_t *mtime, time_
 
   rgw_obj meta_obj;
   meta_obj.init_ns(bucket, multipart_meta_obj, mp_ns);
+  meta_obj.set_in_extra_data(true);
 
   r = store->omap_set(meta_obj, p, bl);
 
@@ -2387,6 +2389,7 @@ void RGWInitMultipart::execute()
 
     obj.init_ns(s->bucket, tmp_obj_name, mp_ns);
     // the meta object will be indexed with 0 size, we c
+    obj.set_in_extra_data(true);
     ret = store->put_obj_meta(s->obj_ctx, obj, 0, NULL, attrs, RGW_OBJ_CATEGORY_MULTIMETA, PUT_OBJ_CREATE_EXCL, s->owner.get_id());
   } while (ret == -EEXIST);
 }
@@ -2400,6 +2403,7 @@ static int get_multipart_info(RGWRados *store, struct req_state *s, string& meta
 
   rgw_obj obj;
   obj.init_ns(s->bucket, meta_oid, mp_ns);
+  obj.set_in_extra_data(true);
 
   int ret = get_obj_attrs(store, s, obj, attrs, NULL, NULL);
   if (ret < 0)
@@ -2438,6 +2442,7 @@ static int list_multipart_parts(RGWRados *store, struct req_state *s,
 
   rgw_obj obj;
   obj.init_ns(s->bucket, meta_oid, mp_ns);
+  obj.set_in_extra_data(true);
 
   bool sorted_omap = is_v2_upload_id(upload_id) && !assume_unsorted;
 
@@ -2682,6 +2687,7 @@ void RGWCompleteMultipart::execute()
 
   // remove the upload obj
   meta_obj.init_ns(s->bucket, meta_oid, mp_ns);
+  meta_obj.set_in_extra_data(true);
   store->delete_obj(s->obj_ctx, s->bucket_owner.get_id(), meta_obj);
 }
 
@@ -2755,6 +2761,7 @@ void RGWAbortMultipart::execute()
 
   // and also remove the metadata obj
   meta_obj.init_ns(s->bucket, meta_oid, mp_ns);
+  meta_obj.set_in_extra_data(true);
   ret = store->delete_obj(s->obj_ctx, owner, meta_obj);
   if (ret == -ENOENT) {
     ret = -ERR_NO_SUCH_BUCKET;
index e59b3b98918eaf88e13069c988567517019cea53..278b042a7b3d8ccc701130b207afe072f974a1ce 100644 (file)
@@ -44,6 +44,10 @@ static inline void get_obj_bucket_and_oid_key(const rgw_obj& obj, rgw_bucket& bu
   bucket = obj.bucket;
   prepend_bucket_marker(bucket, obj.object, oid);
   prepend_bucket_marker(bucket, obj.key, key);
+
+  if (obj.is_in_extra_data() && !bucket.data_extra_pool.empty()) {
+    bucket.data_pool = bucket.data_extra_pool;
+  }
 }
 
 int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy);