Minor refactoring for HashPartitionService

This commit is contained in:
ViacheslavKlimov 2023-10-27 16:38:44 +03:00
parent 9e408cd6f3
commit 0812149524

View File

@ -526,10 +526,7 @@ public class HashPartitionService implements PartitionService {
servers = responsible;
}
int hash = hashFunction.newHasher()
.putLong(tenantId.getId().getMostSignificantBits())
.putLong(tenantId.getId().getLeastSignificantBits())
.hash().asInt();
int hash = hash(tenantId.getId());
return servers.get(Math.abs((hash + partition) % servers.size()));
} else {
return servers.get(partition % servers.size());