Permalink
Browse files

first pass at upgrade steps

  • Loading branch information...
zznate
zznate committed Sep 30, 2011
1 parent 42701f1 commit 7619397d5bb9444fd451b52449fe346e09f2e1bb
View
@@ -170,6 +170,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.github.stephenc</groupId>
+ <artifactId>jamm</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
@@ -64,12 +64,6 @@ public ThriftCfDef(CfDef d) {
CFMetaDataDefaults.DEFAULT_MIN_COMPACTION_THRESHOLD : d.min_compaction_threshold;
maxCompactionThreshold = d.max_compaction_threshold == 0 ?
CFMetaDataDefaults.DEFAULT_MAX_COMPACTION_THRESHOLD : d.max_compaction_threshold;
- memtableOperationsInMillions = d.memtable_operations_in_millions == 0 ?
- CFMetaDataDefaults.DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS : d.memtable_operations_in_millions;
- memtableFlushAfterMins = d.memtable_flush_after_mins == 0 ?
- CFMetaDataDefaults.DEFAULT_MEMTABLE_LIFETIME_IN_MINS : d.memtable_flush_after_mins;
- memtableThroughputInMb = d.memtable_throughput_in_mb == 0 ?
- CFMetaDataDefaults.DEFAULT_MEMTABLE_THROUGHPUT_IN_MB : d.memtable_throughput_in_mb;
replicateOnWrite = d.replicate_on_write;
}
@@ -233,22 +227,22 @@ public CfDef toThrift() {
d.setComparator_type(comparatorType.getClassName() + comparatorTypeAlias);
d.setDefault_validation_class(defaultValidationClass);
d.setGc_grace_seconds(gcGraceSeconds);
- d.setId(id);
+ if ( id != 0)
+ d.setId(id);
+
d.setKey_cache_size(keyCacheSize);
d.setKey_cache_save_period_in_seconds(keyCacheSavePeriodInSeconds);
d.setKey_validation_class(keyValidationClass);
d.setMax_compaction_threshold(maxCompactionThreshold);
d.setMin_compaction_threshold(minCompactionThreshold);
d.setRead_repair_chance(readRepairChance);
- d.setRow_cache_size(rowCacheSize);
- d.setMemtable_operations_in_millions(memtableOperationsInMillions);
- d.setMemtable_throughput_in_mb(memtableThroughputInMb);
- d.setMemtable_flush_after_mins(memtableFlushAfterMins);
+ d.setRow_cache_size(rowCacheSize);
d.setReplicate_on_write(replicateOnWrite);
if (subComparatorType != null) {
d.setSubcomparator_type(subComparatorType.getClassName() + subComparatorTypeAlias);
}
+
return d;
}
@@ -58,8 +58,6 @@ commitlog_directory: tmp/var/lib/cassandra/commitlog
# saved caches
saved_caches_directory: tmp/var/lib/cassandra/saved_caches
-# Size to allow commitlog to grow to before creating a new segment
-commitlog_rotation_threshold_in_mb: 128
# commitlog_sync may be either "periodic" or "batch."
# When in batch mode, Cassandra won't ack writes until the commit log
@@ -162,10 +160,6 @@ snapshot_before_compaction: false
# lowest priority and that is our default.
# compaction_thread_priority: 1
-# The threshold size in megabytes the binary memtable must grow to,
-# before it's submitted for flushing to disk.
-binary_memtable_throughput_in_mb: 256
-
# Add column indexes to a row after its contents reach this size.
# Increase if your column values are large, or if you have a very large
# number of columns. The competing causes are, Cassandra has to
@@ -58,8 +58,6 @@ commitlog_directory: tmp/var/lib/cassandra/commitlog
# saved caches
saved_caches_directory: tmp/var/lib/cassandra/saved_caches
-# Size to allow commitlog to grow to before creating a new segment
-commitlog_rotation_threshold_in_mb: 128
# commitlog_sync may be either "periodic" or "batch."
# When in batch mode, Cassandra won't ack writes until the commit log
@@ -161,10 +159,6 @@ snapshot_before_compaction: false
# lowest priority and that is our default.
# compaction_thread_priority: 1
-# The threshold size in megabytes the binary memtable must grow to,
-# before it's submitted for flushing to disk.
-binary_memtable_throughput_in_mb: 256
-
# Add column indexes to a row after its contents reach this size.
# Increase if your column values are large, or if you have a very large
# number of columns. The competing causes are, Cassandra has to
View
17 pom.xml
@@ -89,12 +89,18 @@
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
- <version>0.8.3</version>
+ <version>1.0.0-rc1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.stephenc</groupId>
+ <artifactId>jamm</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-thrift</artifactId>
- <version>0.8.3</version>
+ <version>1.0.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
@@ -181,7 +187,12 @@
<artifactId>joda-time</artifactId>
<version>1.6.1</version>
</dependency>
-
+ <dependency>
+ <groupId>com.github.stephenc</groupId>
+ <artifactId>jamm</artifactId>
+ <version>0.2.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
View
@@ -96,6 +96,11 @@
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.github.stephenc</groupId>
+ <artifactId>jamm</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- OSGi deps -->
<dependency>
<groupId>org.osgi</groupId>
@@ -13,6 +13,7 @@
import org.apache.cassandra.config.ConfigurationException;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.config.KSMetaData;
+import org.apache.cassandra.config.Schema;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.AsciiType;
@@ -31,19 +32,17 @@
public class EmbeddedSchemaLoader {
public static void loadSchema() {
- try {
- for (KSMetaData ksm : schemaDefinition()) {
- for (CFMetaData cfm : ksm.cfMetaData().values())
- CFMetaData.map(cfm);
- DatabaseDescriptor.setTableDefinition(ksm, DatabaseDescriptor
- .getDefsVersion());
- }
- } catch (ConfigurationException e) {
- throw new RuntimeException(e);
+ try
+ {
+ Schema.instance.load(schemaDefinition(), Schema.instance.getVersion());
+ }
+ catch (ConfigurationException e)
+ {
+ throw new RuntimeException(e);
}
}
- public static Collection<KSMetaData> schemaDefinition() {
+ public static Collection<KSMetaData> schemaDefinition() throws ConfigurationException {
List<KSMetaData> schema = new ArrayList<KSMetaData>();
// A whole bucket of shorthand
@@ -117,13 +116,14 @@ private static CFMetaData superCFMD(String ksName, String cfName,
}
private static CFMetaData indexCFMD(String ksName, String cfName, final Boolean withIdxType)
+ throws ConfigurationException
{
return standardCFMD(ksName, cfName)
.columnMetadata(new HashMap<ByteBuffer, ColumnDefinition>()
{{
ByteBuffer cName = ByteBuffer.wrap("birthyear".getBytes(Charsets.UTF_8));
IndexType keys = withIdxType ? IndexType.KEYS : null;
- put(cName, new ColumnDefinition(cName, LongType.instance, keys, null));
+ put(cName, new ColumnDefinition(cName, LongType.instance, keys, null, "birthyear_index"));
}});
}
@@ -134,12 +134,14 @@ private static CFMetaData jdbcCFMD(String ksName, String cfName,
}
private static CFMetaData cqlTestCf(String ksName, String cfName,
- AbstractType comp) {
+ AbstractType comp)
+ throws ConfigurationException
+ {
return new CFMetaData(ksName, cfName, ColumnFamilyType.Standard, comp, null)
.keyValidator(UTF8Type.instance).columnMetadata(new HashMap<ByteBuffer, ColumnDefinition>()
{{
ByteBuffer cName = ByteBuffer.wrap("birthyear".getBytes(Charsets.UTF_8));
- put(cName, new ColumnDefinition(cName, LongType.instance, null, null));
+ put(cName, new ColumnDefinition(cName, LongType.instance, null, null, null));
}});
}
}

0 comments on commit 7619397

Please sign in to comment.