Merge branch 'cassandra-3.0' into cassandra-3.11

This commit is contained in:
Marcus Eriksson 2017-12-11 09:03:55 +01:00
commit 817f3c282d
4 changed files with 14 additions and 5 deletions

View File

@ -26,6 +26,8 @@ Merged from 3.0:
* Provide a JMX call to sync schema with local storage (CASSANDRA-13954) * Provide a JMX call to sync schema with local storage (CASSANDRA-13954)
* Mishandling of cells for removed/dropped columns when reading legacy files (CASSANDRA-13939) * Mishandling of cells for removed/dropped columns when reading legacy files (CASSANDRA-13939)
* Deserialise sstable metadata in nodetool verify (CASSANDRA-13922) * Deserialise sstable metadata in nodetool verify (CASSANDRA-13922)
Merged from 2.2:
* Grab refs during scrub/index redistribution/cleanup (CASSANDRA-13873)
3.11.1 3.11.1

View File

@ -1097,6 +1097,7 @@ public class CompactionManager implements CompactionManagerMBean
try (SSTableRewriter writer = SSTableRewriter.construct(cfs, txn, false, sstable.maxDataAge); try (SSTableRewriter writer = SSTableRewriter.construct(cfs, txn, false, sstable.maxDataAge);
ISSTableScanner scanner = cleanupStrategy.getScanner(sstable, null); ISSTableScanner scanner = cleanupStrategy.getScanner(sstable, null);
CompactionController controller = new CompactionController(cfs, txn.originals(), getDefaultGcBefore(cfs, nowInSec)); CompactionController controller = new CompactionController(cfs, txn.originals(), getDefaultGcBefore(cfs, nowInSec));
Refs<SSTableReader> refs = Refs.ref(Collections.singleton(sstable));
CompactionIterator ci = new CompactionIterator(OperationType.CLEANUP, Collections.singletonList(scanner), controller, nowInSec, UUIDGen.getTimeUUID(), metrics)) CompactionIterator ci = new CompactionIterator(OperationType.CLEANUP, Collections.singletonList(scanner), controller, nowInSec, UUIDGen.getTimeUUID(), metrics))
{ {
writer.switchWriter(createWriter(cfs, compactionFileLocation, expectedBloomFilterSize, sstable.getSSTableMetadata().repairedAt, sstable, txn)); writer.switchWriter(createWriter(cfs, compactionFileLocation, expectedBloomFilterSize, sstable.getSSTableMetadata().repairedAt, sstable, txn));

View File

@ -36,6 +36,7 @@ import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.io.util.RandomAccessReader; import org.apache.cassandra.io.util.RandomAccessReader;
import org.apache.cassandra.service.ActiveRepairService; import org.apache.cassandra.service.ActiveRepairService;
import org.apache.cassandra.utils.*; import org.apache.cassandra.utils.*;
import org.apache.cassandra.utils.concurrent.Refs;
public class Scrubber implements Closeable public class Scrubber implements Closeable
{ {
@ -142,7 +143,8 @@ public class Scrubber implements Closeable
List<SSTableReader> finished = new ArrayList<>(); List<SSTableReader> finished = new ArrayList<>();
boolean completed = false; boolean completed = false;
outputHandler.output(String.format("Scrubbing %s (%s)", sstable, FBUtilities.prettyPrintMemory(dataFile.length()))); outputHandler.output(String.format("Scrubbing %s (%s)", sstable, FBUtilities.prettyPrintMemory(dataFile.length())));
try (SSTableRewriter writer = SSTableRewriter.construct(cfs, transaction, false, sstable.maxDataAge)) try (SSTableRewriter writer = SSTableRewriter.construct(cfs, transaction, false, sstable.maxDataAge);
Refs<SSTableReader> refs = Refs.ref(Collections.singleton(sstable)))
{ {
nextIndexKey = indexAvailable() ? ByteBufferUtil.readWithShortLength(indexFile) : null; nextIndexKey = indexAvailable() ? ByteBufferUtil.readWithShortLength(indexFile) : null;
if (indexAvailable()) if (indexAvailable())

View File

@ -42,6 +42,7 @@ import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
import org.apache.cassandra.io.sstable.format.SSTableReader; import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.Pair; import org.apache.cassandra.utils.Pair;
import org.apache.cassandra.utils.concurrent.Refs;
import static org.apache.cassandra.io.sstable.Downsampling.BASE_SAMPLING_LEVEL; import static org.apache.cassandra.io.sstable.Downsampling.BASE_SAMPLING_LEVEL;
@ -124,11 +125,14 @@ public class IndexSummaryRedistribution extends CompactionInfo.Holder
logger.trace("Index summaries for compacting SSTables are using {} MB of space", logger.trace("Index summaries for compacting SSTables are using {} MB of space",
(memoryPoolBytes - remainingBytes) / 1024.0 / 1024.0); (memoryPoolBytes - remainingBytes) / 1024.0 / 1024.0);
List<SSTableReader> newSSTables = adjustSamplingLevels(sstablesByHotness, transactions, totalReadsPerSec, remainingBytes); List<SSTableReader> newSSTables;
try (Refs<SSTableReader> refs = Refs.ref(sstablesByHotness))
for (LifecycleTransaction txn : transactions.values()) {
txn.finish(); newSSTables = adjustSamplingLevels(sstablesByHotness, transactions, totalReadsPerSec, remainingBytes);
for (LifecycleTransaction txn : transactions.values())
txn.finish();
}
total = 0; total = 0;
for (SSTableReader sstable : Iterables.concat(compacting, oldFormatSSTables, newSSTables)) for (SSTableReader sstable : Iterables.concat(compacting, oldFormatSSTables, newSSTables))
total += sstable.getIndexSummaryOffHeapSize(); total += sstable.getIndexSummaryOffHeapSize();