Check if autocompaction should be disabled before enabling it during startup.

Patch by marcuse; reviewed by driftx for CASSANDRA-7187
This commit is contained in:
Marcus Eriksson 2014-05-07 18:39:49 +02:00
parent 16fd1a4a89
commit 0490abff4e
3 changed files with 12 additions and 8 deletions

View File

@ -3,6 +3,7 @@
* Starting threads in OutboundTcpConnectionPool constructor causes race conditions (CASSANDRA-7177)
* return all cpu values from BackgroundActivityMonitor.readAndCompute (CASSANDRA-7183)
* fix c* launch issues on Russian os's due to output of linux 'free' cmd (CASSANDRA-6162)
* Fix disabling autocompaction (CASSANDRA-7187)
2.0.8
* Correctly delete scheduled range xfers (CASSANDRA-7143)

View File

@ -87,13 +87,8 @@ public abstract class AbstractCompactionStrategy
tombstoneThreshold = optionValue == null ? DEFAULT_TOMBSTONE_THRESHOLD : Float.parseFloat(optionValue);
optionValue = options.get(TOMBSTONE_COMPACTION_INTERVAL_OPTION);
tombstoneCompactionInterval = optionValue == null ? DEFAULT_TOMBSTONE_COMPACTION_INTERVAL : Long.parseLong(optionValue);
optionValue = options.get(COMPACTION_ENABLED);
if (optionValue != null)
{
if (optionValue.equalsIgnoreCase("false"))
this.enabled = false;
}
if (!shouldBeEnabled())
this.disable();
}
catch (ConfigurationException e)
{
@ -376,4 +371,11 @@ public abstract class AbstractCompactionStrategy
uncheckedOptions.remove(COMPACTION_ENABLED);
return uncheckedOptions;
}
public boolean shouldBeEnabled()
{
String optionValue = options.get(COMPACTION_ENABLED);
return optionValue == null || Boolean.parseBoolean(optionValue);
}
}

View File

@ -332,7 +332,8 @@ public class CassandraDaemon
{
for (final ColumnFamilyStore store : cfs.concatWithIndexes())
{
store.enableAutoCompaction();
if (store.getCompactionStrategy().shouldBeEnabled())
store.enableAutoCompaction();
}
}
}