Skip to content

Commit 9eeb71e

Browse files
committed
rgw: fix radosgw-admin object unlink ...
The unlink subcommand did not handle unsharded bucket indices appropriately. These are when the number of shards listed in the bucket instance object is 0. In that case there will actually be 1 shard. When number of shards as 0 is passed into the function that maps object names to shards, it returns -1. And that was not handled properly. That is now fixed. Signed-off-by: J. Eric Ivancich <[email protected]>
1 parent 70417d2 commit 9eeb71e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11206,8 +11206,11 @@ int RGWRados::remove_objs_from_index(const DoutPrefixProvider *dpp,
1120611206
std::map<int, std::set<std::string>> sharded_removals;
1120711207
for (const auto& entry_key : entry_key_list) {
1120811208
const rgw_obj_key obj_key(entry_key);
11209-
const uint32_t shard =
11210-
RGWSI_BucketIndex_RADOS::bucket_shard_index(obj_key, num_shards);
11209+
const uint32_t shard = [&obj_key, num_shards]() -> uint32_t {
11210+
int32_t temp = RGWSI_BucketIndex_RADOS::bucket_shard_index(obj_key, num_shards);
11211+
return (-1 == temp) ? 0 : (uint32_t) temp;
11212+
}();
11213+
1121111214

1121211215
// entry_key already combines namespace and name, so we first have
1121311216
// to break that apart before we can then combine with instance

0 commit comments

Comments
 (0)