Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Tyler Hobbs 2014-11-21 15:40:53 -06:00
commit 699a69de8d
17 changed files with 45 additions and 86 deletions

View File

@ -54,7 +54,7 @@ if NOT DEFINED JAVA_HOME goto :err
REM -----------------------------------------------------------------------------
REM JVM Opts we'll use in legacy run or installation
set JAVA_OPTS=-ea^
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.2.8.jar"^
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.0.jar"^
-Xms2G^
-Xmx2G^
-XX:+HeapDumpOnOutOfMemoryError^

View File

@ -48,7 +48,7 @@ done
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
then
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.8.jar"
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
fi
# Added sigar-bin to the java.library.path CASSANDRA-7838

View File

@ -336,7 +336,7 @@
<dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl" version="1.9.2"/>
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
<dependency groupId="com.github.jbellis" artifactId="jamm" version="0.2.8"/>
<dependency groupId="com.github.jbellis" artifactId="jamm" version="0.3.0"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.7">
<exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/>
</dependency>
@ -686,7 +686,7 @@
<pathelement location="${test.conf}"/>
</classpath>
<jvmarg value="-Dstorage-config=${test.conf}"/>
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.2.8.jar" />
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
<jvmarg value="-ea"/>
</java>
</target>
@ -1113,7 +1113,7 @@
<formatter type="brief" usefile="false"/>
<jvmarg value="-Dstorage-config=${test.conf}"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg line="-javaagent:${basedir}/lib/jamm-0.2.8.jar ${additionalagent}" />
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar ${additionalagent}" />
<jvmarg value="-ea"/>
<jvmarg value="-Xss256k"/>
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
@ -1286,7 +1286,7 @@
<formatter type="brief" usefile="false"/>
<jvmarg value="-Dstorage-config=${test.conf}"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.2.8.jar" />
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
<jvmarg value="-ea"/>
<jvmarg value="-Xss256k"/>
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
@ -1329,7 +1329,7 @@
<formatter type="brief" usefile="false"/>
<jvmarg value="-Dstorage-config=${test.conf}"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.2.8.jar" />
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
<jvmarg value="-ea"/>
<jvmarg value="-Xss256k"/>
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>

View File

@ -304,7 +304,7 @@ Function SetCassandraEnvironment
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
{
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.2.8.jar"""
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.0.jar"""
}
# enable assertions. disabling this in production will give a modest

View File

@ -173,7 +173,7 @@ JMX_PORT="7199"
JVM_OPTS="$JVM_OPTS -ea"
# add the jamm javaagent
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.8.jar"
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
# some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
JVM_OPTS="$JVM_OPTS -XX:+CMSClassUnloadingEnabled"

View File

@ -26,5 +26,5 @@ CLASSPATH="$CLASSPATH:$EXTRA_CLASSPATH"
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
then
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.8.jar"
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
fi

Binary file not shown.

BIN
lib/jamm-0.3.0.jar Normal file

Binary file not shown.

View File

