rgw: pass num shards on bucket initialization

Need to pass the actual num shards that are going to be used for this
specific bucket. Bucket may be created by applying metadata from
different zone, so num shards might be different.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2014-12-09 13:58:09 -08:00
parent 9536f74ac6
commit 710166593c
3 changed files with 5 additions and 5 deletions

View File

@ -1728,7 +1728,7 @@ public:
objv_tracker = bci.info.objv_tracker;
ret = store->init_bucket_index(bci.info.bucket);
ret = store->init_bucket_index(bci.info.bucket, bci.info.num_shards);
if (ret < 0)
return ret;

View File

@ -2375,7 +2375,7 @@ int RGWRados::create_pool(rgw_bucket& bucket)
return 0;
}
int RGWRados::init_bucket_index(rgw_bucket& bucket)
int RGWRados::init_bucket_index(rgw_bucket& bucket, int num_shards)
{
librados::IoCtx index_ctx; // context for new bucket
@ -2387,7 +2387,7 @@ int RGWRados::init_bucket_index(rgw_bucket& bucket)
dir_oid.append(bucket.marker);
map<int, string> bucket_objs;
get_bucket_index_objects(dir_oid, bucket_index_max_shards, bucket_objs);
get_bucket_index_objects(dir_oid, num_shards, bucket_objs);
return CLSRGWIssueBucketIndexInit(index_ctx, bucket_objs, cct->_conf->rgw_bucket_index_max_aio)();
}
@ -2440,7 +2440,7 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket,
string dir_oid = dir_oid_prefix;
dir_oid.append(bucket.marker);
r = init_bucket_index(bucket);
r = init_bucket_index(bucket, bucket_index_max_shards);
if (r < 0)
return r;

View File

@ -1489,7 +1489,7 @@ public:
* create a bucket with name bucket and the given list of attrs
* returns 0 on success, -ERR# otherwise.
*/
virtual int init_bucket_index(rgw_bucket& bucket);
virtual int init_bucket_index(rgw_bucket& bucket, int num_shards);
int select_bucket_placement(RGWUserInfo& user_info, const string& region_name, const std::string& rule,
const std::string& bucket_name, rgw_bucket& bucket, string *pselected_rule);
int select_legacy_bucket_placement(const string& bucket_name, rgw_bucket& bucket);