Merge branch 'cassandra-3.1' into trunk

This commit is contained in:
Aleksey Yeschenko 2015-11-23 20:24:33 +00:00
commit 2e8bb3a645
3 changed files with 23 additions and 0 deletions

View File

@ -69,6 +69,11 @@ public final class KeyspaceParams
return new KeyspaceParams(false, ReplicationParams.simple(replicationFactor));
}
public static KeyspaceParams nts(Object... args)
{
return new KeyspaceParams(true, ReplicationParams.nts(args));
}
public void validate(String name)
{
replication.validate(name);

View File

@ -51,6 +51,21 @@ public final class ReplicationParams
return new ReplicationParams(SimpleStrategy.class, ImmutableMap.of("replication_factor", Integer.toString(replicationFactor)));
}
static ReplicationParams nts(Object... args)
{
assert args.length % 2 == 0;
Map<String, String> options = new HashMap<>();
for (int i = 0; i < args.length; i += 2)
{
String dc = (String) args[i];
Integer rf = (Integer) args[i + 1];
options.put(dc, rf.toString());
}
return new ReplicationParams(NetworkTopologyStrategy.class, options);
}
public void validate(String name)
{
// Attempt to instantiate the ARS, which will throw a ConfigurationException if the options aren't valid.

View File

@ -245,6 +245,9 @@ public class LegacySchemaMigratorTest
+ "PRIMARY KEY((bar, baz), qux, quz) ) "
+ "WITH COMPACT STORAGE", ks_cql))));
// NTS keyspace
keyspaces.add(KeyspaceMetadata.create("nts", KeyspaceParams.nts("dc1", 1, "dc2", 2)));
keyspaces.add(keyspaceWithDroppedCollections());
keyspaces.add(keyspaceWithTriggers());
keyspaces.add(keyspaceWithUDTs());