DATACASS-198: Upgrade for Cassandra 2.1 Support
Task-Url: https://jira.spring.io/browse/DATACASS-198
This commit is contained in:
5
pom.xml
5
pom.xml
@@ -30,11 +30,12 @@
|
||||
<dist.id>spring-data-cassandra</dist.id>
|
||||
<springdata.commons>1.10.0.BUILD-SNAPSHOT</springdata.commons>
|
||||
<cassandra-unit.version>2.0.2.2</cassandra-unit.version>
|
||||
<cassandra-driver-dse>2.0.4</cassandra-driver-dse>
|
||||
<cassandra-driver-dse>2.1.4</cassandra-driver-dse>
|
||||
<el.version>1.0</el.version>
|
||||
<failsafe.version>2.16</failsafe.version>
|
||||
<jamm.version>0.2.5</jamm.version>
|
||||
<cassandra>2.0.9</cassandra>
|
||||
<cassandra>2.1.2</cassandra>
|
||||
<guava>16.0.1</guava>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>15.0</version>
|
||||
<version>${guava}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.datastax.driver.core.ColumnDefinitions;
|
||||
import com.datastax.driver.core.ColumnDefinitions.Definition;
|
||||
import com.datastax.driver.core.Host;
|
||||
import com.datastax.driver.core.PreparedStatement;
|
||||
import com.datastax.driver.core.ProtocolVersion;
|
||||
import com.datastax.driver.core.ResultSet;
|
||||
import com.datastax.driver.core.ResultSetFuture;
|
||||
import com.datastax.driver.core.Row;
|
||||
@@ -193,7 +194,8 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
/**
|
||||
* Blank constructor. You must wire in the Session before use.
|
||||
*/
|
||||
public CqlTemplate() {}
|
||||
public CqlTemplate() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used for a basic template configuration
|
||||
@@ -569,7 +571,7 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
if (cols.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return cols.getType(0).deserialize(row.getBytesUnsafe(0));
|
||||
return cols.getType(0).deserialize(row.getBytesUnsafe(0), ProtocolVersion.NEWEST_SUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,7 +588,7 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
|
||||
for (Definition def : cols.asList()) {
|
||||
String name = def.getName();
|
||||
map.put(name, def.getType().deserialize(row.getBytesUnsafe(name)));
|
||||
map.put(name, def.getType().deserialize(row.getBytesUnsafe(name), ProtocolVersion.NEWEST_SUPPORTED));
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
import com.datastax.driver.core.ColumnDefinitions;
|
||||
import com.datastax.driver.core.ColumnDefinitions.Definition;
|
||||
import com.datastax.driver.core.ProtocolVersion;
|
||||
import com.datastax.driver.core.Row;
|
||||
|
||||
public class RowToMapConverter implements Converter<Row, Map<String, Object>> {
|
||||
@@ -24,7 +25,10 @@ public class RowToMapConverter implements Converter<Row, Map<String, Object>> {
|
||||
for (Definition def : cols.asList()) {
|
||||
|
||||
String name = def.getName();
|
||||
map.put(name, row.isNull(name) ? null : def.getType().deserialize(row.getBytesUnsafe(name)));
|
||||
map.put(
|
||||
name,
|
||||
row.isNull(name) ? null : def.getType().deserialize(row.getBytesUnsafe(name),
|
||||
ProtocolVersion.NEWEST_SUPPORTED));
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
@@ -48,16 +48,12 @@ public enum TableOption implements Option {
|
||||
* @see {@link CompressionOption}
|
||||
*/
|
||||
COMPRESSION("compression", Map.class, true, false, false),
|
||||
/**
|
||||
* <code>replicate_on_write</code>
|
||||
*/
|
||||
REPLICATE_ON_WRITE("replicate_on_write", Boolean.class, true, false, true),
|
||||
/**
|
||||
* <code>caching</code>
|
||||
*
|
||||
* @see CachingOption
|
||||
*/
|
||||
CACHING("caching", CachingOption.class, true, false, true),
|
||||
CACHING("caching", Map.class, true, false, false),
|
||||
/**
|
||||
* <code>bloom_filter_fp_chance</code>
|
||||
*/
|
||||
@@ -81,57 +77,70 @@ public enum TableOption implements Option {
|
||||
this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesValue() {
|
||||
return delegate.takesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean escapesValue() {
|
||||
return delegate.escapesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean quotesValue() {
|
||||
return delegate.quotesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValue() {
|
||||
return delegate.requiresValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValue(Object value) {
|
||||
delegate.checkValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCoerceable(Object value) {
|
||||
return delegate.isCoerceable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Object value) {
|
||||
return delegate.toString(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Known caching options.
|
||||
* Known KeyCaching Options
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author David Webb
|
||||
* @since 1.2.0
|
||||
*
|
||||
*/
|
||||
public enum CachingOption {
|
||||
ALL("all"), KEYS_ONLY("keys_only"), ROWS_ONLY("rows_only"), NONE("none");
|
||||
public enum KeyCachingOption {
|
||||
|
||||
ALL("all"), NONE("none");
|
||||
|
||||
private String value;
|
||||
|
||||
private CachingOption(String value) {
|
||||
private KeyCachingOption(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -139,11 +148,83 @@ public enum TableOption implements Option {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Known caching options.
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author David Webb
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public enum CachingOption implements Option {
|
||||
|
||||
KEYS("keys", KeyCachingOption.class, true, false, true),
|
||||
|
||||
ROWS_PER_PARTITION("rows_per_partition", String.class, true, false, true);
|
||||
|
||||
private Option delegate;
|
||||
|
||||
private CachingOption(String name, Class<?> type, boolean requiresValue, boolean escapesValue, boolean quotesValue) {
|
||||
this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesValue() {
|
||||
return delegate.takesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean escapesValue() {
|
||||
return delegate.escapesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean quotesValue() {
|
||||
return delegate.quotesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValue() {
|
||||
return delegate.requiresValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValue(Object value) {
|
||||
delegate.checkValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCoerceable(Object value) {
|
||||
return delegate.isCoerceable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Object value) {
|
||||
return delegate.toString(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Known compaction options.
|
||||
*
|
||||
@@ -151,7 +232,7 @@ public enum TableOption implements Option {
|
||||
*/
|
||||
public enum CompactionOption implements Option {
|
||||
/**
|
||||
* <code>tombstone_threshold</code>
|
||||
* <code>class</code>
|
||||
*/
|
||||
CLASS("class", String.class, true, false, true),
|
||||
/**
|
||||
@@ -194,42 +275,52 @@ public enum TableOption implements Option {
|
||||
this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesValue() {
|
||||
return delegate.takesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean escapesValue() {
|
||||
return delegate.escapesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean quotesValue() {
|
||||
return delegate.quotesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValue() {
|
||||
return delegate.requiresValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValue(Object value) {
|
||||
delegate.checkValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCoerceable(Object value) {
|
||||
return delegate.isCoerceable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Object value) {
|
||||
return delegate.toString(value);
|
||||
}
|
||||
@@ -261,42 +352,52 @@ public enum TableOption implements Option {
|
||||
this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesValue() {
|
||||
return delegate.takesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean escapesValue() {
|
||||
return delegate.escapesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean quotesValue() {
|
||||
return delegate.quotesValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValue() {
|
||||
return delegate.requiresValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValue(Object value) {
|
||||
delegate.checkValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCoerceable(Object value) {
|
||||
return delegate.isCoerceable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Object value) {
|
||||
return delegate.toString(value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,8 +21,6 @@ import java.util.UUID;
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -36,7 +34,6 @@ import com.datastax.driver.core.Session;
|
||||
* Abstract base integration test class that starts an embedded Cassandra instance.
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class AbstractEmbeddedCassandraIntegrationTest {
|
||||
|
||||
@@ -55,11 +52,12 @@ public class AbstractEmbeddedCassandraIntegrationTest {
|
||||
/**
|
||||
* The session connected to the system keyspace.
|
||||
*/
|
||||
protected Session system;
|
||||
protected static Session system;
|
||||
|
||||
/**
|
||||
* The {@link Cluster} that'session connected to Cassandra.
|
||||
* The {@link Cluster} that's connected to Cassandra.
|
||||
*/
|
||||
protected Cluster cluster;
|
||||
protected static Cluster cluster;
|
||||
|
||||
public static String randomKeyspaceName() {
|
||||
return Utils.randomKeyspaceName();
|
||||
@@ -76,17 +74,22 @@ public class AbstractEmbeddedCassandraIntegrationTest {
|
||||
return Cluster.builder().addContactPoint(CASSANDRA_HOST).withPort(CASSANDRA_NATIVE_PORT).build();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void connect() {
|
||||
/**
|
||||
* Ensures that the cluster is created and that the session {@link #SYSTEM} is connected to it.
|
||||
*/
|
||||
public static void ensureClusterConnection() {
|
||||
|
||||
this.cluster = cluster();
|
||||
this.system = cluster.connect();
|
||||
// check cluster
|
||||
if (cluster == null) {
|
||||
cluster = cluster();
|
||||
}
|
||||
|
||||
if (system == null) {
|
||||
system = cluster.connect();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void disconnect() {
|
||||
|
||||
this.system.close();
|
||||
this.cluster.close();
|
||||
public AbstractEmbeddedCassandraIntegrationTest() {
|
||||
ensureClusterConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,23 +93,23 @@ public class CqlTableSpecificationAssertions {
|
||||
|
||||
switch (tableOption) {
|
||||
|
||||
case BLOOM_FILTER_FP_CHANCE:
|
||||
case READ_REPAIR_CHANCE:
|
||||
case DCLOCAL_READ_REPAIR_CHANCE:
|
||||
assertEquals((Double) expected, (Double) actual, DELTA);
|
||||
return;
|
||||
case BLOOM_FILTER_FP_CHANCE:
|
||||
case READ_REPAIR_CHANCE:
|
||||
case DCLOCAL_READ_REPAIR_CHANCE:
|
||||
assertEquals((Double) expected, (Double) actual, DELTA);
|
||||
return;
|
||||
|
||||
case CACHING:
|
||||
assertEquals(((String) expected).toUpperCase(), ((String) actual).toUpperCase());
|
||||
return;
|
||||
case CACHING:
|
||||
assertCaching((Map<String, Object>) expected, (Map<String, String>) actual);
|
||||
return;
|
||||
|
||||
case COMPACTION:
|
||||
assertCompaction((Map<String, Object>) expected, (Map<String, String>) actual);
|
||||
return;
|
||||
case COMPACTION:
|
||||
assertCompaction((Map<String, Object>) expected, (Map<String, String>) actual);
|
||||
return;
|
||||
|
||||
case COMPRESSION:
|
||||
assertCompression((Map<String, Object>) expected, (Map<String, String>) actual);
|
||||
return;
|
||||
case COMPRESSION:
|
||||
assertCompression((Map<String, Object>) expected, (Map<String, String>) actual);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(actual.getClass().getName());
|
||||
@@ -118,6 +118,10 @@ public class CqlTableSpecificationAssertions {
|
||||
tableOption.quotesValue() && !(actual instanceof CharSequence) ? CqlStringUtils.singleQuote(actual) : actual);
|
||||
}
|
||||
|
||||
public static void assertCaching(Map<String, Object> expected, Map<String, String> actual) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public static void assertCompaction(Map<String, Object> expected, Map<String, String> actual) {
|
||||
// TODO
|
||||
}
|
||||
@@ -137,26 +141,24 @@ public class CqlTableSpecificationAssertions {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getOptionFor(TableOption option, Class<?> type, Options options) {
|
||||
switch (option) {
|
||||
case BLOOM_FILTER_FP_CHANCE:
|
||||
return (T) (Double) options.getBloomFilterFalsePositiveChance();
|
||||
case CACHING:
|
||||
return (T) CqlStringUtils.singleQuote(options.getCaching());
|
||||
case COMMENT:
|
||||
return (T) CqlStringUtils.singleQuote(options.getComment());
|
||||
case COMPACTION:
|
||||
return (T) options.getCompaction();
|
||||
case COMPACT_STORAGE:
|
||||
throw new Error(); // TODO: figure out
|
||||
case COMPRESSION:
|
||||
return (T) options.getCompression();
|
||||
case DCLOCAL_READ_REPAIR_CHANCE:
|
||||
return (T) (Double) options.getLocalReadRepairChance();
|
||||
case GC_GRACE_SECONDS:
|
||||
return (T) new Long(options.getGcGraceInSeconds());
|
||||
case READ_REPAIR_CHANCE:
|
||||
return (T) (Double) options.getReadRepairChance();
|
||||
case REPLICATE_ON_WRITE:
|
||||
return (T) (Boolean) options.getReplicateOnWrite();
|
||||
case BLOOM_FILTER_FP_CHANCE:
|
||||
return (T) (Double) options.getBloomFilterFalsePositiveChance();
|
||||
case CACHING:
|
||||
return (T) options.getCaching();
|
||||
case COMMENT:
|
||||
return (T) CqlStringUtils.singleQuote(options.getComment());
|
||||
case COMPACTION:
|
||||
return (T) options.getCompaction();
|
||||
case COMPACT_STORAGE:
|
||||
throw new Error(); // TODO: figure out
|
||||
case COMPRESSION:
|
||||
return (T) options.getCompression();
|
||||
case DCLOCAL_READ_REPAIR_CHANCE:
|
||||
return (T) (Double) options.getLocalReadRepairChance();
|
||||
case GC_GRACE_SECONDS:
|
||||
return (T) new Long(options.getGcGraceInSeconds());
|
||||
case READ_REPAIR_CHANCE:
|
||||
return (T) (Double) options.getReadRepairChance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class BookListener extends TestListener implements AsynchronousQueryListe
|
||||
|
||||
@Override
|
||||
public void onQueryComplete(ResultSetFuture rsf) {
|
||||
countDown();
|
||||
|
||||
Row row;
|
||||
try {
|
||||
@@ -49,6 +48,8 @@ public class BookListener extends TestListener implements AsynchronousQueryListe
|
||||
book.setPages(row.getInt("pages"));
|
||||
|
||||
done = true;
|
||||
|
||||
countDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ class BasicListener extends TestListener implements AsynchronousQueryListener {
|
||||
|
||||
@Override
|
||||
public void onQueryComplete(ResultSetFuture rsf) {
|
||||
countDown();
|
||||
this.rsf = rsf;
|
||||
countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ public class MapListener extends TestListener implements QueryForMapListener {
|
||||
|
||||
@Override
|
||||
public void onQueryComplete(Map<String, Object> results) {
|
||||
countDown();
|
||||
this.result = results;
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(Exception x) {
|
||||
countDown();
|
||||
this.exception = x;
|
||||
countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ class ObjectListener<T> extends TestListener implements QueryForObjectListener<T
|
||||
|
||||
@Override
|
||||
public void onQueryComplete(T result) {
|
||||
countDown();
|
||||
this.result = result;
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(Exception x) {
|
||||
countDown();
|
||||
this.exception = x;
|
||||
countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.cassandra.core.keyspace.TableOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CachingOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CompactionOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CompressionOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.KeyCachingOption;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@@ -57,7 +58,8 @@ public class AlterTableCqlGeneratorTests {
|
||||
* Convenient base class that other test classes can use so as not to repeat the generics declarations.
|
||||
*/
|
||||
public static abstract class AlterTableTest extends
|
||||
TableOperationCqlGeneratorTest<AlterTableSpecification, AlterTableCqlGenerator> {}
|
||||
TableOperationCqlGeneratorTest<AlterTableSpecification, AlterTableCqlGenerator> {
|
||||
}
|
||||
|
||||
public static class BasicTest extends AlterTableTest {
|
||||
|
||||
@@ -112,6 +114,7 @@ public class AlterTableCqlGeneratorTests {
|
||||
public String comment = "This is My Table";
|
||||
public Map<Option, Object> compactionMap = new LinkedHashMap<Option, Object>();
|
||||
public Map<Option, Object> compressionMap = new LinkedHashMap<Option, Object>();
|
||||
public Map<Option, Object> cachingMap = new LinkedHashMap<Option, Object>();
|
||||
|
||||
@Override
|
||||
public AlterTableSpecification specification() {
|
||||
@@ -123,6 +126,9 @@ public class AlterTableCqlGeneratorTests {
|
||||
compressionMap.put(CompressionOption.SSTABLE_COMPRESSION, "SnappyCompressor");
|
||||
compressionMap.put(CompressionOption.CHUNK_LENGTH_KB, 128);
|
||||
compressionMap.put(CompressionOption.CRC_CHECK_CHANCE, 0.75);
|
||||
// Caching
|
||||
cachingMap.put(CachingOption.KEYS, KeyCachingOption.ALL);
|
||||
cachingMap.put(CachingOption.ROWS_PER_PARTITION, "10");
|
||||
|
||||
return AlterTableSpecification
|
||||
.alterTable()
|
||||
@@ -130,8 +136,8 @@ public class AlterTableCqlGeneratorTests {
|
||||
// .with(TableOption.COMPACT_STORAGE)
|
||||
.with(TableOption.READ_REPAIR_CHANCE, readRepairChance).with(TableOption.COMPACTION, compactionMap)
|
||||
.with(TableOption.COMPRESSION, compressionMap).with(TableOption.BLOOM_FILTER_FP_CHANCE, bloomFilterFpChance)
|
||||
.with(TableOption.CACHING, CachingOption.KEYS_ONLY).with(TableOption.REPLICATE_ON_WRITE, replcateOnWrite)
|
||||
.with(TableOption.COMMENT, comment).with(TableOption.DCLOCAL_READ_REPAIR_CHANCE, dcLocalReadRepairChance)
|
||||
.with(TableOption.CACHING, cachingMap).with(TableOption.COMMENT, comment)
|
||||
.with(TableOption.DCLOCAL_READ_REPAIR_CHANCE, dcLocalReadRepairChance)
|
||||
.with(TableOption.GC_GRACE_SECONDS, gcGraceSeconds);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.cassandra.core.keyspace.TableOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CachingOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CompactionOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.CompressionOption;
|
||||
import org.springframework.cassandra.core.keyspace.TableOption.KeyCachingOption;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@@ -220,6 +221,7 @@ public class CreateTableCqlGeneratorTests {
|
||||
public String comment = "This is My Table";
|
||||
public Map<Option, Object> compactionMap = new LinkedHashMap<Option, Object>();
|
||||
public Map<Option, Object> compressionMap = new LinkedHashMap<Option, Object>();
|
||||
public Map<Option, Object> cachingMap = new LinkedHashMap<Option, Object>();
|
||||
|
||||
@Override
|
||||
public CreateTableSpecification specification() {
|
||||
@@ -231,13 +233,15 @@ public class CreateTableCqlGeneratorTests {
|
||||
compressionMap.put(CompressionOption.SSTABLE_COMPRESSION, "SnappyCompressor");
|
||||
compressionMap.put(CompressionOption.CHUNK_LENGTH_KB, 128);
|
||||
compressionMap.put(CompressionOption.CRC_CHECK_CHANCE, 0.75);
|
||||
// Caching
|
||||
cachingMap.put(CachingOption.KEYS, KeyCachingOption.ALL);
|
||||
cachingMap.put(CachingOption.ROWS_PER_PARTITION, "NONE");
|
||||
|
||||
return CreateTableSpecification.createTable().name(name).partitionKeyColumn(partitionKey0, partitionKeyType0)
|
||||
.partitionKeyColumn(partitionKey1, partitionKeyType1).column(column1, columnType1)
|
||||
.with(TableOption.COMPACT_STORAGE).with(TableOption.READ_REPAIR_CHANCE, readRepairChance)
|
||||
.with(TableOption.COMPACTION, compactionMap).with(TableOption.COMPRESSION, compressionMap)
|
||||
.with(TableOption.BLOOM_FILTER_FP_CHANCE, bloomFilterFpChance)
|
||||
.with(TableOption.CACHING, CachingOption.KEYS_ONLY).with(TableOption.REPLICATE_ON_WRITE, replcateOnWrite)
|
||||
.with(TableOption.BLOOM_FILTER_FP_CHANCE, bloomFilterFpChance).with(TableOption.CACHING, cachingMap)
|
||||
.with(TableOption.COMMENT, comment).with(TableOption.DCLOCAL_READ_REPAIR_CHANCE, dcLocalReadRepairChance)
|
||||
.with(TableOption.GC_GRACE_SECONDS, gcGraceSeconds);
|
||||
}
|
||||
@@ -257,8 +261,6 @@ public class CreateTableCqlGeneratorTests {
|
||||
assertDoubleOption(TableOption.READ_REPAIR_CHANCE.getName(), readRepairChance, cql);
|
||||
assertDoubleOption(TableOption.DCLOCAL_READ_REPAIR_CHANCE.getName(), dcLocalReadRepairChance, cql);
|
||||
assertDoubleOption(TableOption.BLOOM_FILTER_FP_CHANCE.getName(), bloomFilterFpChance, cql);
|
||||
assertStringOption(TableOption.CACHING.getName(), CachingOption.KEYS_ONLY.getValue(), cql);
|
||||
assertStringOption(TableOption.REPLICATE_ON_WRITE.getName(), replcateOnWrite.toString(), cql);
|
||||
assertStringOption(TableOption.COMMENT.getName(), comment, cql);
|
||||
assertLongOption(TableOption.GC_GRACE_SECONDS.getName(), gcGraceSeconds, cql);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="error" />
|
||||
<logger name="org.springframework.cassandra" level="error" />
|
||||
<logger name="org.springframework.cassandra" level="DEBUG" />
|
||||
<logger name="com.datastax" level="error" />
|
||||
|
||||
<root level="error">
|
||||
|
||||
@@ -245,11 +245,6 @@ concurrent_writes: 32
|
||||
# By default this will be set to the amount of data directories defined.
|
||||
#memtable_flush_writers: 1
|
||||
|
||||
# the number of full memtables to allow pending flush, that is,
|
||||
# waiting for a writer thread. At a minimum, this should be set to
|
||||
# the maximum number of secondary indexes created on a single CF.
|
||||
memtable_flush_queue_size: 4
|
||||
|
||||
# Whether to, when doing sequential writing, fsync() at intervals in
|
||||
# order to force the operating system to flush the dirty
|
||||
# buffers. Enable this to avoid sudden dirty buffer flushing from
|
||||
@@ -395,11 +390,6 @@ auto_snapshot: true
|
||||
# that wastefully either.
|
||||
column_index_size_in_kb: 64
|
||||
|
||||
# Size limit for rows being compacted in memory. Larger rows will spill
|
||||
# over to disk and use a slower two-pass compaction process. A message
|
||||
# will be logged specifying the row key.
|
||||
in_memory_compaction_limit_in_mb: 64
|
||||
|
||||
# Number of simultaneous compactions to allow, NOT including
|
||||
# validation "compactions" for anti-entropy repair. Simultaneous
|
||||
# compactions can help preserve read performance in a mixed read/write
|
||||
@@ -413,13 +403,6 @@ in_memory_compaction_limit_in_mb: 64
|
||||
# Uncomment to make compaction mono-threaded, the pre-0.8 default.
|
||||
#concurrent_compactors: 1
|
||||
|
||||
# Multi-threaded compaction. When enabled, each compaction will use
|
||||
# up to one thread per core, plus one thread per sstable being merged.
|
||||
# This is usually only useful for SSD-based hardware: otherwise,
|
||||
# your concern is usually to get compaction to do LESS i/o (see:
|
||||
# compaction_throughput_mb_per_sec), not more.
|
||||
multithreaded_compaction: false
|
||||
|
||||
# Throttles compaction to the given total throughput across the entire
|
||||
# system. The faster you insert data, the faster you need to compact in
|
||||
# order to keep the sstable count down, but in general, setting this to
|
||||
@@ -428,11 +411,6 @@ multithreaded_compaction: false
|
||||
# of compaction, including validation compaction.
|
||||
compaction_throughput_mb_per_sec: 16
|
||||
|
||||
# Track cached row keys during compaction, and re-cache their new
|
||||
# positions in the compacted sstable. Disable if you use really large
|
||||
# key caches.
|
||||
compaction_preheat_key_cache: true
|
||||
|
||||
# Throttles all outbound streaming file transfers on this node to the
|
||||
# given total throughput in Mbps. This is necessary because Cassandra does
|
||||
# mostly sequential IO when streaming data during bootstrap or repair, which
|
||||
|
||||
@@ -246,11 +246,6 @@ concurrent_writes: 32
|
||||
# By default this will be set to the amount of data directories defined.
|
||||
#memtable_flush_writers: 1
|
||||
|
||||
# the number of full memtables to allow pending flush, that is,
|
||||
# waiting for a writer thread. At a minimum, this should be set to
|
||||
# the maximum number of secondary indexes created on a single CF.
|
||||
memtable_flush_queue_size: 4
|
||||
|
||||
# Whether to, when doing sequential writing, fsync() at intervals in
|
||||
# order to force the operating system to flush the dirty
|
||||
# buffers. Enable this to avoid sudden dirty buffer flushing from
|
||||
@@ -396,11 +391,6 @@ auto_snapshot: true
|
||||
# that wastefully either.
|
||||
column_index_size_in_kb: 64
|
||||
|
||||
# Size limit for rows being compacted in memory. Larger rows will spill
|
||||
# over to disk and use a slower two-pass compaction process. A message
|
||||
# will be logged specifying the row key.
|
||||
in_memory_compaction_limit_in_mb: 64
|
||||
|
||||
# Number of simultaneous compactions to allow, NOT including
|
||||
# validation "compactions" for anti-entropy repair. Simultaneous
|
||||
# compactions can help preserve read performance in a mixed read/write
|
||||
@@ -414,13 +404,6 @@ in_memory_compaction_limit_in_mb: 64
|
||||
# Uncomment to make compaction mono-threaded, the pre-0.8 default.
|
||||
#concurrent_compactors: 1
|
||||
|
||||
# Multi-threaded compaction. When enabled, each compaction will use
|
||||
# up to one thread per core, plus one thread per sstable being merged.
|
||||
# This is usually only useful for SSD-based hardware: otherwise,
|
||||
# your concern is usually to get compaction to do LESS i/o (see:
|
||||
# compaction_throughput_mb_per_sec), not more.
|
||||
multithreaded_compaction: false
|
||||
|
||||
# Throttles compaction to the given total throughput across the entire
|
||||
# system. The faster you insert data, the faster you need to compact in
|
||||
# order to keep the sstable count down, but in general, setting this to
|
||||
@@ -429,11 +412,6 @@ multithreaded_compaction: false
|
||||
# of compaction, including validation compaction.
|
||||
compaction_throughput_mb_per_sec: 16
|
||||
|
||||
# Track cached row keys during compaction, and re-cache their new
|
||||
# positions in the compacted sstable. Disable if you use really large
|
||||
# key caches.
|
||||
compaction_preheat_key_cache: true
|
||||
|
||||
# Throttles all outbound streaming file transfers on this node to the
|
||||
# given total throughput in Mbps. This is necessary because Cassandra does
|
||||
# mostly sequential IO when streaming data during bootstrap or repair, which
|
||||
|
||||
Reference in New Issue
Block a user