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 2015/05/26 18:47:10 UTC

[1/3] cassandra git commit: Duplicate compilation of UDFs on coordinator

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 2385dc2d9 -> 248ea0b34
  refs/heads/trunk 13409fdf0 -> f5f8806c4


Duplicate compilation of UDFs on coordinator

patch by Robert Stupp; reviewed by Tyler Hobbs for CASSANDRA-9475


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/248ea0b3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/248ea0b3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/248ea0b3

Branch: refs/heads/cassandra-2.2
Commit: 248ea0b3459eed6283418c63c467f5bf4e487206
Parents: 2385dc2
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 26 18:45:54 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 26 18:45:54 2015 +0200

----------------------------------------------------------------------
 .../cassandra/schema/LegacySchemaTables.java    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/248ea0b3/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/LegacySchemaTables.java b/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
index 720f309..a825972 100644
--- a/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
+++ b/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
@@ -1337,6 +1337,26 @@ public class LegacySchemaTables
         String body = row.getString("body");
         boolean calledOnNullInput = row.getBoolean("called_on_null_input");
 
+        org.apache.cassandra.cql3.functions.Function existing = org.apache.cassandra.cql3.functions.Functions.find(name, argTypes);
+        if (existing instanceof UDFunction)
+        {
+            // This check prevents duplicate compilation of effectively the same UDF.
+            // Duplicate compilation attempts can occur on the coordinator node handling the CREATE FUNCTION
+            // statement, since CreateFunctionStatement needs to execute UDFunction.create but schema migration
+            // also needs that (since it needs to handle its own change).
+            UDFunction udf = (UDFunction) existing;
+            if (udf.argNames().equals(argNames) && // arg types checked in Functions.find call
+                udf.returnType().equals(returnType) &&
+                !udf.isAggregate() &&
+                udf.language().equals(language) &&
+                udf.body().equals(body) &&
+                udf.isCalledOnNullInput() == calledOnNullInput)
+            {
+                logger.debug("Skipping duplicate compilation of already existing UDF {}", name);
+                return udf;
+            }
+        }
+
         try
         {
             return UDFunction.create(name, argNames, argTypes, returnType, calledOnNullInput, language, body);


[2/3] cassandra git commit: Duplicate compilation of UDFs on coordinator

Posted by sn...@apache.org.
Duplicate compilation of UDFs on coordinator

patch by Robert Stupp; reviewed by Tyler Hobbs for CASSANDRA-9475


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/248ea0b3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/248ea0b3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/248ea0b3

Branch: refs/heads/trunk
Commit: 248ea0b3459eed6283418c63c467f5bf4e487206
Parents: 2385dc2
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 26 18:45:54 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 26 18:45:54 2015 +0200

----------------------------------------------------------------------
 .../cassandra/schema/LegacySchemaTables.java    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/248ea0b3/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/LegacySchemaTables.java b/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
index 720f309..a825972 100644
--- a/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
+++ b/src/java/org/apache/cassandra/schema/LegacySchemaTables.java
@@ -1337,6 +1337,26 @@ public class LegacySchemaTables
         String body = row.getString("body");
         boolean calledOnNullInput = row.getBoolean("called_on_null_input");
 
+        org.apache.cassandra.cql3.functions.Function existing = org.apache.cassandra.cql3.functions.Functions.find(name, argTypes);
+        if (existing instanceof UDFunction)
+        {
+            // This check prevents duplicate compilation of effectively the same UDF.
+            // Duplicate compilation attempts can occur on the coordinator node handling the CREATE FUNCTION
+            // statement, since CreateFunctionStatement needs to execute UDFunction.create but schema migration
+            // also needs that (since it needs to handle its own change).
+            UDFunction udf = (UDFunction) existing;
+            if (udf.argNames().equals(argNames) && // arg types checked in Functions.find call
+                udf.returnType().equals(returnType) &&
+                !udf.isAggregate() &&
+                udf.language().equals(language) &&
+                udf.body().equals(body) &&
+                udf.isCalledOnNullInput() == calledOnNullInput)
+            {
+                logger.debug("Skipping duplicate compilation of already existing UDF {}", name);
+                return udf;
+            }
+        }
+
         try
         {
             return UDFunction.create(name, argNames, argTypes, returnType, calledOnNullInput, language, body);


[3/3] cassandra git commit: Merge branch 'cassandra-2.2' into trunk

Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f5f8806c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f5f8806c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f5f8806c

Branch: refs/heads/trunk
Commit: f5f8806c4ed449c371e5a21a572d201ee1fa3dce
Parents: 13409fd 248ea0b
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 26 18:46:34 2015 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 26 18:46:34 2015 +0200

----------------------------------------------------------------------
 .../cassandra/schema/LegacySchemaTables.java    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------