merge from 1.0

This commit is contained in:
Jonathan Ellis 2012-04-11 09:05:33 -05:00
commit c14e266eb3
11 changed files with 69 additions and 109 deletions

View File

@ -13,8 +13,11 @@
(CASSANDRA-4128)
* Move CfDef and KsDef validation out of thrift (CASSANDRA-4037)
Merged from 1.0:
* add auto_snapshot option allowing disabling snapshot before drop/truncate
(CASSANDRA-3710)
* allow short snitch names (CASSANDRA-4130)
1.1-beta2
* rename loaded sstables to avoid conflicts with local snapshots
(CASSANDRA-3967)

View File

@ -655,7 +655,7 @@
The build target builds all the .class files
-->
<target name="build"
depends="maven-ant-tasks-retrieve-build,avro-generate,build-subprojects,build-project" description="Compile Cassandra classes"/>
depends="maven-ant-tasks-retrieve-build,avro-generate,build-subprojects,build-project,stress-build" description="Compile Cassandra classes"/>
<target name="build-subprojects" description="Compile Cassandra contrib projects"/>
<target name="codecoverage" depends="cobertura-instrument,test,cobertura-report" description="Create code coverage report"/>
@ -684,12 +684,34 @@
<antcall target="createVersionPropFile"/>
</target>
<!-- Stress build file -->
<property name="stress.build.src" value="${basedir}/tools/stress/src" />
<property name="stress.build.classes" value="${build.classes}/stress" />
<property name="stress.manifest" value="${basedir}/tools/stress/MANIFEST.MF" />
<path id="cassandra.classes">
<pathelement location="${basedir}/build/classes/main" />
<pathelement location="${basedir}/build/classes/thrift" />
</path>
<target name="stress-build">
<mkdir dir="${stress.build.classes}" />
<javac destdir="${stress.build.classes}" includeantruntime="true">
<src path="${stress.build.src}" />
<classpath>
<path refid="cassandra.classes" />
<path>
<fileset dir="${build.lib}">
<include name="**/*.jar" />
</fileset>
</path>
</classpath>
</javac>
</target>
<!--
The jar target makes cassandra.jar output.
-->
<target name="jar"
depends="maven-declare-dependencies,build, build-test"
depends="maven-declare-dependencies,build, build-test, stress-build"
description="Assemble Cassandra JAR files">
<mkdir dir="${build.classes.main}/META-INF" />
<mkdir dir="${build.classes.thrift}/META-INF" />
@ -751,6 +773,20 @@
<attribute name="Implementation-Vendor" value="Apache"/>
</manifest>
</jar>
<!-- Stress jar -->
<manifest file="${stress.manifest}">
<attribute name="Built-By" value="Pavel Yaskevich"/>
<attribute name="Main-Class" value="org.apache.cassandra.stress.Stress"/>
</manifest>
<mkdir dir="${stress.build.classes}/META-INF" />
<mkdir dir="${build.dir}/tools/stress" />
<jar destfile="${build.dir}/tools/stress/stress.jar" manifest="${stress.manifest}">
<fileset dir="${stress.build.classes}"/>
<fileset dir="${basedir}/build/classes/main" />
<fileset dir="${basedir}/build/classes/thrift" />
<zipgroupfileset dir="${build.lib}" includes="*.jar" />
</jar>
</target>
<!--
@ -862,7 +898,14 @@
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/tools/stress">
<fileset dir="${basedir}/tools/stress">
<include name="bin/**" />
</fileset>
<fileset dir="${build.dir}/tools/stress/">
<include name="*.jar" />
</fileset>
</copy>
<artifact:writepom pomRefId="dist-pom"
file="${build.dir}/${final.name}-dist.pom"/>
<tar compression="gzip" longfile="gnu"

View File

@ -326,6 +326,12 @@ incremental_backups: false
# is a data format change.
snapshot_before_compaction: false
# Whether or not a snapshot is taken of the data before keyspace truncation
# or dropping of column families. The STRONGLY advised default of true
# should be used to provide data safety. If you set this flag to false, you will
# lose data on truncation or drop.
auto_snapshot: true
# 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 File

@ -78,6 +78,7 @@ public class Config
public Integer thrift_max_message_length_in_mb = 16;
public Integer thrift_framed_transport_size_in_mb = 15;
public Boolean snapshot_before_compaction = false;
public Boolean auto_snapshot = true;
/* if the size of columns or super-columns are more than this, indexing will kick in */
public Integer column_index_size_in_kb = 64;

View File

