Github user bdeggleston commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r188786457
  
    --- Diff: 
src/java/org/apache/cassandra/cql3/statements/AlterKeyspaceStatement.java ---
    @@ -96,7 +98,35 @@ private void warnIfIncreasingRF(KeyspaceMetadata ksm, 
KeyspaceParams params)
                                                                                
                             StorageService.instance.getTokenMetadata(),
                                                                                
                             DatabaseDescriptor.getEndpointSnitch(),
                                                                                
                             params.replication.options);
    -        if (newStrategy.getReplicationFactor() > 
oldStrategy.getReplicationFactor())
    +
    +        validateTransientReplication(oldStrategy, newStrategy);
    +        warnIfIncreasingRF(oldStrategy, newStrategy);
    +    }
    +
    +    private void validateTransientReplication(AbstractReplicationStrategy 
oldStrategy, AbstractReplicationStrategy newStrategy)
    +    {
    +        if (oldStrategy.getReplicationFactor().trans == 0 && 
newStrategy.getReplicationFactor().trans > 0)
    +        {
    +            Keyspace ks = Keyspace.open(keyspace());
    +            for (ColumnFamilyStore cfs: ks.getColumnFamilyStores())
    +            {
    +                if (cfs.viewManager.hasViews())
    +                {
    +                    throw new ConfigurationException("Cannot use transient 
replication on keyspaces using materialized views");
    +                }
    +
    +                if (cfs.indexManager.hasIndexes())
    +                {
    +                    throw new ConfigurationException("Cannot use transient 
replication on keyspaces using secondary indexes");
    +                }
    +            }
    +
    +        }
    +    }
    +
    +    private void warnIfIncreasingRF(AbstractReplicationStrategy 
oldStrategy, AbstractReplicationStrategy newStrategy)
    +    {
    +        if (newStrategy.getReplicationFactor().full > 
oldStrategy.getReplicationFactor().full)
    --- End diff --
    
    Since replication factor changes don't really fall under any of the 
existing JIRAs, maybe we should disable all rf changes (except transient 
increases) as part of the initial refactor, and make a follow on jira to enable 
the other rf changes after the read and write path changes are in. Then we'll 
be able to reason about them in isolation, and will be better equipped to do 
the needed testing / tool updates.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to