From: Matthew N. Heler Date: Tue, 9 Jun 2026 22:21:39 +0000 (-0500) Subject: rgw/restore: take the hash mod HASH_PRIME when picking a shard X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2e487acfe9ed45b30d879844bfdbc7d5f1ff343;p=ceph.git rgw/restore: take the hash mod HASH_PRIME when picking a shard choose_oid fed ceph_str_hash_linux straight into % max_objs, and the low bits of that hash are weak enough that similar object names keep landing on the same shard. LC takes the hash mod HASH_PRIME first for exactly this reason, do the same here. Signed-off-by: Matthew N. Heler --- diff --git a/src/rgw/rgw_restore.cc b/src/rgw/rgw_restore.cc index 0cda715e4c61..a73de2a40083 100644 --- a/src/rgw/rgw_restore.cc +++ b/src/rgw/rgw_restore.cc @@ -266,7 +266,7 @@ std::ostream& Restore::gen_prefix(std::ostream& out) const int Restore::choose_oid(const RestoreEntry& e) { int index; const auto& name = e.bucket.name + e.obj_key.name + e.obj_key.instance; - index = ((ceph_str_hash_linux(name.data(), name.size())) % max_objs); + index = ((ceph_str_hash_linux(name.data(), name.size())) % HASH_PRIME % max_objs); return static_cast(index); }