]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: bucket_index_shard_hash_type fixes
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Dec 2014 19:31:26 +0000 (11:31 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 14 Jan 2015 03:21:26 +0000 (19:21 -0800)
add initializations, json encode /decode.

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

index 463c1d4d4b9550f3144f4e8fcb3959edadf984bc..b6d4b2af522b93370393431a11b95d5967546613 100644 (file)
@@ -817,7 +817,7 @@ struct RGWBucketInfo
 
   void decode_json(JSONObj *obj);
 
-  RGWBucketInfo() : flags(0), creation_time(0), has_instance_obj(false) {}
+  RGWBucketInfo() : flags(0), creation_time(0), has_instance_obj(false), bucket_index_shard_hash_type(MOD) {}
 };
 WRITE_CLASS_ENCODER(RGWBucketInfo)
 
index 4ba73f75db634dcc9fd994a552116e757867aff9..4a2922780da9ad85a81cb6f99952a8a8674e9e80 100644 (file)
@@ -546,6 +546,7 @@ void RGWBucketInfo::dump(Formatter *f) const
   encode_json("has_instance_obj", has_instance_obj, f);
   encode_json("quota", quota, f);
   encode_json("num_shards", num_shards, f);
+  encode_json("bi_shard_hash_type", (uint32_t)bucket_index_shard_hash_type, f);
 }
 
 void RGWBucketInfo::decode_json(JSONObj *obj) {
@@ -558,6 +559,9 @@ void RGWBucketInfo::decode_json(JSONObj *obj) {
   JSONDecoder::decode_json("has_instance_obj", has_instance_obj, obj);
   JSONDecoder::decode_json("quota", quota, obj);
   JSONDecoder::decode_json("num_shards", num_shards, obj);
+  uint32_t hash_type;
+  JSONDecoder::decode_json("bi_shard_hash_type", hash_type, obj);
+  bucket_index_shard_hash_type = (uint8_t)hash_type;
 }
 
 void RGWObjEnt::dump(Formatter *f) const
index 135e3cd7ee849b736090b9ecf24defc124ee3464..444b0e468e032215baf009d55def94e32508df02 100644 (file)
@@ -3880,8 +3880,11 @@ int RGWRados::open_bucket_index_shard(rgw_bucket& bucket, librados::IoCtx& index
   if (ret < 0)
     return ret;
 
-  get_bucket_index_object(bucket_oid_base, obj_key, binfo.num_shards,
-      (RGWBucketInfo::BIShardsHashType)binfo.bucket_index_shard_hash_type, bucket_obj, shard_id);
+  ret = get_bucket_index_object(bucket_oid_base, obj_key, binfo.num_shards,
+        (RGWBucketInfo::BIShardsHashType)binfo.bucket_index_shard_hash_type, bucket_obj, shard_id);
+  if (ret < 0) {
+    ldout(cct, 10) << "get_bucket_index_object() returned ret=" << ret << dendl;
+  }
   return 0;
 }