From 0674b8086596a28d32df4a092725e68eb05f5237 Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Thu, 11 Nov 2021 17:20:24 -0500 Subject: [PATCH] rgw: fix `bi put` not using right bucket index shard When `radosgw-admin bi put` adds an entry for an incomplete multipart upload, the bucket index shard is not calculated correctly. It should be based on the name of the ultimate object. However the calculation was including the added organizational suffixes as well. This corrects that. NOTE: When entries are not put in the correct index shard, unordered listing becomes unreliable, perhaps causing entries to be skipped or infinite loops to form. Signed-off-by: J. Eric Ivancich (cherry picked from commit 2e620ac2abab6c14cbe4f17c59d5758b09430703) Conflicts: src/rgw/rgw_rados.cc Cherry-pick notes: - BucketShard init method does not take prefix provider arg in Octopus --- src/rgw/rgw_rados.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 45fde566af3ae..7c4b2280965c8 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -8033,7 +8033,14 @@ int RGWRados::bi_put(BucketShard& bs, rgw_cls_bi_entry& entry) int RGWRados::bi_put(rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry) { + // make sure incomplete multipart uploads are hashed correctly + if (obj.key.ns == RGW_OBJ_NS_MULTIPART) { + RGWMPObj mp; + mp.from_meta(obj.key.name); + obj.index_hash_source = mp.get_key(); + } BucketShard bs(this); + int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; -- 2.39.5