Warn when an extra-large partition is compacted, CASSANDRA-9643

This commit is contained in:
Stefania Alborghetti 2015-06-30 17:12:56 +08:00 committed by Jonathan Ellis
parent 247bed6200
commit fae9d3beac
5 changed files with 19 additions and 1 deletions

View File

@ -13,6 +13,7 @@
* Add support for selectively varint encoding fields (CASSANDRA-9499)
2.2.0-rc2
* Warn when an extra-large partition is compacted (CASSANDRA-9643)
* (cqlsh) Allow setting the initial connection timeout (CASSANDRA-9601)
* BulkLoader has --transport-factory option but does not use it (CASSANDRA-9675)
* Allow JMX over SSL directly from nodetool (CASSANDRA-9090)

View File

@ -643,6 +643,9 @@ batch_size_fail_threshold_in_kb: 50
# of compaction, including validation compaction.
compaction_throughput_mb_per_sec: 16
# Log a warning when compacting partitions larger than this value
compaction_large_partition_warning_threshold_mb: 100
# When compacting, the replacement sstable(s) can be opened before they
# are completely written, and used in place of the prior sstables for
# any range that has been written. This helps to smoothly transfer reads

View File

@ -147,6 +147,7 @@ public class Config
public volatile int batch_size_fail_threshold_in_kb = 50;
public Integer concurrent_compactors;
public volatile Integer compaction_throughput_mb_per_sec = 16;
public volatile Integer compaction_large_partition_warning_threshold_mb = 100;
public Integer max_streaming_retries = 3;

View File

@ -1059,6 +1059,8 @@ public class DatabaseDescriptor
conf.compaction_throughput_mb_per_sec = value;
}
public static int getCompactionLargePartitionWarningThreshold() { return conf.compaction_large_partition_warning_threshold_mb * 1024 * 1024; }
public static boolean getDisableSTCSInL0()
{
return Boolean.getBoolean("cassandra.disable_stcs_in_l0");

View File

@ -151,7 +151,9 @@ public class BigTableWriter extends SSTableWriter
RowIndexEntry entry = RowIndexEntry.create(startPosition, iterator.partitionLevelDeletion(), index);
long endPosition = dataFile.getFilePointer();
metadataCollector.addPartitionSizeInBytes(endPosition - startPosition);
long rowSize = endPosition - startPosition;
maybeLogLargePartitionWarning(key, rowSize);
metadataCollector.addPartitionSizeInBytes(rowSize);
afterAppend(key, endPosition, entry);
return entry;
}
@ -161,6 +163,15 @@ public class BigTableWriter extends SSTableWriter
}
}
private void maybeLogLargePartitionWarning(DecoratedKey key, long rowSize)
{
if (rowSize > DatabaseDescriptor.getCompactionLargePartitionWarningThreshold())
{
String keyString = metadata.getKeyValidator().getString(key.getKey());
logger.warn("Compacting large partition {}/{}:{} ({} bytes)", metadata.ksName, metadata.cfName, keyString, rowSize);
}
}
private static class StatsCollector extends WrappingUnfilteredRowIterator
{
private int cellCount;