]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use bucket shard for olh operations
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 23 Jan 2015 00:06:57 +0000 (16:06 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 23 Jan 2015 00:06:57 +0000 (16:06 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw_client.cc
src/cls/rgw/cls_rgw_client.h
src/rgw/rgw_rados.cc

index 0556006d1c9fe4d3c016dbfdda07fb49137a7979..e6ac56b822c3601ba731fdbaa7e50982ec9632e6 100644 (file)
@@ -364,7 +364,7 @@ int cls_rgw_get_olh_log(IoCtx& io_ctx, string& oid, librados::ObjectReadOperatio
  return r;
 }
 
-void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, string& oid, const cls_rgw_obj_key& olh, uint64_t ver, const string& olh_tag)
+void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const string& olh_tag)
 {
   bufferlist in;
   struct rgw_cls_trim_olh_log_op call;
index b8f8d8698bf459cae73beb4d36b3b49d2761a4ff..ecec679192ed3b007ef9ca1ea1751a5435c745bd 100644 (file)
@@ -333,7 +333,7 @@ int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid, c
 int cls_rgw_get_olh_log(librados::IoCtx& io_ctx, string& oid, librados::ObjectReadOperation& op, const cls_rgw_obj_key& olh, uint64_t ver_marker,
                         const string& olh_tag,
                         map<uint64_t, vector<struct rgw_bucket_olh_log_entry> > *log, bool *is_truncated);
-void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, string& oid, const cls_rgw_obj_key& olh, uint64_t ver, const string& olh_tag);
+void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const string& olh_tag);
 int cls_rgw_clear_olh(librados::IoCtx& io_ctx, string& oid, const cls_rgw_obj_key& olh, const string& olh_tag);
 
 /**
index 2d80a059610aa149e11ad010ff39c57046d956cb..609bec9f03907bd778a5c528ecf73e4e544875d9 100644 (file)
@@ -5821,16 +5821,15 @@ int RGWRados::bucket_index_link_olh(RGWObjState& olh_state, rgw_obj& obj_instanc
     return r;
   }
 
-  librados::IoCtx index_ctx;
-  string oid;
-
-  int ret = open_bucket_index(bucket, index_ctx, oid);
+  BucketShard bs(this);
+  int ret = bs.init(bucket, obj_instance);
   if (ret < 0) {
+    ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl;
     return ret;
   }
 
   cls_rgw_obj_key key(obj_instance.get_index_key_name(), obj_instance.get_instance());
-  ret = cls_rgw_bucket_link_olh(index_ctx, oid, key, olh_state.olh_tag, delete_marker, op_tag, meta, olh_epoch,
+  ret = cls_rgw_bucket_link_olh(bs.index_ctx, bs.bucket_obj, key, olh_state.olh_tag, delete_marker, op_tag, meta, olh_epoch,
                                 zone_public_config.log_data);
   if (ret < 0) {
     return ret;
@@ -5854,16 +5853,15 @@ int RGWRados::bucket_index_unlink_instance(rgw_obj& obj_instance, const string&
     return r;
   }
 
-  librados::IoCtx index_ctx;
-  string oid;
-
-  int ret = open_bucket_index(bucket, index_ctx, oid);
+  BucketShard bs(this);
+  int ret = bs.init(bucket, obj_instance);
   if (ret < 0) {
+    ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl;
     return ret;
   }
 
   cls_rgw_obj_key key(obj_instance.get_index_key_name(), obj_instance.get_instance());
-  ret = cls_rgw_bucket_unlink_instance(index_ctx, oid, key, op_tag, olh_epoch, zone_public_config.log_data);
+  ret = cls_rgw_bucket_unlink_instance(bs.index_ctx, bs.bucket_obj, key, op_tag, olh_epoch, zone_public_config.log_data);
   if (ret < 0) {
     return ret;
   }
@@ -5882,11 +5880,10 @@ int RGWRados::bucket_index_read_olh_log(RGWObjState& state, rgw_obj& obj_instanc
     return r;
   }
 
-  librados::IoCtx index_ctx;
-  string oid;
-
-  int ret = open_bucket_index(bucket, index_ctx, oid);
+  BucketShard bs(this);
+  int ret = bs.init(bucket, obj_instance);
   if (ret < 0) {
+    ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl;
     return ret;
   }
 
@@ -5896,7 +5893,7 @@ int RGWRados::bucket_index_read_olh_log(RGWObjState& state, rgw_obj& obj_instanc
 
   ObjectReadOperation op;
 
-  ret = cls_rgw_get_olh_log(index_ctx, oid, op, key, ver_marker, olh_tag, log, is_truncated);
+  ret = cls_rgw_get_olh_log(bs.index_ctx, bs.bucket_obj, op, key, ver_marker, olh_tag, log, is_truncated);
   if (ret < 0)
     return ret;
 
@@ -5912,11 +5909,10 @@ int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, rgw_obj& obj_instanc
     return r;
   }
 
-  librados::IoCtx index_ctx;
-  string oid;
-
-  int ret = open_bucket_index(bucket, index_ctx, oid);
+  BucketShard bs(this);
+  int ret = bs.init(bucket, obj_instance);
   if (ret < 0) {
+    ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl;
     return ret;
   }
 
@@ -5926,9 +5922,9 @@ int RGWRados::bucket_index_trim_olh_log(RGWObjState& state, rgw_obj& obj_instanc
 
   ObjectWriteOperation op;
 
-  cls_rgw_trim_olh_log(op, oid, key, ver, olh_tag);
+  cls_rgw_trim_olh_log(op, key, ver, olh_tag);
 
-  ret = index_ctx.operate(oid, &op);
+  ret = bs.index_ctx.operate(bs.bucket_obj, &op);
   if (ret < 0)
     return ret;
 
@@ -5944,11 +5940,10 @@ int RGWRados::bucket_index_clear_olh(RGWObjState& state, rgw_obj& obj_instance)
     return r;
   }
 
-  librados::IoCtx index_ctx;
-  string oid;
-
-  int ret = open_bucket_index(bucket, index_ctx, oid);
+  BucketShard bs(this);
+  int ret = bs.init(bucket, obj_instance);
   if (ret < 0) {
+    ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl;
     return ret;
   }
 
@@ -5956,7 +5951,7 @@ int RGWRados::bucket_index_clear_olh(RGWObjState& state, rgw_obj& obj_instance)
 
   cls_rgw_obj_key key(obj_instance.get_index_key_name(), string());
 
-  ret = cls_rgw_clear_olh(index_ctx, oid, key, olh_tag);
+  ret = cls_rgw_clear_olh(bs.index_ctx, bs.bucket_obj, key, olh_tag);
   if (ret < 0) {
     ldout(cct, 5) << "cls_rgw_clear_olh() returned ret=" << ret << dendl;
     return ret;