Merge branch 'cassandra-3.11' into trunk

This commit is contained in:
Sylvain Lebresne 2020-08-17 11:39:24 +02:00
commit efce6b39fb
5 changed files with 1 additions and 43 deletions

View File

@ -12,6 +12,7 @@ Merged from 3.11:
* stop_paranoid disk failure policy is ignored on CorruptSSTableException after node is up (CASSANDRA-15191)
* Frozen RawTuple is not annotated with frozen in the toString method (CASSANDRA-15857)
Merged from 3.0:
* Remove broken 'defrag-on-read' optimization (CASSANDRA-15432)
* Check for endpoint collision with hibernating nodes (CASSANDRA-14599)
* Operational improvements and hardening for replica filtering protection (CASSANDRA-15907)
* Fix empty/null json string representation (CASSANDRA-15896)

View File

@ -28,7 +28,6 @@ import com.google.common.collect.Sets;
import org.apache.cassandra.cache.IRowCacheEntry;
import org.apache.cassandra.cache.RowCacheKey;
import org.apache.cassandra.cache.RowCacheSentinel;
import org.apache.cassandra.concurrent.Stage;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.filter.*;
import org.apache.cassandra.db.lifecycle.*;
@ -817,7 +816,6 @@ public class SinglePartitionReadCommand extends ReadCommand implements SinglePar
/* add the SSTables on disk */
Collections.sort(view.sstables, SSTableReader.maxTimestampDescending);
boolean onlyUnrepaired = true;
// read sorted sstables
SSTableReadMetricsCollector metricsCollector = new SSTableReadMetricsCollector();
for (SSTableReader sstable : view.sstables)
@ -889,9 +887,6 @@ public class SinglePartitionReadCommand extends ReadCommand implements SinglePar
if (iter.isEmpty())
continue;
if (sstable.isRepaired())
onlyUnrepaired = false;
result = add(
RTBoundValidator.validate(iter, RTBoundValidator.Stage.SSTABLE, false),
result,
@ -910,26 +905,6 @@ public class SinglePartitionReadCommand extends ReadCommand implements SinglePar
cfs.metric.topReadPartitionFrequency.addSample(key.getKey(), 1);
StorageHook.instance.reportRead(cfs.metadata.id, partitionKey());
// "hoist up" the requested data into a more recent sstable
if (metricsCollector.getMergedSSTables() > cfs.getMinimumCompactionThreshold()
&& onlyUnrepaired
&& !cfs.isAutoCompactionDisabled()
&& cfs.getCompactionStrategyManager().shouldDefragment())
{
// !!WARNING!! if we stop copying our data to a heap-managed object,
// we will need to track the lifetime of this mutation as well
Tracing.trace("Defragmenting requested data");
try (UnfilteredRowIterator iter = result.unfilteredIterator(columnFilter(), Slices.ALL, false))
{
final Mutation mutation = new Mutation(PartitionUpdate.fromIterator(iter, columnFilter()));
Stage.MUTATION.execute(() -> {
// skipping commitlog and index updates is fine since we're just de-fragmenting existing data
Keyspace.open(mutation.getKeyspaceName()).apply(mutation, false, false);
});
}
}
return result.unfilteredIterator(columnFilter(), Slices.ALL, clusteringIndexFilter().isReversed());
}

View File

@ -252,11 +252,6 @@ public abstract class AbstractCompactionStrategy
return new ScannerList(scanners);
}
public boolean shouldDefragment()
{
return false;
}
public String getName()
{
return getClass().getSimpleName();

View File

@ -134,7 +134,6 @@ public class CompactionStrategyManager implements INotificationConsumer
we will use the new compaction parameters.
*/
private volatile CompactionParams schemaCompactionParams;
private boolean shouldDefragment;
private boolean supportsEarlyOpen;
private int fanout;
@ -309,7 +308,6 @@ public class CompactionStrategyManager implements INotificationConsumer
compactionStrategyFor(sstable).addSSTable(sstable);
}
holders.forEach(AbstractStrategyHolder::startup);
shouldDefragment = repaired.first().shouldDefragment();
supportsEarlyOpen = repaired.first().supportsEarlyOpen();
fanout = (repaired.first() instanceof LeveledCompactionStrategy) ? ((LeveledCompactionStrategy) repaired.first()).getLevelFanoutSize() : LeveledCompactionStrategy.DEFAULT_LEVEL_FANOUT_SIZE;
}
@ -600,11 +598,6 @@ public class CompactionStrategyManager implements INotificationConsumer
return res;
}
public boolean shouldDefragment()
{
return shouldDefragment;
}
private void handleFlushNotification(Iterable<SSTableReader> added)
{
// If reloaded, SSTables will be placed in their correct locations

View File

@ -323,12 +323,6 @@ public class SizeTieredCompactionStrategy extends AbstractCompactionStrategy
return uncheckedOptions;
}
@Override
public boolean shouldDefragment()
{
return true;
}
@Override
public synchronized void addSSTable(SSTableReader added)
{