}
+// A helper function to retrieve the hash source from an incomplete multipart entry
+// by removing everything from the second last dot to the end.
+static int parse_index_hash_source(const std::string& oid_wo_ns, std::string *index_hash_source) {
+ std::size_t found = oid_wo_ns.rfind('.');
+ if (found == std::string::npos || found < 1) {
+ return -EINVAL;
+ }
+ found = oid_wo_ns.rfind('.', found - 1);
+ if (found == std::string::npos || found < 1) {
+ return -EINVAL;
+ }
+ *index_hash_source = oid_wo_ns.substr(0, found);
+ return 0;
+}
+
+
int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info,
int shard_id,
const rgw_obj_index_key& start_after,
// in it, so we need to get to the bucket shard index, so we can
// start reading from there
- std::string key;
- // test whether object name is a multipart meta name
- if(! multipart_meta_filter.filter(start_after.name, key)) {
- // if multipart_meta_filter fails, must be "regular" (i.e.,
- // unadorned) and the name is the key
- key = start_after.name;
- }
// now convert the key (oid) to an rgw_obj_key since that will
// separate out the namespace, name, and instance
rgw_obj_key obj_key;
- bool parsed = rgw_obj_key::parse_raw_oid(key, &obj_key);
+ bool parsed = rgw_obj_key::parse_raw_oid(start_after.name, &obj_key);
if (!parsed) {
ldout(cct, 0) <<
"ERROR: RGWRados::cls_bucket_list_unordered received an invalid "
} else {
// so now we have the key used to compute the bucket index shard
// and can extract the specific shard from it
- current_shard = svc.bi_rados->bucket_shard_index(obj_key.name, num_shards);
+ if (obj_key.ns == RGW_OBJ_NS_MULTIPART) {
+ // Use obj_key.ns == RGW_OBJ_NS_MULTIPART instead of
+ // the implementation relying on MultipartMetaFilter
+ // because MultipartMetaFilter only checks .meta suffix, which may
+ // exclude data multiparts but include some regular objects with .meta suffix
+ // by mistake.
+ string index_hash_source;
+ r = parse_index_hash_source(obj_key.name, &index_hash_source);
+ if (r < 0) {
+ return r;
+ }
+ current_shard = svc.bi_rados->bucket_shard_index(index_hash_source, num_shards);
+ } else {
+ current_shard = svc.bi_rados->bucket_shard_index(obj_key.name, num_shards);
+ }
}
}