Merge branch 'cassandra-3.11' into trunk

This commit is contained in:
Paulo Motta 2017-02-15 10:53:21 -02:00
commit 31eac784f1
4 changed files with 40 additions and 31 deletions

View File

@ -37,6 +37,7 @@
* More fixes to the TokenAllocator (CASSANDRA-12990)
* NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
Merged from 3.0:
* Use keyspace replication settings on system.size_estimates table (CASSANDRA-9639)
* Add vm.max_map_count StartupCheck (CASSANDRA-13008)
* Obfuscate password in stress-graphs (CASSANDRA-12233)
* Hint related logging should include the IP address of the destination in addition to

View File

@ -22,9 +22,6 @@ New features
See CASSANDRA-11936
- Support for arithmetic operations on number has been added. See CASSANDRA-11935
3.11
====
Upgrading
---------
- Cassandra 4.0 removed support for the deprecated Thrift interface. Amongst
@ -47,6 +44,14 @@ Upgrading
repaired. For incremental repairs, anticompaction is run at the beginning
of the repair, instead of at the end.
3.11.0
======
Upgrading
---------
- Primary ranges in the system.size_estimates table are now based on the keyspace
replication settings and adjacent ranges are no longer merged (CASSANDRA-9639).
3.10
====

View File

@ -68,12 +68,10 @@ public class SizeEstimatesRecorder extends SchemaChangeListener implements Runna
logger.trace("Recording size estimates");
// find primary token ranges for the local node.
Collection<Token> localTokens = StorageService.instance.getLocalTokens();
Collection<Range<Token>> localRanges = metadata.getPrimaryRangesFor(localTokens);
for (Keyspace keyspace : Keyspace.nonLocalStrategy())
{
Collection<Range<Token>> localRanges = StorageService.instance.getPrimaryRangesForEndpoint(keyspace.getName(),
FBUtilities.getBroadcastAddress());
for (ColumnFamilyStore table : keyspace.getColumnFamilyStores())
{
long start = System.nanoTime();
@ -90,37 +88,39 @@ public class SizeEstimatesRecorder extends SchemaChangeListener implements Runna
@SuppressWarnings("resource")
private void recordSizeEstimates(ColumnFamilyStore table, Collection<Range<Token>> localRanges)
{
List<Range<Token>> unwrappedRanges = Range.normalize(localRanges);
// for each local primary range, estimate (crudely) mean partition size and partitions count.
Map<Range<Token>, Pair<Long, Long>> estimates = new HashMap<>(localRanges.size());
for (Range<Token> range : unwrappedRanges)
for (Range<Token> localRange : localRanges)
{
// filter sstables that have partitions in this range.
Refs<SSTableReader> refs = null;
long partitionsCount, meanPartitionSize;
try
for (Range<Token> unwrappedRange : localRange.unwrap())
{
while (refs == null)
// filter sstables that have partitions in this range.
Refs<SSTableReader> refs = null;
long partitionsCount, meanPartitionSize;
try
{
Iterable<SSTableReader> sstables = table.getTracker().getView().select(SSTableSet.CANONICAL);
SSTableIntervalTree tree = SSTableIntervalTree.build(sstables);
Range<PartitionPosition> r = Range.makeRowRange(range);
Iterable<SSTableReader> canonicalSSTables = View.sstablesInBounds(r.left, r.right, tree);
refs = Refs.tryRef(canonicalSSTables);
while (refs == null)
{
Iterable<SSTableReader> sstables = table.getTracker().getView().select(SSTableSet.CANONICAL);
SSTableIntervalTree tree = SSTableIntervalTree.build(sstables);
Range<PartitionPosition> r = Range.makeRowRange(unwrappedRange);
Iterable<SSTableReader> canonicalSSTables = View.sstablesInBounds(r.left, r.right, tree);
refs = Refs.tryRef(canonicalSSTables);
}
// calculate the estimates.
partitionsCount = estimatePartitionsCount(refs, unwrappedRange);
meanPartitionSize = estimateMeanPartitionSize(refs);
}
finally
{
if (refs != null)
refs.release();
}
// calculate the estimates.
partitionsCount = estimatePartitionsCount(refs, range);
meanPartitionSize = estimateMeanPartitionSize(refs);
estimates.put(unwrappedRange, Pair.create(partitionsCount, meanPartitionSize));
}
finally
{
if (refs != null)
refs.release();
}
estimates.put(range, Pair.create(partitionsCount, meanPartitionSize));
}
// atomically update the estimates.

View File

@ -266,7 +266,10 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai
}
else if (range.intersects(toRepair))
{
throw new IllegalArgumentException("Requested range intersects a local range but is not fully contained in one; this would lead to imprecise repair");
throw new IllegalArgumentException(String.format("Requested range %s intersects a local range (%s) " +
"but is not fully contained in one; this would lead to " +
"imprecise repair. keyspace: %s", toRepair.toString(),
range.toString(), keyspaceName));
}
}
if (rangeSuperSet == null || !replicaSets.containsKey(rangeSuperSet))