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 2017/01/05 21:30:40 UTC
[04/10] cassandra git commit: Remove support for non-JavaScript UDFs
Remove support for non-JavaScript UDFs
patch by Robert Stupp; reviewed by Tyler Hobbs for CASSANDRA-12883
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6f360b6d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6f360b6d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6f360b6d
Branch: refs/heads/trunk
Commit: 6f360b6d239a7b3d3b625e1bcefcaeb2f6b2be1d
Parents: 0cf0f67
Author: Robert Stupp <sn...@snazy.de>
Authored: Thu Jan 5 22:18:37 2017 +0100
Committer: Robert Stupp <sn...@snazy.de>
Committed: Thu Jan 5 22:19:50 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 16 ++++++++++++++++
.../cassandra/cql3/functions/ScriptBasedUDF.java | 5 +++++
3 files changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f360b6d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d31ffc8..b41313d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.9
+ * Remove support for non-JavaScript UDFs (CASSANDRA-12883)
* Fix DynamicEndpointSnitch noop in multi-datacenter situations (CASSANDRA-13074)
* cqlsh copy-from: encode column names to avoid primary key parsing errors (CASSANDRA-12909)
* Temporarily fix bug that creates commit log when running offline tools (CASSANDRA-8616)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f360b6d/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 0a3ab36..37949a1 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -13,6 +13,19 @@ restore snapshots created with the previous major version using the
'sstableloader' tool. You can upgrade the file format of your snapshots
using the provided 'sstableupgrade' tool.
+2.2.9
+=====
+
+Deprecation
+-----------
+
+(See note about the new feature User-Defined-Functions in 2.2.0.)
+
+Since the security manager added in 3.0 only allows Java and JavaScript
+UDFs to be run, UDFs for other languages are deprecated and support for
+non-Java and non-JavaScript UDFs is deprecated in 2.2 and has been removed
+in version 3.0.11.
+
2.2.8
=====
@@ -230,6 +243,9 @@ New features
3.0. This will inherently be backwards-incompatible with any 2.2
UDF that perform insecure operations such as opening a socket or
writing to the filesystem.
+
+ Per the previous note about adding a security manager in 3.0, this security manager
+ means that non JavaScipt UDF's won't run, there for their use is deprecated.
************************************************************************
- Row-cache is now fully off-heap.
- jemalloc is now automatically preloaded and used on Linux and OS-X if
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f360b6d/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDF.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDF.java b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDF.java
index e55d450..2d46934 100644
--- a/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDF.java
+++ b/src/java/org/apache/cassandra/cql3/functions/ScriptBasedUDF.java
@@ -73,6 +73,11 @@ public class ScriptBasedUDF extends UDFunction
{
super(name, argNames, argTypes, returnType, calledOnNullInput, language, body);
+ if (!"JavaScript".equalsIgnoreCase(language))
+ logger.warn("Support for UDFs using '" + language + "' has been deprecated and removed in 3.0. If '" +
+ language + "' actually is JavaScript, change the language used in CREATE/ALTER FUNCTION to " +
+ "'javascript'.");
+
Compilable scriptEngine = scriptEngines.get(language);
if (scriptEngine == null)
throw new InvalidRequestException(String.format("Invalid language '%s' for function '%s'", language, name));