From d2e487acfe9ed45b30d879844bfdbc7d5f1ff343 Mon Sep 17 00:00:00 2001 From: "Matthew N. Heler" Date: Tue, 9 Jun 2026 17:21:39 -0500 Subject: [PATCH] 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 --- src/rgw/rgw_restore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/rgw_restore.cc b/src/rgw/rgw_restore.cc index 0cda715e4c6..a73de2a4008 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); }