You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Marcus Eriksson (JIRA)" <ji...@apache.org> on 2014/05/27 10:33:01 UTC

[jira] [Resolved] (CASSANDRA-7290) Compaction strategy is not reloaded when compaction strategy options is updated

     [ https://issues.apache.org/jira/browse/CASSANDRA-7290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcus Eriksson resolved CASSANDRA-7290.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.2.17)
    Reproduced In: 2.0.7, 1.2.16  (was: 1.2.16, 2.0.7)

committed this separately:
{code}
-        this.options = options;
+        this.options = ImmutableMap.copyOf(options);
{code}

> Compaction strategy is not reloaded when compaction strategy options is updated
> -------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7290
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7290
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Paulo Motta
>             Fix For: 2.0.9
>
>
> The AbstractCompactionStrategy constructor receives an options map on its constructor:
> {code:java}
>     protected AbstractCompactionStrategy(ColumnFamilyStore cfs, Map<String, String> options)
>     {
>         assert cfs != null;
>         this.cfs = cfs;
>         this.options = options;
>     ...
> {code}
> This map is currently the same reference as CFMetadata.compactionStrategyOptions, so ColumnFamilyStore.reload() does not reload the compaction strategy when a compaction strategy option changes:
> {code:java}
>     private void maybeReloadCompactionStrategy()
>     {
>         // Check if there is a need for reloading
>         if (metadata.compactionStrategyClass.equals(compactionStrategy.getClass()) 
>             && metadata.compactionStrategyOptions.equals(compactionStrategy.options)) //metadata.compactionStrategyOptions == compactionStrategy.options, so compaction is never reloaded
>             return;
> {code}
> I spotted this in my test, when I tried changing the value of "unchecked_tombstone_compaction" from false to true and calling ColumnFamilyStore.reload() was not reloading the compaction strategy. I don't know if ColumnFamilyStore.reload() is only called during tests, or also whenever the schema changes. 
> In order to fix the bug, I made AbstractCompactionStrategy.options an ImmutableMap, so if CFMetadata.compactionStrategyOptions is updated, ColumnFamilyStore.maybeReloadCompactionStrategy will actually reload the compaction strategy:
> {code:java}
>     protected AbstractCompactionStrategy(ColumnFamilyStore cfs, Map<String, String> options)
>     {
>         assert cfs != null;
>         this.cfs = cfs;
>         this.options = ImmutableMap.copyOf(options);
>     ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)