StringBytes reset(byte[] bytes, int offset, int length) { this.bytes = bytes; this.offset = offset; this.length = length; hash = bytes == null ? 0 : Hash.murmurhash3_x86_32(bytes, offset, length, 0); return this; }
/** * Identical to lookup3, except initval is biased by -(length<<2). * This is equivalent to leaving out the length factor in the initial state. * {@code lookup3ycs(k,offset,length,initval) == lookup3(k,offset,length,initval-(length<<2))} * and * {@code lookup3ycs(k,offset,length,initval+(length<<2)) == lookup3(k,offset,length,initval)} */ public static int lookup3ycs(int[] k, int offset, int length, int initval) { return lookup3(k, offset, length, initval-(length<<2)); }
public void add(String content) { hash = Hash.lookup3ycs64(content,0,content.length(),hash); }
long k1 = getLongLittleEndian(key, i); long k2 = getLongLittleEndian(key, i+8); k1 *= c1; k1 = Long.rotateLeft(k1,31); k1 *= c2; h1 ^= k1; h1 = Long.rotateLeft(h1,27); h1 += h2; h1 = h1*5+0x52dce729; h2 += h1; h1 = fmix64(h1); h2 = fmix64(h2);
long k1 = getLongLittleEndian(key, i); long k2 = getLongLittleEndian(key, i+8); k1 *= c1; k1 = Long.rotateLeft(k1,31); k1 *= c2; h1 ^= k1; h1 = Long.rotateLeft(h1,27); h1 += h2; h1 = h1*5+0x52dce729; h2 += h1; h1 = fmix64(h1); h2 = fmix64(h2);
StringBytes reset(byte[] bytes, int offset, int length) { this.bytes = bytes; this.offset = offset; this.length = length; hash = bytes == null ? 0 : Hash.murmurhash3_x86_32(bytes, offset, length, 0); return this; }
/** * Identical to lookup3, except initval is biased by -(length<<2). * This is equivalent to leaving out the length factor in the initial state. * {@code lookup3ycs(k,offset,length,initval) == lookup3(k,offset,length,initval-(length<<2))} * and * {@code lookup3ycs(k,offset,length,initval+(length<<2)) == lookup3(k,offset,length,initval)} */ public static int lookup3ycs(int[] k, int offset, int length, int initval) { return lookup3(k, offset, length, initval-(length<<2)); }
public int sliceHash(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection) { return Hash.murmurhash3_x86_32(id, 0, id.length(), 0); }
public int sliceHash(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection) { return Hash.murmurhash3_x86_32(id, 0, id.length(), 0); }
hashes[i] = Hash.murmurhash3_x86_32("", 0, "".length(), 0); else hashes[i] = Hash.murmurhash3_x86_32(parts[i], 0, parts[i].length(), 0);
hashes[i] = Hash.murmurhash3_x86_32("", 0, "".length(), 0); else hashes[i] = Hash.murmurhash3_x86_32(parts[i], 0, parts[i].length(), 0);
@Override public int sliceHash(String id, SolrInputDocument doc, SolrParams params, DocCollection collection) { String shardFieldName = getRouteField(collection); if (shardFieldName != null && doc != null) { Object o = doc.getFieldValue(shardFieldName); if (o == null) throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No value for :" + shardFieldName + ". Unable to identify shard"); id = o.toString(); } if (id.indexOf(SEPARATOR) < 0) { return Hash.murmurhash3_x86_32(id, 0, id.length(), 0); } return new KeyParser(id).getHash(); }
int hashCode = Hash.murmurhash3_x86_32(keyStr, 0, keyStr.length(), 0); int offset = (hashCode & Integer.MAX_VALUE) % (numPartitions / shards); int microShard = (rootShard * (numPartitions / shards)) + offset;
@Override public int sliceHash(String id, SolrInputDocument doc, SolrParams params, DocCollection collection) { String shardFieldName = getRouteField(collection); if (shardFieldName != null && doc != null) { Object o = doc.getFieldValue(shardFieldName); if (o == null) throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No value for :" + shardFieldName + ". Unable to identify shard"); id = o.toString(); } if (id.indexOf(SEPARATOR) < 0) { return Hash.murmurhash3_x86_32(id, 0, id.length(), 0); } return new KeyParser(id).getHash(); }
int hashCode = Hash.murmurhash3_x86_32(keyStr, 0, keyStr.length(), 0); int offset = (hashCode & Integer.MAX_VALUE) % (numPartitions / shards); int microShard = (rootShard * (numPartitions / shards)) + offset;
@Override public Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection) { if (shardKey == null) { // search across whole collection // TODO: this may need modification in the future when shard splitting could cause an overlap return collection.getActiveSlices(); } String id = shardKey; if (shardKey.indexOf(SEPARATOR) < 0) { // shardKey is a simple id, so don't do a range return Collections.singletonList(hashToSlice(Hash.murmurhash3_x86_32(id, 0, id.length(), 0), collection)); } Range completeRange = new KeyParser(id).getRange(); List<Slice> targetSlices = new ArrayList<>(1); for (Slice slice : collection.getActiveSlicesArr()) { Range range = slice.getRange(); if (range != null && range.overlaps(completeRange)) { targetSlices.add(slice); } } return targetSlices; }
@Override public Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection) { if (shardKey == null) { // search across whole collection // TODO: this may need modification in the future when shard splitting could cause an overlap return collection.getActiveSlices(); } String id = shardKey; if (shardKey.indexOf(SEPARATOR) < 0) { // shardKey is a simple id, so don't do a range return Collections.singletonList(hashToSlice(Hash.murmurhash3_x86_32(id, 0, id.length(), 0), collection)); } Range completeRange = new KeyParser(id).getRange(); List<Slice> targetSlices = new ArrayList<>(1); for (Slice slice : collection.getActiveSlices()) { Range range = slice.getRange(); if (range != null && range.overlaps(completeRange)) { targetSlices.add(slice); } } return targetSlices; }
final Object lock = locks.get(Math.abs(Hash.murmurhash3_x86_32(collection, 0, collection.length(), 0) % locks.size())); synchronized (lock) {
final Object lock = locks.get(Math.abs(Hash.murmurhash3_x86_32(collection, 0, collection.length(), 0) % locks.size())); DocCollection fetchedCol = null; synchronized (lock) {