private int getDistributorSeed(BucketId bucket, ClusterState state) { return ((int) bucket.getRawId()) & distributionBitMasks[state.getDistributionBitCount()]; }
private int getGroupSeed(BucketId bucket, ClusterState state, Group group) { int seed = ((int) bucket.getRawId()) & distributionBitMasks[state.getDistributionBitCount()]; seed ^= group.getDistributionHash(); return seed; }
private int getStorageSeed(BucketId bucket, ClusterState state) { int seed = ((int) bucket.getRawId()) & distributionBitMasks[state.getDistributionBitCount()]; if (bucket.getUsedBits() > 33) { int usedBits = bucket.getUsedBits() - 1; seed ^= (distributionBitMasks[usedBits - 32] & (bucket.getRawId() >> 32)) << 6; } return seed; }
private void handleWrongDistributionReply(WrongDistributionReply reply) { try { ClusterState newState = new ClusterState(reply.getSystemState()); int stateBits = newState.getDistributionBitCount(); if (stateBits != progress.getIterator().getDistributionBitCount()) { log.log(LogLevel.DEBUG, "System state changed; now at " + stateBits + " distribution bits"); // Update the internal state of the visitor iterator. If we're increasing // the number of distribution bits, this may lead to splitting of pending // buckets. If we're decreasing, it may lead to merging of pending buckets // and potential loss of sub-bucket progress. In either way, the iterator // will not let any new buckets out before all active buckets have been // updated. progress.getIterator().setDistributionBitCount(stateBits); } } catch (Exception e) { log.log(LogLevel.ERROR, "Failed to parse new system state string: " + reply.getSystemState()); transitionTo(new StateDescription(State.FAILED, "Failed to parse cluster state '" + reply.getSystemState() + "'")); } }
if (bucket.getUsedBits() < clusterState.getDistributionBitCount()) { String msg = "Cannot get ideal state for bucket " + bucket + " using " + bucket.getUsedBits() + " bits when cluster uses " + clusterState.getDistributionBitCount() + " distribution bits."; throw new TooFewBucketBitsInUseException(msg);
public int getIdealDistributorNode(ClusterState state, BucketId bucket, String upStates) throws TooFewBucketBitsInUseException, NoDistributorsAvailableException { if (bucket.getUsedBits() < state.getDistributionBitCount()) { throw new TooFewBucketBitsInUseException("Cannot get ideal state for bucket " + bucket + " using " + bucket.getUsedBits() + " bits when cluster uses " + state.getDistributionBitCount() + " distribution bits.");