Using 57744018578214912 as an id can cause failure to route to the correct shard, closes #1294.

This commit is contained in:
Shay Banon 2011-09-01 18:33:44 +03:00
parent 10278f115e
commit 3ae40487b6
1 changed files with 3 additions and 3 deletions

View File

@ -216,12 +216,12 @@ public class PlainOperationRouting extends AbstractComponent implements Operatio
private int shardId(ClusterState clusterState, String index, String type, @Nullable String id, @Nullable String routing) {
if (routing == null) {
if (!useType) {
return Math.abs(hash(id)) % indexMetaData(clusterState, index).numberOfShards();
return Math.abs(hash(id) % indexMetaData(clusterState, index).numberOfShards());
} else {
return Math.abs(hash(type, id)) % indexMetaData(clusterState, index).numberOfShards();
return Math.abs(hash(type, id) % indexMetaData(clusterState, index).numberOfShards());
}
}
return Math.abs(hash(routing)) % indexMetaData(clusterState, index).numberOfShards();
return Math.abs(hash(routing) % indexMetaData(clusterState, index).numberOfShards());
}
protected int hash(String routing) {