From: Yehuda Sadeh Date: Wed, 3 Dec 2014 19:31:26 +0000 (-0800) Subject: rgw: bucket_index_shard_hash_type fixes X-Git-Tag: v0.92~12^2~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d52a8b10a566bd7e0ec25a15b5b15ceb027a52b5;p=ceph.git rgw: bucket_index_shard_hash_type fixes add initializations, json encode /decode. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 463c1d4d4b9..b6d4b2af522 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -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) diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 4ba73f75db6..4a2922780da 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -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 diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 135e3cd7ee8..444b0e468e0 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; }