From 5548bbe15ffb4f5b79484320f37853667855c930 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 22 Jan 2015 16:06:57 -0800 Subject: rgw: use bucket shard for olh operations Signed-off-by: Yehuda Sadeh --- src/cls/rgw/cls_rgw_client.cc | 2 +- src/cls/rgw/cls_rgw_client.h | 2 +- src/rgw/rgw_rados.cc | 47 +++++++++++++++++++------------------------ 3 files changed, 23 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc index 0556006d1c9..e6ac56b822c 100644 --- a/src/cls/rgw/cls_rgw_client.cc +++ b/src/cls/rgw/cls_rgw_client.cc @@ -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; diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index b8f8d8698bf..ecec679192e 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -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 > *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); /** diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2d80a059610..609bec9f039 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; -- cgit v1.2.3