public boolean hasSameSettings(AbstractReplicationStrategy other) { return getClass().equals(other.getClass()) && getReplicationFactor() == other.getReplicationFactor(); }
public boolean hasSameSettings(AbstractReplicationStrategy other) { return getClass().equals(other.getClass()) && getReplicationFactor() == other.getReplicationFactor(); }
public boolean hasSameSettings(AbstractReplicationStrategy other) { return getClass().equals(other.getClass()) && getReplicationFactor() == other.getReplicationFactor(); }
public boolean hasSameSettings(AbstractReplicationStrategy other) { return getClass().equals(other.getClass()) && getReplicationFactor() == other.getReplicationFactor(); }
private int quorumFor(Keyspace keyspace) { return (keyspace.getReplicationStrategy().getReplicationFactor() / 2) + 1; }
private int quorumFor(Keyspace keyspace) { return (keyspace.getReplicationStrategy().getReplicationFactor() / 2) + 1; }
private int quorumFor(Keyspace keyspace) { return (keyspace.getReplicationStrategy().getReplicationFactor() / 2) + 1; }
private int quorumFor(Keyspace keyspace) { return (keyspace.getReplicationStrategy().getReplicationFactor() / 2) + 1; }
public int forceRepairAsync(String keyspace, RepairParallelism parallelismDegree, boolean isLocal, Collection<Range<Token>> ranges, boolean fullRepair, String... columnFamilies) { if (ranges.isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2) return 0; int cmd = nextRepairCommand.incrementAndGet(); if (FBUtilities.isWindows() && parallelismDegree != RepairParallelism.PARALLEL) { logger.warn("Snapshot-based repair is not yet supported on Windows. Reverting to parallel repair."); parallelismDegree = RepairParallelism.PARALLEL; } new Thread(createRepairTask(cmd, keyspace, ranges, parallelismDegree, isLocal, fullRepair, columnFamilies)).start(); return cmd; }
public int forceRepairAsync(String keyspace, RepairOption options, boolean legacy) { if (options.getRanges().isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2) return 0; int cmd = nextRepairCommand.incrementAndGet(); NamedThreadFactory.createThread(createRepairTask(cmd, keyspace, options, legacy), "Repair-Task-" + threadCounter.incrementAndGet()).start(); return cmd; }
public int forceRepairAsync(String keyspace, RepairOption options, boolean legacy) { if (options.getRanges().isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2) return 0; int cmd = nextRepairCommand.incrementAndGet(); NamedThreadFactory.createThread(createRepairTask(cmd, keyspace, options, legacy), "Repair-Task-" + threadCounter.incrementAndGet()).start(); return cmd; }
/** * @param keyspaceName keyspace name to check * @return true when the node is bootstrapping, useStrictConsistency is true and # of nodes in the cluster is more than # of replica */ private boolean useStrictSourcesForRanges(String keyspaceName) { AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy(); return useStrictConsistency && tokens != null && metadata.getAllEndpoints().size() != strat.getReplicationFactor(); }
/** * @param keyspaceName keyspace name to check * @return true when the node is bootstrapping, useStrictConsistency is true and # of nodes in the cluster is more than # of replica */ private boolean useStrictSourcesForRanges(String keyspaceName) { AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy(); return useStrictConsistency && tokens != null && metadata.getAllEndpoints().size() != strat.getReplicationFactor(); }
/** * @param keyspaceName keyspace name to check * @return true when the node is bootstrapping, useStrictConsistency is true and # of nodes in the cluster is more than # of replica */ private boolean useStrictSourcesForRanges(String keyspaceName) { AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy(); return useStrictConsistency && tokens != null && metadata.getAllEndpoints().size() != strat.getReplicationFactor(); }
public int forceRepairAsync(String keyspace, RepairOption options, boolean legacy) { if (options.getRanges().isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2) return 0; int cmd = nextRepairCommand.incrementAndGet(); NamedThreadFactory.createThread(createRepairTask(cmd, keyspace, options, legacy), "Repair-Task-" + threadCounter.incrementAndGet()).start(); return cmd; }
private boolean useStrictSourcesForRanges(String keyspaceName) { AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy(); return isNotReplacingAndUsesStrictConsistency() && tokens != null && metadata.getAllEndpoints().size() != strat.getReplicationFactor(); }
public static int replicationFactor(String keyspace) { if (Schema.instance != null && Schema.instance.getKeyspaceInstance(keyspace) != null) { AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy(); int rf = replicationStrategy.getReplicationFactor(); if (replicationStrategy instanceof NetworkTopologyStrategy) { rf = ((NetworkTopologyStrategy)replicationStrategy).getReplicationFactor(DatabaseDescriptor.getLocalDataCenter()); } return rf; } return 0; }
/** * Estimate the number of result rows (either cql3 rows or "thrift" rows, as called for by the command) per * range in the ring based on our local data. This assumes that ranges are uniformly distributed across the cluster * and that the queried data is also uniformly distributed. */ private static float estimateResultsPerRange(PartitionRangeReadCommand command, Keyspace keyspace) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.metadata().cfId); Index index = command.getIndex(cfs); float maxExpectedResults = index == null ? command.limits().estimateTotalResults(cfs) : index.getEstimatedResultRows(); // adjust maxExpectedResults by the number of tokens this node has and the replication factor for this ks return (maxExpectedResults / DatabaseDescriptor.getNumTokens()) / keyspace.getReplicationStrategy().getReplicationFactor(); }
/** * Estimate the number of result rows (either cql3 rows or "thrift" rows, as called for by the command) per * range in the ring based on our local data. This assumes that ranges are uniformly distributed across the cluster * and that the queried data is also uniformly distributed. */ private static float estimateResultsPerRange(PartitionRangeReadCommand command, Keyspace keyspace) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.metadata().cfId); Index index = command.getIndex(cfs); float maxExpectedResults = index == null ? command.limits().estimateTotalResults(cfs) : index.getEstimatedResultRows(); // adjust maxExpectedResults by the number of tokens this node has and the replication factor for this ks return (maxExpectedResults / DatabaseDescriptor.getNumTokens()) / keyspace.getReplicationStrategy().getReplicationFactor(); }
public ShardInfo shardInfo(String index, ConsistencyLevel cl) { Keyspace keyspace = Schema.instance.getKeyspaceInstance(state().metaData().index(index).keyspace()); AbstractReplicationStrategy replicationStrategy = keyspace.getReplicationStrategy(); int rf = replicationStrategy.getReplicationFactor(); if (replicationStrategy instanceof NetworkTopologyStrategy) rf = ((NetworkTopologyStrategy)replicationStrategy).getReplicationFactor(DatabaseDescriptor.getLocalDataCenter()); return new ShardInfo(rf, cl.blockFor(keyspace)); }