@ -53,10 +53,15 @@ import org.apache.cassandra.io.util.FileDataInput;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.UUIDGen;
import org.github.jamm.Unmetered;
import static org.apache.cassandra.utils.FBUtilities.fromJsonMap;
import static org.apache.cassandra.utils.FBUtilities.json;
/**
* This class can be tricky to modify. Please read http://wiki.apache.org/cassandra/ConfigurationNotes for how to do so safely.
*/
@Unmetered
public final class CFMetaData
{
private static final Logger logger = LoggerFactory.getLogger(CFMetaData.class);

View File

@ -1,26 +0,0 @@
/*
* 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.
*/
package org.apache.cassandra.cql3;
import org.github.jamm.MemoryMeter;
public interface MeasurableForPreparedCache
{
public long measureForPreparedCache(MemoryMeter meter);
}

View File

@ -18,7 +18,10 @@
package org.apache.cassandra.cql3;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
@ -28,19 +31,28 @@ import com.googlecode.concurrentlinkedhashmap.EntryWeigher;
import com.googlecode.concurrentlinkedhashmap.EvictionListener;
import org.antlr.runtime.*;
import org.github.jamm.MemoryMeter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.concurrent.ScheduledExecutors;
import org.apache.cassandra.cql3.functions.*;
import org.apache.cassandra.cql3.statements.*;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.composites.*;
import org.apache.cassandra.db.composites.CType;
import org.apache.cassandra.db.composites.CellName;
import org.apache.cassandra.db.composites.CellNameType;
import org.apache.cassandra.db.composites.Composite;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.exceptions.*;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.exceptions.RequestExecutionException;
import org.apache.cassandra.exceptions.RequestValidationException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.metrics.CQLMetrics;
import org.apache.cassandra.service.*;
import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.service.IMigrationListener;
import org.apache.cassandra.service.MigrationManager;
import org.apache.cassandra.service.QueryState;
import org.apache.cassandra.service.pager.QueryPager;
import org.apache.cassandra.service.pager.QueryPagers;
import org.apache.cassandra.thrift.ThriftClientState;
@ -49,6 +61,7 @@ import org.apache.cassandra.transport.messages.ResultMessage;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.MD5Digest;
import org.apache.cassandra.utils.SemanticVersion;
import org.github.jamm.MemoryMeter;
public class QueryProcessor implements QueryHandler
{
@ -543,9 +556,7 @@ public class QueryProcessor implements QueryHandler
private static long measure(Object key)
{
return key instanceof MeasurableForPreparedCache
? ((MeasurableForPreparedCache)key).measureForPreparedCache(meter)
: meter.measureDeep(key);
return meter.measureDeep(key);
}
private static class MigrationSubscriber implements IMigrationListener

View File

@ -21,6 +21,10 @@ import java.util.List;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.github.jamm.Unmetered;
@Unmetered
public interface Function
{
public FunctionName name();

View File

@ -23,8 +23,9 @@ import java.util.*;
import com.google.common.base.Function;
import com.google.common.collect.*;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.tracing.Tracing;
import org.github.jamm.MemoryMeter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -42,7 +43,7 @@ import org.apache.cassandra.transport.messages.ResultMessage;
* A <code>BATCH</code> statement parsed from a CQL query.
*
*/
public class BatchStatement implements CQLStatement, MeasurableForPreparedCache
public class BatchStatement implements CQLStatement
{
public static enum Type
{
@ -87,17 +88,6 @@ public class BatchStatement implements CQLStatement, MeasurableForPreparedCache
return false;
}
public long measureForPreparedCache(MemoryMeter meter)
{
long size = meter.measure(this)
+ meter.measureDeep(type)
+ meter.measure(statements)
+ meter.measureDeep(attrs);
for (ModificationStatement stmt : statements)
size += stmt.measureForPreparedCache(meter);
return size;
}
public int getBoundTerms()
{
return boundTerms;

View File

@ -22,7 +22,6 @@ import java.util.*;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import org.github.jamm.MemoryMeter;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.config.CFMetaData;
@ -46,7 +45,7 @@ import org.apache.cassandra.utils.Pair;
/*
* Abstract parent class of individual modifications, i.e. INSERT, UPDATE and DELETE.
*/
public abstract class ModificationStatement implements CQLStatement, MeasurableForPreparedCache
public abstract class ModificationStatement implements CQLStatement
{
private static final ColumnIdentifier CAS_RESULT_COLUMN = new ColumnIdentifier("[applied]", false);
@ -106,16 +105,6 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
return false;
}
public long measureForPreparedCache(MemoryMeter meter)
{
return meter.measure(this)
+ meter.measureDeep(attrs)
+ meter.measureDeep(processedKeys)
+ meter.measureDeep(columnOperations)
+ (columnConditions == null ? 0 : meter.measureDeep(columnConditions))
+ (staticConditions == null ? 0 : meter.measureDeep(staticConditions));
}
public abstract boolean requireFullClusteringKey();
public abstract void addUpdateForKey(ColumnFamily updates, ByteBuffer key, Composite prefix, UpdateParameters params) throws InvalidRequestException;

View File

@ -27,8 +27,6 @@ import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import org.github.jamm.MemoryMeter;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.statements.SingleColumnRestriction.Contains;
@ -62,7 +60,7 @@ import org.apache.cassandra.utils.FBUtilities;
* column family, expression, result count, and ordering clause.
*
*/
public class SelectStatement implements CQLStatement, MeasurableForPreparedCache
public class SelectStatement implements CQLStatement
{
private static final int DEFAULT_COUNT_PAGE_SIZE = 10000;
@ -177,20 +175,6 @@ public class SelectStatement implements CQLStatement, MeasurableForPreparedCache
return selection.getResultMetadata();
}
public long measureForPreparedCache(MemoryMeter meter)
{
return meter.measure(this)
+ meter.measureDeep(parameters)
+ meter.measureDeep(selection)
+ (limit == null ? 0 : meter.measureDeep(limit))
+ meter.measureDeep(keyRestrictions)
+ meter.measureDeep(columnRestrictions)
+ meter.measureDeep(metadataRestrictions)
+ meter.measureDeep(restrictedColumns)
+ (sliceRestriction == null ? 0 : meter.measureDeep(sliceRestriction))
+ (orderingIndexes == null ? 0 : meter.measureDeep(orderingIndexes));
}
public int getBoundTerms()
{
return boundTerms;

View File

@ -28,6 +28,7 @@ import org.apache.cassandra.cql3.CQL3Type;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.serializers.TypeSerializer;
import org.apache.cassandra.serializers.MarshalException;
import org.github.jamm.Unmetered;
/**
* Specifies a Comparator for a specific type of ByteBuffer.
@ -37,6 +38,7 @@ import org.apache.cassandra.serializers.MarshalException;
* should always handle those values even if they normally do not
* represent a valid ByteBuffer for the type being compared.
*/
@Unmetered
public abstract class AbstractType<T> implements Comparator<ByteBuffer>
{
public final Comparator<ByteBuffer> reverseComparator;