For buckets that have num_shards set to 0, bucket instance
will not have a shard_id delimiter. When this bucket instance is parsed,
we end up assigning a value of -1 to shard_id, which is invalid
in data sync. This change ensures that we represent the shard_id correctly
by giving it a valid number
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
(cherry picked from commit
f11b3dce832221a344440787333c41f61a9f9c67)
rgw_bucket_shard source_bs;
int parse_bucket_key(const std::string& key, rgw_bucket_shard& bs) const {
- return rgw_bucket_parse_bucket_key(sc->env->cct, key,
+ int ret = rgw_bucket_parse_bucket_key(sc->env->cct, key,
&bs.bucket, &bs.shard_id);
+ //for the case of num_shards 0, shard_id gets a value of -1
+ //because of the way bucket instance gets parsed in the absence of shard_id delimiter.
+ //interpret it as a non-negative value.
+ if (ret == 0) {
+ if (bs.shard_id < 0) {
+ bs.shard_id = 0;
+ }
+ }
+ return ret;
}
RGWDataBaseSyncShardCR(