You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2016/02/19 10:35:26 UTC
[1/3] cassandra git commit: Prevent logging in sandboxed state
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 650333508 -> a76a8efcc
refs/heads/trunk aca2a1dcf -> fdee887b4
Prevent logging in sandboxed state
patch by Robert Stupp; reviewed by Tyler Hobbs for CASSANDRA-11033
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a76a8efc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a76a8efc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a76a8efc
Branch: refs/heads/cassandra-3.0
Commit: a76a8efcc7665068434fc105e174e22ede0ee5be
Parents: 6503335
Author: Robert Stupp <sn...@snazy.de>
Authored: Fri Feb 19 10:28:30 2016 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Fri Feb 19 10:28:30 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/functions/JavaBasedUDFunction.java | 14 +--
.../cassandra/cql3/functions/JavaUDF.java | 30 +++----
.../cql3/functions/ScriptBasedUDFunction.java | 2 +-
.../cql3/functions/UDFByteCodeVerifier.java | 4 +-
.../cassandra/cql3/functions/UDFunction.java | 31 +++----
.../cassandra/cql3/functions/UDHelper.java | 27 +++---
.../cassandra/cql3/functions/JavaSourceUDF.txt | 6 +-
test/conf/logback-test.xml | 2 +-
.../entities/udfverify/CallClone.java | 4 +-
.../entities/udfverify/CallComDatastax.java | 4 +-
.../entities/udfverify/CallFinalize.java | 4 +-
.../entities/udfverify/CallOrgApache.java | 4 +-
.../entities/udfverify/ClassWithField.java | 4 +-
.../udfverify/ClassWithInitializer.java | 4 +-
.../udfverify/ClassWithInitializer2.java | 4 +-
.../udfverify/ClassWithInitializer3.java | 4 +-
.../udfverify/ClassWithStaticInitializer.java | 4 +-
.../entities/udfverify/GoodClass.java | 4 +-
.../entities/udfverify/UseOfSynchronized.java | 4 +-
.../udfverify/UseOfSynchronizedWithNotify.java | 4 +-
.../UseOfSynchronizedWithNotifyAll.java | 4 +-
.../udfverify/UseOfSynchronizedWithWait.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitL.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitLI.java | 4 +-
.../validation/operations/AggregationTest.java | 89 ++++++++++++++++++++
26 files changed, 184 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 275bc04..ae9d545 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.4
+ * Prevent logging in sandboxed state (CASSANDRA-11033)
* Disallow drop/alter operations of UDTs used by UDAs (CASSANDRA-10721)
* Add query time validation method on Index (CASSANDRA-11043)
* Avoid potential AssertionError in mixed version cluster (CASSANDRA-11128)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
index c61e72e..660d494 100644
--- a/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
@@ -40,7 +40,7 @@ import com.google.common.io.ByteStreams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.apache.cassandra.cql3.ColumnIdentifier;
import org.apache.cassandra.db.marshal.AbstractType;
@@ -184,10 +184,10 @@ final class JavaBasedUDFunction extends UDFunction
super(name, argNames, argTypes, UDHelper.driverTypes(argTypes),
returnType, UDHelper.driverType(returnType), calledOnNullInput, "java", body);
- // javaParamTypes is just the Java representation for argTypes resp. argDataTypes
- Class<?>[] javaParamTypes = UDHelper.javaTypes(argDataTypes, calledOnNullInput);
- // javaReturnType is just the Java representation for returnType resp. returnDataType
- Class<?> javaReturnType = UDHelper.asJavaClass(returnDataType);
+ // javaParamTypes is just the Java representation for argTypes resp. argCodecs
+ Class<?>[] javaParamTypes = UDHelper.javaTypes(argCodecs, calledOnNullInput);
+ // javaReturnType is just the Java representation for returnType resp. returnCodec
+ Class<?> javaReturnType = UDHelper.asJavaClass(returnCodec);
// put each UDF in a separate package to prevent cross-UDF code access
String pkgName = BASE_PACKAGE + '.' + generateClassName(name, 'p');
@@ -327,9 +327,9 @@ final class JavaBasedUDFunction extends UDFunction
if (nonSyntheticMethodCount != 2 || cls.getDeclaredConstructors().length != 1)
throw new InvalidRequestException("Check your source to not define additional Java methods or constructors");
MethodType methodType = MethodType.methodType(void.class)
- .appendParameterTypes(DataType.class, DataType[].class);
+ .appendParameterTypes(TypeCodec.class, TypeCodec[].class);
MethodHandle ctor = MethodHandles.lookup().findConstructor(cls, methodType);
- this.javaUDF = (JavaUDF) ctor.invokeWithArguments(returnDataType, argDataTypes);
+ this.javaUDF = (JavaUDF) ctor.invokeWithArguments(returnCodec, argCodecs);
}
finally
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java b/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
index 47f5d47..fcfd21c 100644
--- a/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
+++ b/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.functions;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
/**
* Base class for all Java UDFs.
@@ -31,73 +31,73 @@ import com.datastax.driver.core.DataType;
*/
public abstract class JavaUDF
{
- private final DataType returnDataType;
- private final DataType[] argDataTypes;
+ private final TypeCodec<Object> returnCodec;
+ private final TypeCodec<Object>[] argCodecs;
- protected JavaUDF(DataType returnDataType, DataType[] argDataTypes)
+ protected JavaUDF(TypeCodec<Object> returnCodec, TypeCodec<Object>[] argCodecs)
{
- this.returnDataType = returnDataType;
- this.argDataTypes = argDataTypes;
+ this.returnCodec = returnCodec;
+ this.argCodecs = argCodecs;
}
protected abstract ByteBuffer executeImpl(int protocolVersion, List<ByteBuffer> params);
protected Object compose(int protocolVersion, int argIndex, ByteBuffer value)
{
- return UDFunction.compose(argDataTypes, protocolVersion, argIndex, value);
+ return UDFunction.compose(argCodecs, protocolVersion, argIndex, value);
}
protected ByteBuffer decompose(int protocolVersion, Object value)
{
- return UDFunction.decompose(returnDataType, protocolVersion, value);
+ return UDFunction.decompose(returnCodec, protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected float compose_float(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (float) UDHelper.deserialize(DataType.cfloat(), protocolVersion, value);
+ return (float) UDHelper.deserialize(TypeCodec.cfloat(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected double compose_double(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (double) UDHelper.deserialize(DataType.cdouble(), protocolVersion, value);
+ return (double) UDHelper.deserialize(TypeCodec.cdouble(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected byte compose_byte(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (byte) UDHelper.deserialize(DataType.tinyint(), protocolVersion, value);
+ return (byte) UDHelper.deserialize(TypeCodec.tinyInt(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected short compose_short(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (short) UDHelper.deserialize(DataType.smallint(), protocolVersion, value);
+ return (short) UDHelper.deserialize(TypeCodec.smallInt(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected int compose_int(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (int) UDHelper.deserialize(DataType.cint(), protocolVersion, value);
+ return (int) UDHelper.deserialize(TypeCodec.cint(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected long compose_long(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (long) UDHelper.deserialize(DataType.bigint(), protocolVersion, value);
+ return (long) UDHelper.deserialize(TypeCodec.bigint(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected boolean compose_boolean(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (boolean) UDHelper.deserialize(DataType.cboolean(), protocolVersion, value);
+ return (boolean) UDHelper.deserialize(TypeCodec.cboolean(), protocolVersion, value);
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
index 4ffb992..8743a20 100644
--- a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
@@ -189,7 +189,7 @@ final class ScriptBasedUDFunction extends UDFunction
if (result == null)
return null;
- Class<?> javaReturnType = UDHelper.asJavaClass(returnDataType);
+ Class<?> javaReturnType = UDHelper.asJavaClass(returnCodec);
Class<?> resultType = result.getClass();
if (!javaReturnType.isAssignableFrom(resultType))
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java b/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
index 59cef70..1314af3 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
@@ -47,7 +47,7 @@ public final class UDFByteCodeVerifier
public static final String JAVA_UDF_NAME = JavaUDF.class.getName().replace('.', '/');
public static final String OBJECT_NAME = Object.class.getName().replace('.', '/');
- public static final String CTOR_SIG = "(Lcom/datastax/driver/core/DataType;[Lcom/datastax/driver/core/DataType;)V";
+ public static final String CTOR_SIG = "(Lcom/datastax/driver/core/TypeCodec;[Lcom/datastax/driver/core/TypeCodec;)V";
private final Set<String> disallowedClasses = new HashSet<>();
private final Multimap<String, String> disallowedMethodCalls = HashMultimap.create();
@@ -97,7 +97,7 @@ public final class UDFByteCodeVerifier
{
if (Opcodes.ACC_PUBLIC != access)
errors.add("constructor not public");
- // allowed constructor - JavaUDF(DataType returnDataType, DataType[] argDataTypes)
+ // allowed constructor - JavaUDF(TypeCodec returnCodec, TypeCodec[] argCodecs)
return new ConstructorVisitor(errors);
}
if ("executeImpl".equals(name) && "(ILjava/util/List;)Ljava/nio/ByteBuffer;".equals(desc))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
index fa0d306..7b69342 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import com.datastax.driver.core.UserType;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
@@ -70,8 +71,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
protected final String language;
protected final String body;
- protected final DataType[] argDataTypes;
- protected final DataType returnDataType;
+ protected final TypeCodec<Object>[] argCodecs;
+ protected final TypeCodec<Object> returnCodec;
protected final boolean calledOnNullInput;
//
@@ -202,8 +203,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
this.argNames = argNames;
this.language = language;
this.body = body;
- this.argDataTypes = argDataTypes;
- this.returnDataType = returnDataType;
+ this.argCodecs = UDHelper.codecsFor(argDataTypes);
+ this.returnCodec = UDHelper.codecFor(returnDataType);
this.calledOnNullInput = calledOnNullInput;
}
@@ -306,8 +307,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
{
// Get the TypeCodec stuff in Java Driver initialized.
// This is to get the classes loaded outside of the restricted sandbox's security context of a UDF.
- UDHelper.codecFor(DataType.inet()).format(InetAddress.getLoopbackAddress());
- UDHelper.codecFor(DataType.ascii()).format("");
+ TypeCodec.inet().format(InetAddress.getLoopbackAddress());
+ TypeCodec.ascii().format("");
}
private static final class ThreadIdAndCpuTime extends CompletableFuture<Object>
@@ -478,12 +479,12 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
*/
protected Object compose(int protocolVersion, int argIndex, ByteBuffer value)
{
- return compose(argDataTypes, protocolVersion, argIndex, value);
+ return compose(argCodecs, protocolVersion, argIndex, value);
}
- protected static Object compose(DataType[] argDataTypes, int protocolVersion, int argIndex, ByteBuffer value)
+ protected static Object compose(TypeCodec<Object>[] codecs, int protocolVersion, int argIndex, ByteBuffer value)
{
- return value == null ? null : UDHelper.deserialize(argDataTypes[argIndex], protocolVersion, value);
+ return value == null ? null : UDHelper.deserialize(codecs[argIndex], protocolVersion, value);
}
/**
@@ -495,12 +496,12 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
*/
protected ByteBuffer decompose(int protocolVersion, Object value)
{
- return decompose(returnDataType, protocolVersion, value);
+ return decompose(returnCodec, protocolVersion, value);
}
- protected static ByteBuffer decompose(DataType dataType, int protocolVersion, Object value)
+ protected static ByteBuffer decompose(TypeCodec<Object> codec, int protocolVersion, Object value)
{
- return value == null ? null : UDHelper.serialize(dataType, protocolVersion, value);
+ return value == null ? null : UDHelper.serialize(codec, protocolVersion, value);
}
@Override
@@ -528,9 +529,9 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
{
boolean updated = false;
- for (int i = 0; i < argDataTypes.length; i++)
+ for (int i = 0; i < argCodecs.length; i++)
{
- DataType dataType = argDataTypes[i];
+ DataType dataType = argCodecs[i].getCqlType();
if (dataType instanceof UserType)
{
UserType userType = (UserType) dataType;
@@ -542,7 +543,7 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
org.apache.cassandra.db.marshal.UserType ut = ksm.types.get(ByteBufferUtil.bytes(typeName)).get();
DataType newUserType = UDHelper.driverType(ut);
- argDataTypes[i] = newUserType;
+ argCodecs[i] = UDHelper.codecFor(newUserType);
argTypes.set(i, ut);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDHelper.java b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
index cc62c84..45c734f 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
@@ -56,6 +56,14 @@ public final class UDHelper
}
}
+ static TypeCodec<Object>[] codecsFor(DataType[] dataType)
+ {
+ TypeCodec<Object>[] codecs = new TypeCodec[dataType.length];
+ for (int i = 0; i < dataType.length; i++)
+ codecs[i] = codecFor(dataType[i]);
+ return codecs;
+ }
+
static TypeCodec<Object> codecFor(DataType dataType)
{
return codecRegistry.codecFor(dataType);
@@ -68,7 +76,7 @@ public final class UDHelper
* @param calledOnNullInput whether to allow {@code null} as an argument value
* @return array of same size with UDF arguments
*/
- public static Class<?>[] javaTypes(DataType[] dataTypes, boolean calledOnNullInput)
+ public static Class<?>[] javaTypes(TypeCodec<Object>[] dataTypes, boolean calledOnNullInput)
{
Class<?>[] paramTypes = new Class[dataTypes.length];
for (int i = 0; i < paramTypes.length; i++)
@@ -135,23 +143,22 @@ public final class UDHelper
}
}
- public static Object deserialize(DataType dataType, int protocolVersion, ByteBuffer value)
+ public static Object deserialize(TypeCodec<?> codec, int protocolVersion, ByteBuffer value)
{
- return codecFor(dataType).deserialize(value, ProtocolVersion.fromInt(protocolVersion));
+ return codec.deserialize(value, ProtocolVersion.fromInt(protocolVersion));
}
- public static ByteBuffer serialize(DataType dataType, int protocolVersion, Object value)
+ public static ByteBuffer serialize(TypeCodec<?> codec, int protocolVersion, Object value)
{
- TypeCodec<Object> codec = codecFor(dataType);
- if (! codec.getJavaType().getRawType().isAssignableFrom(value.getClass()))
- throw new InvalidTypeException("Invalid value for CQL type " + dataType.getName().toString());
+ if (!codec.getJavaType().getRawType().isAssignableFrom(value.getClass()))
+ throw new InvalidTypeException("Invalid value for CQL type " + codec.getCqlType().getName().toString());
- return codec.serialize(value, ProtocolVersion.fromInt(protocolVersion));
+ return ((TypeCodec)codec).serialize(value, ProtocolVersion.fromInt(protocolVersion));
}
- public static Class<?> asJavaClass(DataType dataType)
+ public static Class<?> asJavaClass(TypeCodec<?> codec)
{
- return codecFor(dataType).getJavaType().getRawType();
+ return codec.getJavaType().getRawType();
}
public static boolean isNullOrEmpty(AbstractType<?> type, ByteBuffer bb)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt b/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
index e72b9c8..4bd3601 100644
--- a/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
+++ b/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
@@ -5,13 +5,13 @@ import java.util.List;
import org.apache.cassandra.cql3.functions.JavaUDF;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
public final class #class_name# extends JavaUDF
{
- public #class_name#(DataType returnDataType, DataType[] argDataTypes)
+ public #class_name#(TypeCodec<Object> returnCodec, TypeCodec<Object>[] argCodecs)
{
- super(returnDataType, argDataTypes);
+ super(returnCodec, argCodecs);
}
protected ByteBuffer executeImpl(int protocolVersion, List<ByteBuffer> params)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/conf/logback-test.xml
----------------------------------------------------------------------
diff --git a/test/conf/logback-test.xml b/test/conf/logback-test.xml
index 0e1bb76..abedc32 100644
--- a/test/conf/logback-test.xml
+++ b/test/conf/logback-test.xml
@@ -17,7 +17,7 @@
under the License.
-->
-<configuration debug="false">
+<configuration debug="false" scan="true">
<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
index 51481d8..c01fbe6 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallClone extends JavaUDF
{
- public CallClone(DataType returnDataType, DataType[] argDataTypes)
+ public CallClone(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
index 5c7e8b3..9cd799f 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
import java.util.List;
import com.datastax.driver.core.DataType;
-import org.apache.cassandra.config.DatabaseDescriptor;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -30,7 +30,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallComDatastax extends JavaUDF
{
- public CallComDatastax(DataType returnDataType, DataType[] argDataTypes)
+ public CallComDatastax(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
index 1b69a72..a16bd31 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallFinalize extends JavaUDF
{
- public CallFinalize(DataType returnDataType, DataType[] argDataTypes)
+ public CallFinalize(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
index 7a850e8..4f511d7 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.functions.JavaUDF;
@@ -30,7 +30,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallOrgApache extends JavaUDF
{
- public CallOrgApache(DataType returnDataType, DataType[] argDataTypes)
+ public CallOrgApache(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
index f43588d..d981c18 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithField extends JavaUDF
{
- public ClassWithField(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithField(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
index a6e10fb..f53cc24 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer extends JavaUDF
{
- public ClassWithInitializer(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
index d0c8e11..134f9f9 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer2 extends JavaUDF
{
- public ClassWithInitializer2(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer2(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
index 8672cd2..9cd04fb 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer3 extends JavaUDF
{
- public ClassWithInitializer3(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer3(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
index 459a6eb..64470ca 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithStaticInitializer extends JavaUDF
{
- public ClassWithStaticInitializer(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithStaticInitializer(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
index 2666023..e3bc1e2 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class GoodClass extends JavaUDF
{
- public GoodClass(DataType returnDataType, DataType[] argDataTypes)
+ public GoodClass(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
index 0059a0a..2927b3e 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronized extends JavaUDF
{
- public UseOfSynchronized(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronized(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
index 2da13b6..7ef2e1c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithNotify extends JavaUDF
{
- public UseOfSynchronizedWithNotify(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithNotify(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
index 1e4d33d..50a3da8 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithNotifyAll extends JavaUDF
{
- public UseOfSynchronizedWithNotifyAll(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithNotifyAll(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
index ccaf6ee..135c550 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWait extends JavaUDF
{
- public UseOfSynchronizedWithWait(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWait(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
index 56aa726..4e49e5b 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWaitL extends JavaUDF
{
- public UseOfSynchronizedWithWaitL(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWaitL(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
index 403fb68..6770e7a 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWaitLI extends JavaUDF
{
- public UseOfSynchronizedWithWaitLI(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWaitLI(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
index 221f48e..9c05232 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
@@ -22,12 +22,21 @@ import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
+import java.util.Locale;
import java.util.TimeZone;
+import java.util.concurrent.ThreadLocalRandom;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.TurboFilterList;
+import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter;
+import ch.qos.logback.classic.turbo.TurboFilter;
import org.apache.cassandra.config.Schema;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.QueryProcessor;
@@ -1731,4 +1740,84 @@ public class AggregationTest extends CQLTester
execute("INSERT INTO %s (a, b) VALUES (3, 2)");
assertRows(execute("SELECT " + a + "(b) FROM %s"), row(Arrays.asList("1", "2")));
}
+
+ @Test
+ public void testLogbackReload() throws Throwable
+ {
+ // see https://issues.apache.org/jira/browse/CASSANDRA-11033
+
+ // make logback's scan interval 1ms - boilerplate, but necessary for this test
+ configureLogbackScanPeriod(1L);
+ try
+ {
+
+ createTable("CREATE TABLE %s (" +
+ " year int PRIMARY KEY," +
+ " country text," +
+ " title text)");
+
+ String[] countries = Locale.getISOCountries();
+ ThreadLocalRandom rand = ThreadLocalRandom.current();
+ for (int i = 0; i < 10000; i++)
+ {
+ execute("INSERT INTO %s (year, country, title) VALUES (1980,?,?)",
+ countries[rand.nextInt(countries.length)],
+ "title-" + i);
+ }
+
+ String albumCountByCountry = createFunction(KEYSPACE,
+ "map<text,bigint>,text,text",
+ "CREATE FUNCTION IF NOT EXISTS %s(state map<text,bigint>,country text, album_title text)\n" +
+ " RETURNS NULL ON NULL INPUT\n" +
+ " RETURNS map<text,bigint>\n" +
+ " LANGUAGE java\n" +
+ " AS $$\n" +
+ " if(state.containsKey(country)) {\n" +
+ " Long newCount = (Long)state.get(country) + 1;\n" +
+ " state.put(country, newCount);\n" +
+ " } else {\n" +
+ " state.put(country, 1L);\n" +
+ " }\n" +
+ " return state;\n" +
+ " $$;");
+
+ String releasesByCountry = createAggregate(KEYSPACE,
+ "text, text",
+ " CREATE AGGREGATE IF NOT EXISTS %s(text, text)\n" +
+ " SFUNC " + shortFunctionName(albumCountByCountry) + '\n' +
+ " STYPE map<text,bigint>\n" +
+ " INITCOND { };");
+
+ for (int i = 0; i < 1000; i++)
+ {
+ execute("SELECT " + releasesByCountry + "(country,title) FROM %s WHERE year=1980");
+ }
+ }
+ finally
+ {
+ configureLogbackScanPeriod(60000L);
+ }
+ }
+
+ private static void configureLogbackScanPeriod(long millis)
+ {
+ Logger l = LoggerFactory.getLogger(AggregationTest.class);
+ ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) l;
+ LoggerContext ctx = logbackLogger.getLoggerContext();
+ TurboFilterList turboFilterList = ctx.getTurboFilterList();
+ boolean done = false;
+ for (TurboFilter turboFilter : turboFilterList)
+ {
+ if (turboFilter instanceof ReconfigureOnChangeFilter)
+ {
+ ReconfigureOnChangeFilter reconfigureFilter = (ReconfigureOnChangeFilter) turboFilter;
+ reconfigureFilter.setRefreshPeriod(millis);
+ reconfigureFilter.stop();
+ reconfigureFilter.start(); // start() sets the next check timestammp
+ done = true;
+ break;
+ }
+ }
+ assertTrue("ReconfigureOnChangeFilter not in logback's turbo-filter list - do that by adding scan=\"true\" to logback-test.xml's configuration element", done);
+ }
}
[2/3] cassandra git commit: Prevent logging in sandboxed state
Posted by sn...@apache.org.
Prevent logging in sandboxed state
patch by Robert Stupp; reviewed by Tyler Hobbs for CASSANDRA-11033
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a76a8efc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a76a8efc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a76a8efc
Branch: refs/heads/trunk
Commit: a76a8efcc7665068434fc105e174e22ede0ee5be
Parents: 6503335
Author: Robert Stupp <sn...@snazy.de>
Authored: Fri Feb 19 10:28:30 2016 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Fri Feb 19 10:28:30 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/functions/JavaBasedUDFunction.java | 14 +--
.../cassandra/cql3/functions/JavaUDF.java | 30 +++----
.../cql3/functions/ScriptBasedUDFunction.java | 2 +-
.../cql3/functions/UDFByteCodeVerifier.java | 4 +-
.../cassandra/cql3/functions/UDFunction.java | 31 +++----
.../cassandra/cql3/functions/UDHelper.java | 27 +++---
.../cassandra/cql3/functions/JavaSourceUDF.txt | 6 +-
test/conf/logback-test.xml | 2 +-
.../entities/udfverify/CallClone.java | 4 +-
.../entities/udfverify/CallComDatastax.java | 4 +-
.../entities/udfverify/CallFinalize.java | 4 +-
.../entities/udfverify/CallOrgApache.java | 4 +-
.../entities/udfverify/ClassWithField.java | 4 +-
.../udfverify/ClassWithInitializer.java | 4 +-
.../udfverify/ClassWithInitializer2.java | 4 +-
.../udfverify/ClassWithInitializer3.java | 4 +-
.../udfverify/ClassWithStaticInitializer.java | 4 +-
.../entities/udfverify/GoodClass.java | 4 +-
.../entities/udfverify/UseOfSynchronized.java | 4 +-
.../udfverify/UseOfSynchronizedWithNotify.java | 4 +-
.../UseOfSynchronizedWithNotifyAll.java | 4 +-
.../udfverify/UseOfSynchronizedWithWait.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitL.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitLI.java | 4 +-
.../validation/operations/AggregationTest.java | 89 ++++++++++++++++++++
26 files changed, 184 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 275bc04..ae9d545 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.4
+ * Prevent logging in sandboxed state (CASSANDRA-11033)
* Disallow drop/alter operations of UDTs used by UDAs (CASSANDRA-10721)
* Add query time validation method on Index (CASSANDRA-11043)
* Avoid potential AssertionError in mixed version cluster (CASSANDRA-11128)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
index c61e72e..660d494 100644
--- a/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
@@ -40,7 +40,7 @@ import com.google.common.io.ByteStreams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.apache.cassandra.cql3.ColumnIdentifier;
import org.apache.cassandra.db.marshal.AbstractType;
@@ -184,10 +184,10 @@ final class JavaBasedUDFunction extends UDFunction
super(name, argNames, argTypes, UDHelper.driverTypes(argTypes),
returnType, UDHelper.driverType(returnType), calledOnNullInput, "java", body);
- // javaParamTypes is just the Java representation for argTypes resp. argDataTypes
- Class<?>[] javaParamTypes = UDHelper.javaTypes(argDataTypes, calledOnNullInput);
- // javaReturnType is just the Java representation for returnType resp. returnDataType
- Class<?> javaReturnType = UDHelper.asJavaClass(returnDataType);
+ // javaParamTypes is just the Java representation for argTypes resp. argCodecs
+ Class<?>[] javaParamTypes = UDHelper.javaTypes(argCodecs, calledOnNullInput);
+ // javaReturnType is just the Java representation for returnType resp. returnCodec
+ Class<?> javaReturnType = UDHelper.asJavaClass(returnCodec);
// put each UDF in a separate package to prevent cross-UDF code access
String pkgName = BASE_PACKAGE + '.' + generateClassName(name, 'p');
@@ -327,9 +327,9 @@ final class JavaBasedUDFunction extends UDFunction
if (nonSyntheticMethodCount != 2 || cls.getDeclaredConstructors().length != 1)
throw new InvalidRequestException("Check your source to not define additional Java methods or constructors");
MethodType methodType = MethodType.methodType(void.class)
- .appendParameterTypes(DataType.class, DataType[].class);
+ .appendParameterTypes(TypeCodec.class, TypeCodec[].class);
MethodHandle ctor = MethodHandles.lookup().findConstructor(cls, methodType);
- this.javaUDF = (JavaUDF) ctor.invokeWithArguments(returnDataType, argDataTypes);
+ this.javaUDF = (JavaUDF) ctor.invokeWithArguments(returnCodec, argCodecs);
}
finally
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java b/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
index 47f5d47..fcfd21c 100644
--- a/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
+++ b/src/java/org/apache/cassandra/cql3/functions/JavaUDF.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.functions;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
/**
* Base class for all Java UDFs.
@@ -31,73 +31,73 @@ import com.datastax.driver.core.DataType;
*/
public abstract class JavaUDF
{
- private final DataType returnDataType;
- private final DataType[] argDataTypes;
+ private final TypeCodec<Object> returnCodec;
+ private final TypeCodec<Object>[] argCodecs;
- protected JavaUDF(DataType returnDataType, DataType[] argDataTypes)
+ protected JavaUDF(TypeCodec<Object> returnCodec, TypeCodec<Object>[] argCodecs)
{
- this.returnDataType = returnDataType;
- this.argDataTypes = argDataTypes;
+ this.returnCodec = returnCodec;
+ this.argCodecs = argCodecs;
}
protected abstract ByteBuffer executeImpl(int protocolVersion, List<ByteBuffer> params);
protected Object compose(int protocolVersion, int argIndex, ByteBuffer value)
{
- return UDFunction.compose(argDataTypes, protocolVersion, argIndex, value);
+ return UDFunction.compose(argCodecs, protocolVersion, argIndex, value);
}
protected ByteBuffer decompose(int protocolVersion, Object value)
{
- return UDFunction.decompose(returnDataType, protocolVersion, value);
+ return UDFunction.decompose(returnCodec, protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected float compose_float(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (float) UDHelper.deserialize(DataType.cfloat(), protocolVersion, value);
+ return (float) UDHelper.deserialize(TypeCodec.cfloat(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected double compose_double(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (double) UDHelper.deserialize(DataType.cdouble(), protocolVersion, value);
+ return (double) UDHelper.deserialize(TypeCodec.cdouble(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected byte compose_byte(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (byte) UDHelper.deserialize(DataType.tinyint(), protocolVersion, value);
+ return (byte) UDHelper.deserialize(TypeCodec.tinyInt(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected short compose_short(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (short) UDHelper.deserialize(DataType.smallint(), protocolVersion, value);
+ return (short) UDHelper.deserialize(TypeCodec.smallInt(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected int compose_int(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (int) UDHelper.deserialize(DataType.cint(), protocolVersion, value);
+ return (int) UDHelper.deserialize(TypeCodec.cint(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected long compose_long(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (long) UDHelper.deserialize(DataType.bigint(), protocolVersion, value);
+ return (long) UDHelper.deserialize(TypeCodec.bigint(), protocolVersion, value);
}
// do not remove - used by generated Java UDFs
protected boolean compose_boolean(int protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
- return (boolean) UDHelper.deserialize(DataType.cboolean(), protocolVersion, value);
+ return (boolean) UDHelper.deserialize(TypeCodec.cboolean(), protocolVersion, value);
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
index 4ffb992..8743a20 100644
--- a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDFunction.java
@@ -189,7 +189,7 @@ final class ScriptBasedUDFunction extends UDFunction
if (result == null)
return null;
- Class<?> javaReturnType = UDHelper.asJavaClass(returnDataType);
+ Class<?> javaReturnType = UDHelper.asJavaClass(returnCodec);
Class<?> resultType = result.getClass();
if (!javaReturnType.isAssignableFrom(resultType))
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java b/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
index 59cef70..1314af3 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDFByteCodeVerifier.java
@@ -47,7 +47,7 @@ public final class UDFByteCodeVerifier
public static final String JAVA_UDF_NAME = JavaUDF.class.getName().replace('.', '/');
public static final String OBJECT_NAME = Object.class.getName().replace('.', '/');
- public static final String CTOR_SIG = "(Lcom/datastax/driver/core/DataType;[Lcom/datastax/driver/core/DataType;)V";
+ public static final String CTOR_SIG = "(Lcom/datastax/driver/core/TypeCodec;[Lcom/datastax/driver/core/TypeCodec;)V";
private final Set<String> disallowedClasses = new HashSet<>();
private final Multimap<String, String> disallowedMethodCalls = HashMultimap.create();
@@ -97,7 +97,7 @@ public final class UDFByteCodeVerifier
{
if (Opcodes.ACC_PUBLIC != access)
errors.add("constructor not public");
- // allowed constructor - JavaUDF(DataType returnDataType, DataType[] argDataTypes)
+ // allowed constructor - JavaUDF(TypeCodec returnCodec, TypeCodec[] argCodecs)
return new ConstructorVisitor(errors);
}
if ("executeImpl".equals(name) && "(ILjava/util/List;)Ljava/nio/ByteBuffer;".equals(desc))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
index fa0d306..7b69342 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import com.datastax.driver.core.UserType;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
@@ -70,8 +71,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
protected final String language;
protected final String body;
- protected final DataType[] argDataTypes;
- protected final DataType returnDataType;
+ protected final TypeCodec<Object>[] argCodecs;
+ protected final TypeCodec<Object> returnCodec;
protected final boolean calledOnNullInput;
//
@@ -202,8 +203,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
this.argNames = argNames;
this.language = language;
this.body = body;
- this.argDataTypes = argDataTypes;
- this.returnDataType = returnDataType;
+ this.argCodecs = UDHelper.codecsFor(argDataTypes);
+ this.returnCodec = UDHelper.codecFor(returnDataType);
this.calledOnNullInput = calledOnNullInput;
}
@@ -306,8 +307,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
{
// Get the TypeCodec stuff in Java Driver initialized.
// This is to get the classes loaded outside of the restricted sandbox's security context of a UDF.
- UDHelper.codecFor(DataType.inet()).format(InetAddress.getLoopbackAddress());
- UDHelper.codecFor(DataType.ascii()).format("");
+ TypeCodec.inet().format(InetAddress.getLoopbackAddress());
+ TypeCodec.ascii().format("");
}
private static final class ThreadIdAndCpuTime extends CompletableFuture<Object>
@@ -478,12 +479,12 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
*/
protected Object compose(int protocolVersion, int argIndex, ByteBuffer value)
{
- return compose(argDataTypes, protocolVersion, argIndex, value);
+ return compose(argCodecs, protocolVersion, argIndex, value);
}
- protected static Object compose(DataType[] argDataTypes, int protocolVersion, int argIndex, ByteBuffer value)
+ protected static Object compose(TypeCodec<Object>[] codecs, int protocolVersion, int argIndex, ByteBuffer value)
{
- return value == null ? null : UDHelper.deserialize(argDataTypes[argIndex], protocolVersion, value);
+ return value == null ? null : UDHelper.deserialize(codecs[argIndex], protocolVersion, value);
}
/**
@@ -495,12 +496,12 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
*/
protected ByteBuffer decompose(int protocolVersion, Object value)
{
- return decompose(returnDataType, protocolVersion, value);
+ return decompose(returnCodec, protocolVersion, value);
}
- protected static ByteBuffer decompose(DataType dataType, int protocolVersion, Object value)
+ protected static ByteBuffer decompose(TypeCodec<Object> codec, int protocolVersion, Object value)
{
- return value == null ? null : UDHelper.serialize(dataType, protocolVersion, value);
+ return value == null ? null : UDHelper.serialize(codec, protocolVersion, value);
}
@Override
@@ -528,9 +529,9 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
{
boolean updated = false;
- for (int i = 0; i < argDataTypes.length; i++)
+ for (int i = 0; i < argCodecs.length; i++)
{
- DataType dataType = argDataTypes[i];
+ DataType dataType = argCodecs[i].getCqlType();
if (dataType instanceof UserType)
{
UserType userType = (UserType) dataType;
@@ -542,7 +543,7 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
org.apache.cassandra.db.marshal.UserType ut = ksm.types.get(ByteBufferUtil.bytes(typeName)).get();
DataType newUserType = UDHelper.driverType(ut);
- argDataTypes[i] = newUserType;
+ argCodecs[i] = UDHelper.codecFor(newUserType);
argTypes.set(i, ut);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/UDHelper.java b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
index cc62c84..45c734f 100644
--- a/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
@@ -56,6 +56,14 @@ public final class UDHelper
}
}
+ static TypeCodec<Object>[] codecsFor(DataType[] dataType)
+ {
+ TypeCodec<Object>[] codecs = new TypeCodec[dataType.length];
+ for (int i = 0; i < dataType.length; i++)
+ codecs[i] = codecFor(dataType[i]);
+ return codecs;
+ }
+
static TypeCodec<Object> codecFor(DataType dataType)
{
return codecRegistry.codecFor(dataType);
@@ -68,7 +76,7 @@ public final class UDHelper
* @param calledOnNullInput whether to allow {@code null} as an argument value
* @return array of same size with UDF arguments
*/
- public static Class<?>[] javaTypes(DataType[] dataTypes, boolean calledOnNullInput)
+ public static Class<?>[] javaTypes(TypeCodec<Object>[] dataTypes, boolean calledOnNullInput)
{
Class<?>[] paramTypes = new Class[dataTypes.length];
for (int i = 0; i < paramTypes.length; i++)
@@ -135,23 +143,22 @@ public final class UDHelper
}
}
- public static Object deserialize(DataType dataType, int protocolVersion, ByteBuffer value)
+ public static Object deserialize(TypeCodec<?> codec, int protocolVersion, ByteBuffer value)
{
- return codecFor(dataType).deserialize(value, ProtocolVersion.fromInt(protocolVersion));
+ return codec.deserialize(value, ProtocolVersion.fromInt(protocolVersion));
}
- public static ByteBuffer serialize(DataType dataType, int protocolVersion, Object value)
+ public static ByteBuffer serialize(TypeCodec<?> codec, int protocolVersion, Object value)
{
- TypeCodec<Object> codec = codecFor(dataType);
- if (! codec.getJavaType().getRawType().isAssignableFrom(value.getClass()))
- throw new InvalidTypeException("Invalid value for CQL type " + dataType.getName().toString());
+ if (!codec.getJavaType().getRawType().isAssignableFrom(value.getClass()))
+ throw new InvalidTypeException("Invalid value for CQL type " + codec.getCqlType().getName().toString());
- return codec.serialize(value, ProtocolVersion.fromInt(protocolVersion));
+ return ((TypeCodec)codec).serialize(value, ProtocolVersion.fromInt(protocolVersion));
}
- public static Class<?> asJavaClass(DataType dataType)
+ public static Class<?> asJavaClass(TypeCodec<?> codec)
{
- return codecFor(dataType).getJavaType().getRawType();
+ return codec.getJavaType().getRawType();
}
public static boolean isNullOrEmpty(AbstractType<?> type, ByteBuffer bb)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt b/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
index e72b9c8..4bd3601 100644
--- a/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
+++ b/src/resources/org/apache/cassandra/cql3/functions/JavaSourceUDF.txt
@@ -5,13 +5,13 @@ import java.util.List;
import org.apache.cassandra.cql3.functions.JavaUDF;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
public final class #class_name# extends JavaUDF
{
- public #class_name#(DataType returnDataType, DataType[] argDataTypes)
+ public #class_name#(TypeCodec<Object> returnCodec, TypeCodec<Object>[] argCodecs)
{
- super(returnDataType, argDataTypes);
+ super(returnCodec, argCodecs);
}
protected ByteBuffer executeImpl(int protocolVersion, List<ByteBuffer> params)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/conf/logback-test.xml
----------------------------------------------------------------------
diff --git a/test/conf/logback-test.xml b/test/conf/logback-test.xml
index 0e1bb76..abedc32 100644
--- a/test/conf/logback-test.xml
+++ b/test/conf/logback-test.xml
@@ -17,7 +17,7 @@
under the License.
-->
-<configuration debug="false">
+<configuration debug="false" scan="true">
<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
index 51481d8..c01fbe6 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallClone.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallClone extends JavaUDF
{
- public CallClone(DataType returnDataType, DataType[] argDataTypes)
+ public CallClone(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
index 5c7e8b3..9cd799f 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallComDatastax.java
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
import java.util.List;
import com.datastax.driver.core.DataType;
-import org.apache.cassandra.config.DatabaseDescriptor;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -30,7 +30,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallComDatastax extends JavaUDF
{
- public CallComDatastax(DataType returnDataType, DataType[] argDataTypes)
+ public CallComDatastax(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
index 1b69a72..a16bd31 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallFinalize.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallFinalize extends JavaUDF
{
- public CallFinalize(DataType returnDataType, DataType[] argDataTypes)
+ public CallFinalize(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
index 7a850e8..4f511d7 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/CallOrgApache.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.functions.JavaUDF;
@@ -30,7 +30,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class CallOrgApache extends JavaUDF
{
- public CallOrgApache(DataType returnDataType, DataType[] argDataTypes)
+ public CallOrgApache(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
index f43588d..d981c18 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithField.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithField extends JavaUDF
{
- public ClassWithField(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithField(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
index a6e10fb..f53cc24 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer extends JavaUDF
{
- public ClassWithInitializer(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
index d0c8e11..134f9f9 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer2.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer2 extends JavaUDF
{
- public ClassWithInitializer2(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer2(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
index 8672cd2..9cd04fb 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithInitializer3.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithInitializer3 extends JavaUDF
{
- public ClassWithInitializer3(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithInitializer3(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
index 459a6eb..64470ca 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/ClassWithStaticInitializer.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class ClassWithStaticInitializer extends JavaUDF
{
- public ClassWithStaticInitializer(DataType returnDataType, DataType[] argDataTypes)
+ public ClassWithStaticInitializer(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
index 2666023..e3bc1e2 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/GoodClass.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class GoodClass extends JavaUDF
{
- public GoodClass(DataType returnDataType, DataType[] argDataTypes)
+ public GoodClass(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
index 0059a0a..2927b3e 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronized.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronized extends JavaUDF
{
- public UseOfSynchronized(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronized(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
index 2da13b6..7ef2e1c 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotify.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithNotify extends JavaUDF
{
- public UseOfSynchronizedWithNotify(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithNotify(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
index 1e4d33d..50a3da8 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithNotifyAll.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithNotifyAll extends JavaUDF
{
- public UseOfSynchronizedWithNotifyAll(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithNotifyAll(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
index ccaf6ee..135c550 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWait.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWait extends JavaUDF
{
- public UseOfSynchronizedWithWait(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWait(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
index 56aa726..4e49e5b 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitL.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWaitL extends JavaUDF
{
- public UseOfSynchronizedWithWaitL(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWaitL(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
index 403fb68..6770e7a 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/udfverify/UseOfSynchronizedWithWaitLI.java
@@ -21,7 +21,7 @@ package org.apache.cassandra.cql3.validation.entities.udfverify;
import java.nio.ByteBuffer;
import java.util.List;
-import com.datastax.driver.core.DataType;
+import com.datastax.driver.core.TypeCodec;
import org.apache.cassandra.cql3.functions.JavaUDF;
/**
@@ -29,7 +29,7 @@ import org.apache.cassandra.cql3.functions.JavaUDF;
*/
public final class UseOfSynchronizedWithWaitLI extends JavaUDF
{
- public UseOfSynchronizedWithWaitLI(DataType returnDataType, DataType[] argDataTypes)
+ public UseOfSynchronizedWithWaitLI(TypeCodec<Object> returnDataType, TypeCodec<Object>[] argDataTypes)
{
super(returnDataType, argDataTypes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a76a8efc/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
index 221f48e..9c05232 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
@@ -22,12 +22,21 @@ import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
+import java.util.Locale;
import java.util.TimeZone;
+import java.util.concurrent.ThreadLocalRandom;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.TurboFilterList;
+import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter;
+import ch.qos.logback.classic.turbo.TurboFilter;
import org.apache.cassandra.config.Schema;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.QueryProcessor;
@@ -1731,4 +1740,84 @@ public class AggregationTest extends CQLTester
execute("INSERT INTO %s (a, b) VALUES (3, 2)");
assertRows(execute("SELECT " + a + "(b) FROM %s"), row(Arrays.asList("1", "2")));
}
+
+ @Test
+ public void testLogbackReload() throws Throwable
+ {
+ // see https://issues.apache.org/jira/browse/CASSANDRA-11033
+
+ // make logback's scan interval 1ms - boilerplate, but necessary for this test
+ configureLogbackScanPeriod(1L);
+ try
+ {
+
+ createTable("CREATE TABLE %s (" +
+ " year int PRIMARY KEY," +
+ " country text," +
+ " title text)");
+
+ String[] countries = Locale.getISOCountries();
+ ThreadLocalRandom rand = ThreadLocalRandom.current();
+ for (int i = 0; i < 10000; i++)
+ {
+ execute("INSERT INTO %s (year, country, title) VALUES (1980,?,?)",
+ countries[rand.nextInt(countries.length)],
+ "title-" + i);
+ }
+
+ String albumCountByCountry = createFunction(KEYSPACE,
+ "map<text,bigint>,text,text",
+ "CREATE FUNCTION IF NOT EXISTS %s(state map<text,bigint>,country text, album_title text)\n" +
+ " RETURNS NULL ON NULL INPUT\n" +
+ " RETURNS map<text,bigint>\n" +
+ " LANGUAGE java\n" +
+ " AS $$\n" +
+ " if(state.containsKey(country)) {\n" +
+ " Long newCount = (Long)state.get(country) + 1;\n" +
+ " state.put(country, newCount);\n" +
+ " } else {\n" +
+ " state.put(country, 1L);\n" +
+ " }\n" +
+ " return state;\n" +
+ " $$;");
+
+ String releasesByCountry = createAggregate(KEYSPACE,
+ "text, text",
+ " CREATE AGGREGATE IF NOT EXISTS %s(text, text)\n" +
+ " SFUNC " + shortFunctionName(albumCountByCountry) + '\n' +
+ " STYPE map<text,bigint>\n" +
+ " INITCOND { };");
+
+ for (int i = 0; i < 1000; i++)
+ {
+ execute("SELECT " + releasesByCountry + "(country,title) FROM %s WHERE year=1980");
+ }
+ }
+ finally
+ {
+ configureLogbackScanPeriod(60000L);
+ }
+ }
+
+ private static void configureLogbackScanPeriod(long millis)
+ {
+ Logger l = LoggerFactory.getLogger(AggregationTest.class);
+ ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) l;
+ LoggerContext ctx = logbackLogger.getLoggerContext();
+ TurboFilterList turboFilterList = ctx.getTurboFilterList();
+ boolean done = false;
+ for (TurboFilter turboFilter : turboFilterList)
+ {
+ if (turboFilter instanceof ReconfigureOnChangeFilter)
+ {
+ ReconfigureOnChangeFilter reconfigureFilter = (ReconfigureOnChangeFilter) turboFilter;
+ reconfigureFilter.setRefreshPeriod(millis);
+ reconfigureFilter.stop();
+ reconfigureFilter.start(); // start() sets the next check timestammp
+ done = true;
+ break;
+ }
+ }
+ assertTrue("ReconfigureOnChangeFilter not in logback's turbo-filter list - do that by adding scan=\"true\" to logback-test.xml's configuration element", done);
+ }
}
[3/3] cassandra git commit: Merge branch 'cassandra-3.0' into trunk
Posted by sn...@apache.org.
Merge branch 'cassandra-3.0' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fdee887b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fdee887b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fdee887b
Branch: refs/heads/trunk
Commit: fdee887b425777eead75ac8f00a2128a6d2c03f8
Parents: aca2a1d a76a8ef
Author: Robert Stupp <sn...@snazy.de>
Authored: Fri Feb 19 10:30:50 2016 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Fri Feb 19 10:30:50 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cql3/functions/JavaBasedUDFunction.java | 10 +--
.../cassandra/cql3/functions/JavaUDF.java | 30 +++----
.../cql3/functions/ScriptBasedUDFunction.java | 2 +-
.../cql3/functions/UDFByteCodeVerifier.java | 4 +-
.../cassandra/cql3/functions/UDFunction.java | 31 +++----
.../cassandra/cql3/functions/UDHelper.java | 29 ++++---
.../cassandra/cql3/functions/JavaSourceUDF.txt | 6 +-
test/conf/logback-test.xml | 2 +-
.../entities/udfverify/CallClone.java | 4 +-
.../entities/udfverify/CallComDatastax.java | 4 +-
.../entities/udfverify/CallFinalize.java | 4 +-
.../entities/udfverify/CallOrgApache.java | 4 +-
.../entities/udfverify/ClassWithField.java | 4 +-
.../udfverify/ClassWithInitializer.java | 4 +-
.../udfverify/ClassWithInitializer2.java | 4 +-
.../udfverify/ClassWithInitializer3.java | 4 +-
.../udfverify/ClassWithStaticInitializer.java | 4 +-
.../entities/udfverify/GoodClass.java | 4 +-
.../entities/udfverify/UseOfSynchronized.java | 4 +-
.../udfverify/UseOfSynchronizedWithNotify.java | 4 +-
.../UseOfSynchronizedWithNotifyAll.java | 4 +-
.../udfverify/UseOfSynchronizedWithWait.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitL.java | 4 +-
.../udfverify/UseOfSynchronizedWithWaitLI.java | 4 +-
.../validation/operations/AggregationTest.java | 89 ++++++++++++++++++++
26 files changed, 183 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fdee887b/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 830bef1,ae9d545..c12cc50
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,31 -1,5 +1,32 @@@
-3.0.4
+3.4
+ * fix TrackerTest to handle new notifications (CASSANDRA-11178)
+ * add SASI validation for partitioner and complex columns (CASSANDRA-11169)
+ * Add caching of encrypted credentials in PasswordAuthenticator (CASSANDRA-7715)
+ * fix SASI memtable switching on flush (CASSANDRA-11159)
+ * Remove duplicate offline compaction tracking (CASSANDRA-11148)
+ * fix EQ semantics of analyzed SASI indexes (CASSANDRA-11130)
+ * Support long name output for nodetool commands (CASSANDRA-7950)
+ * Encrypted hints (CASSANDRA-11040)
+ * SASI index options validation (CASSANDRA-11136)
+ * Optimize disk seek using min/max column name meta data when the LIMIT clause is used
+ (CASSANDRA-8180)
+ * Add LIKE support to CQL3 (CASSANDRA-11067)
+ * Generic Java UDF types (CASSANDRA-10819)
+ * cqlsh: Include sub-second precision in timestamps by default (CASSANDRA-10428)
+ * Set javac encoding to utf-8 (CASSANDRA-11077)
+ * Integrate SASI index into Cassandra (CASSANDRA-10661)
+ * Add --skip-flush option to nodetool snapshot
+ * Skip values for non-queried columns (CASSANDRA-10657)
+ * Add support for secondary indexes on static columns (CASSANDRA-8103)
+ * CommitLogUpgradeTestMaker creates broken commit logs (CASSANDRA-11051)
+ * Add metric for number of dropped mutations (CASSANDRA-10866)
+ * Simplify row cache invalidation code (CASSANDRA-10396)
+ * Support user-defined compaction through nodetool (CASSANDRA-10660)
+ * Stripe view locks by key and table ID to reduce contention (CASSANDRA-10981)
+ * Add nodetool gettimeout and settimeout commands (CASSANDRA-10953)
+ * Add 3.0 metadata to sstablemetadata output (CASSANDRA-10838)
+Merged from 3.0:
+ * Prevent logging in sandboxed state (CASSANDRA-11033)
* Disallow drop/alter operations of UDTs used by UDAs (CASSANDRA-10721)
* Add query time validation method on Index (CASSANDRA-11043)
* Avoid potential AssertionError in mixed version cluster (CASSANDRA-11128)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fdee887b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
index b1dd9f9,660d494..ae30adc
--- a/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
+++ b/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java
@@@ -189,10 -184,10 +189,10 @@@ public final class JavaBasedUDFunction
super(name, argNames, argTypes, UDHelper.driverTypes(argTypes),
returnType, UDHelper.driverType(returnType), calledOnNullInput, "java", body);
- // javaParamTypes is just the Java representation for argTypes resp. argCodecs
- Class<?>[] javaParamTypes = UDHelper.javaTypes(argCodecs, calledOnNullInput);
- // javaReturnType is just the Java representation for returnType resp. returnCodec
- Class<?> javaReturnType = UDHelper.asJavaClass(returnCodec);
+ // javaParamTypes is just the Java representation for argTypes resp. argDataTypes
- TypeToken<?>[] javaParamTypes = UDHelper.typeTokens(argDataTypes, calledOnNullInput);
++ TypeToken<?>[] javaParamTypes = UDHelper.typeTokens(argCodecs, calledOnNullInput);
+ // javaReturnType is just the Java representation for returnType resp. returnDataType
- TypeToken<?> javaReturnType = UDHelper.asTypeToken(returnDataType);
++ TypeToken<?> javaReturnType = returnCodec.getJavaType();
// put each UDF in a separate package to prevent cross-UDF code access
String pkgName = BASE_PACKAGE + '.' + generateClassName(name, 'p');
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fdee887b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/functions/UDHelper.java
index 6237369,45c734f..4effdc3
--- a/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
+++ b/src/java/org/apache/cassandra/cql3/functions/UDHelper.java
@@@ -70,12 -76,12 +78,12 @@@ public final class UDHelpe
* @param calledOnNullInput whether to allow {@code null} as an argument value
* @return array of same size with UDF arguments
*/
- public static TypeToken<?>[] typeTokens(DataType[] dataTypes, boolean calledOnNullInput)
- public static Class<?>[] javaTypes(TypeCodec<Object>[] dataTypes, boolean calledOnNullInput)
++ public static TypeToken<?>[] typeTokens(TypeCodec<Object>[] dataTypes, boolean calledOnNullInput)
{
- Class<?>[] paramTypes = new Class[dataTypes.length];
+ TypeToken<?>[] paramTypes = new TypeToken[dataTypes.length];
for (int i = 0; i < paramTypes.length; i++)
{
- TypeToken<?> typeToken = asTypeToken(dataTypes[i]);
- Class<?> clazz = asJavaClass(dataTypes[i]);
++ TypeToken<?> typeToken = dataTypes[i].getJavaType();
if (!calledOnNullInput)
{
// only care about classes that can be used in a data type
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fdee887b/test/conf/logback-test.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fdee887b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------