summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-07-26 16:40:34 -0700
committerGreg Farnum <greg@inktank.com>2013-07-29 15:06:56 -0700
commit68730d80c8aa393a583c92052ef5ffd11efe17a6 (patch)
treea4e95e3a67fadcdec30be22654871ac378ac956d
parentacd16d1aed0f6146c84a377be9fef1d7f54c6bed (diff)
downloadceph-68730d80c8aa393a583c92052ef5ffd11efe17a6.tar.gz
rgw: track bucket instance oid
We now keep the bucket instance oid in rgw_bucket. The reason we need it is that the bucket might have been created before the entrypoint / bucket instance separation. Fixes: #5790 Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Greg Farnum <greg@inktank.com>
-rw-r--r--src/rgw/rgw_common.h4
-rw-r--r--src/rgw/rgw_rados.cc18
2 files changed, 18 insertions, 4 deletions
diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h
index 543bdf21377..8e4126de271 100644
--- a/src/rgw/rgw_common.h
+++ b/src/rgw/rgw_common.h
@@ -542,6 +542,10 @@ struct rgw_bucket {
std::string marker;
std::string bucket_id;
+ std::string oid; /*
+ * runtime in-memory only info. If not empty, points to the bucket instance object
+ */
+
rgw_bucket() { }
rgw_bucket(const char *n) : name(n) {
assert(*n == '.'); // only rgw private buckets should be initialized without pool
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 22c93f33ad5..9e8f5637415 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -4548,9 +4548,13 @@ void RGWRados::get_bucket_meta_oid(rgw_bucket& bucket, string& oid)
void RGWRados::get_bucket_instance_obj(rgw_bucket& bucket, rgw_obj& obj)
{
- string oid;
- get_bucket_meta_oid(bucket, oid);
- obj.init(zone.domain_root, oid);
+ if (!bucket.oid.empty()) {
+ obj.init(zone.domain_root, bucket.oid);
+ } else {
+ string oid;
+ get_bucket_meta_oid(bucket, oid);
+ obj.init(zone.domain_root, oid);
+ }
}
int RGWRados::get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info,
@@ -4569,7 +4573,11 @@ int RGWRados::get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketI
time_t *pmtime, map<string, bufferlist> *pattrs)
{
string oid;
- get_bucket_meta_oid(bucket, oid);
+ if (!bucket.oid.empty()) {
+ get_bucket_meta_oid(bucket, oid);
+ } else {
+ oid = bucket.oid;
+ }
return get_bucket_instance_from_oid(ctx, oid, info, pmtime, pattrs);
}
@@ -4593,6 +4601,7 @@ int RGWRados::get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo
ldout(cct, 0) << "ERROR: could not decode buffer info, caught buffer::error" << dendl;
return -EIO;
}
+ info.bucket.oid = oid;
return 0;
}
@@ -4635,6 +4644,7 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf
if (entry_point.has_bucket_info) {
info = entry_point.old_bucket_info;
+ info.bucket.oid = bucket_name;
info.ep_objv = ot.read_version;
ldout(cct, 20) << "rgw_get_bucket_info: old bucket info, bucket=" << info.bucket << " owner " << info.owner << dendl;
return 0;