From 689badbe7fb468d4aec14e2f86bfc4cce9c103a2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 7 Sep 2017 16:17:46 -0400 Subject: [PATCH] rgw: RGWGetBucketInstanceInfoCR takes rgw_bucket or metadata key Signed-off-by: Casey Bodley --- src/rgw/rgw_cr_rados.cc | 4 ++-- src/rgw/rgw_cr_rados.h | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 5f4fd72cf3a..06de89a8a20 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -482,10 +482,10 @@ bool RGWOmapAppend::finish() { int RGWAsyncGetBucketInstanceInfo::_send_request() { RGWObjectCtx obj_ctx(store); - int r = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info, NULL, NULL); + int r = store->get_bucket_instance_from_oid(obj_ctx, oid, *bucket_info, NULL, NULL); if (r < 0) { ldout(store->ctx(), 0) << "ERROR: failed to get bucket instance info for " - << bucket << dendl; + << oid << dendl; return r; } diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 4f9089a9862..cb0ba580897 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -670,32 +670,40 @@ public: class RGWAsyncGetBucketInstanceInfo : public RGWAsyncRadosRequest { RGWRados *store; - rgw_bucket bucket; + const std::string oid; RGWBucketInfo *bucket_info; protected: int _send_request() override; public: RGWAsyncGetBucketInstanceInfo(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, - RGWRados *_store, const rgw_bucket& bucket, + RGWRados *_store, const std::string& oid, RGWBucketInfo *_bucket_info) : RGWAsyncRadosRequest(caller, cn), store(_store), - bucket(bucket), bucket_info(_bucket_info) {} + oid(oid), bucket_info(_bucket_info) {} }; class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine { RGWAsyncRadosProcessor *async_rados; RGWRados *store; - rgw_bucket bucket; + const std::string oid; RGWBucketInfo *bucket_info; - RGWAsyncGetBucketInstanceInfo *req; + RGWAsyncGetBucketInstanceInfo *req{nullptr}; public: + // metadata key constructor + RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, + const std::string& meta_key, RGWBucketInfo *_bucket_info) + : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store), + oid(RGW_BUCKET_INSTANCE_MD_PREFIX + meta_key), + bucket_info(_bucket_info) {} + // rgw_bucket constructor RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, const rgw_bucket& bucket, RGWBucketInfo *_bucket_info) : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store), - bucket(bucket), bucket_info(_bucket_info), req(NULL) {} + oid(RGW_BUCKET_INSTANCE_MD_PREFIX + bucket.get_key(':')), + bucket_info(_bucket_info) {} ~RGWGetBucketInstanceInfoCR() override { request_cleanup(); } @@ -707,7 +715,7 @@ public: } int send_request() override { - req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, bucket, bucket_info); + req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, oid, bucket_info); async_rados->queue(req); return 0; } -- 2.39.5