Make sure the hashcode is not negative when selecting key chunk #22487

This commit is contained in:
Johan Andrén 2017-03-13 17:57:03 +01:00 committed by GitHub
parent 7a0e5b31f8
commit 1e6b8ec86b

View file

@ -1558,7 +1558,7 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog
val otherKeys = otherDigests.keySet
val myKeys =
if (totChunks == 1) dataEntries.keySet
else dataEntries.keysIterator.filter(_.hashCode % totChunks == chunk).toSet
else dataEntries.keysIterator.filter(key => math.abs(key.hashCode) % totChunks == chunk).toSet
val otherMissingKeys = myKeys diff otherKeys
val keys = (otherDifferentKeys ++ otherMissingKeys).take(maxDeltaElements)
if (keys.nonEmpty) {