@ -871,6 +871,10 @@ public class DatabaseDescriptor
return conf.snapshot_before_compaction;
}
public static boolean isAutoSnapshot() {
return conf.auto_snapshot;
}
public static boolean isAutoBootstrap()
{
return conf.auto_bootstrap;

View File

@ -1683,7 +1683,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
throw new AssertionError(e);
}
long truncatedAt = System.currentTimeMillis();
snapshot(Table.getTimestampedSnapshotName(columnFamily));
if (DatabaseDescriptor.isAutoSnapshot())
snapshot(Table.getTimestampedSnapshotName(columnFamily));
return CompactionManager.instance.submitTruncate(this, truncatedAt);
}

View File

@ -482,7 +482,8 @@ public class DefsTable
if (!StorageService.instance.isClientMode())
{
cfs.snapshot(snapshotName);
if (DatabaseDescriptor.isAutoSnapshot())
cfs.snapshot(snapshotName);
Table.open(ksm.name).dropCf(cfm.cfId);
}
}
@ -507,7 +508,8 @@ public class DefsTable
if (!StorageService.instance.isClientMode())
{
cfs.snapshot(Table.getTimestampedSnapshotName(cfs.columnFamily));
if (DatabaseDescriptor.isAutoSnapshot())
cfs.snapshot(Table.getTimestampedSnapshotName(cfs.columnFamily));
Table.open(ksm.name).dropCf(cfm.cfId);
}
}

View File

@ -17,21 +17,7 @@
# limitations under the License.
if [ "x$CLASSPATH" = "x" ]; then
# Cassandra class files.
if [ ! -d `dirname $0`/../../../build/classes/main ]; then
echo "Unable to locate cassandra class files" >&2
exit 1
fi
# Stress class files.
if [ ! -d `dirname $0`/../build/classes ]; then
echo "Unable to locate stress class files" >&2
exit 1
fi
CLASSPATH=`dirname $0`/../../../build/classes/main
CLASSPATH=$CLASSPATH:`dirname $0`/../../../build/classes/thrift
CLASSPATH=$CLASSPATH:`dirname $0`/../build/classes
CLASSPATH=`dirname $0`/../stress.jar
for jar in `dirname $0`/../../../lib/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done

View File

@ -18,9 +18,7 @@
if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\..
if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD%
set CLASSPATH="%STRESS_HOME%\build\classes"
set CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main"
set CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\thrift"
set CLASSPATH="%STRESS_HOME%\..\*.jar"
for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i"
set CLASSPATH=%CLASSPATH%;"%%i"
goto start

View File

@ -19,21 +19,7 @@
DESC="Stress Test Daemon"
if [ "x$CLASSPATH" = "x" ]; then
# Cassandra class files.
if [ ! -d `dirname $0`/../../../build/classes/main ]; then
echo "Unable to locate cassandra class files" >&2
exit 1
fi
# Stress class files.
if [ ! -d `dirname $0`/../build/classes ]; then
echo "Unable to locate stress class files" >&2
exit 1
fi
CLASSPATH=`dirname $0`/../../../build/classes/main
CLASSPATH=$CLASSPATH:`dirname $0`/../../../build/classes/thrift
CLASSPATH=$CLASSPATH:`dirname $0`/../build/classes
CLASSPATH=`dirname $0`/../stress.jar
for jar in `dirname $0`/../../../lib/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project basedir="." default="jar" name="stress">
<property name="cassandra.dir" value="../.." />
<property name="cassandra.lib" value="${cassandra.dir}/lib" />
<property name="build.src" value="${basedir}/src" />
<property name="build.out" value="${basedir}/build" />
<property name="build.classes" value="${build.out}/classes" />
<property name="final.name" value="stress" />
<path id="cassandra.classes">
<pathelement location="${cassandra.dir}/build/classes/main" />
<pathelement location="${cassandra.dir}/build/classes/thrift" />
</path>
<target name="init">
<mkdir dir="${build.classes}" />
</target>
<target depends="init" name="build">
<javac destdir="${build.classes}">
<src path="${build.src}" />
<classpath>
<path refid="cassandra.classes" />
<path>
<fileset dir="${cassandra.lib}">
<include name="**/*.jar" />
</fileset>
</path>
</classpath>
</javac>
</target>
<target name="jar" depends="build">
<manifest file="MANIFEST.MF">
<attribute name="Built-By" value="Pavel Yaskevich"/>
<attribute name="Main-Class" value="org.apache.cassandra.stress.Stress"/>
</manifest>
<mkdir dir="${build.classes}/META-INF" />
<jar destfile="${build.out}/${final.name}.jar" manifest="MANIFEST.MF">
<fileset dir="${build.classes}"/>
<fileset dir="${cassandra.dir}/build/classes/main" />
<fileset dir="${cassandra.dir}/build/classes/thrift" />
<zipgroupfileset dir="${cassandra.lib}" includes="*.jar" />
</jar>
</target>
<target name="clean">
<delete dir="${build.out}" />
</target>
</project>