You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by vi...@apache.org on 2013/08/03 20:26:39 UTC
git commit: Fix trigger directory detection code Patch by Vijay,
reviewed by jebllis for CASSANDRA-5826
Updated Branches:
refs/heads/trunk 98214bb6a -> 4f2fdc2e7
Fix trigger directory detection code
Patch by Vijay, reviewed by jebllis for CASSANDRA-5826
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/4f2fdc2e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/4f2fdc2e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/4f2fdc2e
Branch: refs/heads/trunk
Commit: 4f2fdc2e73d4b72b1b8203748b12ea57affcc155
Parents: 98214bb
Author: Vijay Parthasarathy <vi...@gmail.com>
Authored: Sat Aug 3 11:21:07 2013 -0700
Committer: Vijay Parthasarathy <vi...@gmail.com>
Committed: Sat Aug 3 11:21:07 2013 -0700
----------------------------------------------------------------------
conf/triggers/README.txt | 0
debian/cassandra.install | 1 +
examples/triggers/README.txt | 2 +-
.../cassandra/triggers/TriggerExecutor.java | 2 +-
.../org/apache/cassandra/utils/FBUtilities.java | 13 ++++++++++---
test/conf/triggers/README.txt | 0
test/data/serialization/2.0/db.RowMutation.bin | Bin 3599 -> 3599 bytes
test/triggers/README.txt | 0
triggers/README.txt | 0
9 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/conf/triggers/README.txt
----------------------------------------------------------------------
diff --git a/conf/triggers/README.txt b/conf/triggers/README.txt
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/debian/cassandra.install
----------------------------------------------------------------------
diff --git a/debian/cassandra.install b/debian/cassandra.install
index d7a2242..5dba772 100644
--- a/debian/cassandra.install
+++ b/debian/cassandra.install
@@ -6,6 +6,7 @@ conf/cassandra-rackdc.properties etc/cassandra
conf/commitlog_archiving.properties etc/cassandra
conf/cassandra-topology.properties etc/cassandra
conf/log4j-tools.properties etc/cassandra
+conf/triggers/* etc/cassandra/triggers
debian/cassandra.in.sh usr/share/cassandra
debian/cassandra.conf etc/security/limits.d
debian/cassandra-sysctl.conf etc/sysctl.d
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/examples/triggers/README.txt
----------------------------------------------------------------------
diff --git a/examples/triggers/README.txt b/examples/triggers/README.txt
index 7346144..a99fa98 100644
--- a/examples/triggers/README.txt
+++ b/examples/triggers/README.txt
@@ -11,7 +11,7 @@ Installation:
============
change directory to <cassandra_src_dir>/examples/triggers
run "ant jar"
-Copy build/trigger-example.jar to <cassandra_home>/triggers/
+Copy build/trigger-example.jar to <cassandra_conf>/triggers/
Copy conf/* to <cassandra_home>/conf/
Create column family configured in InvertedIndex.properties
Example: Keyspace1.InvertedIndex as configured in InvertedIndex.properties
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
index c3a2c44..c6feb84 100644
--- a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
+++ b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
@@ -42,7 +42,7 @@ public class TriggerExecutor
private final Map<String, ITrigger> cachedTriggers = Maps.newConcurrentMap();
private final ClassLoader parent = Thread.currentThread().getContextClassLoader();
- private final File triggerDirectory = new File(FBUtilities.cassandraHomeDir(), "triggers");
+ private final File triggerDirectory = FBUtilities.cassandraTriggerDir();
private volatile ClassLoader customClassLoader;
private TriggerExecutor()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index 379c0eb..7873ce7 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -69,6 +69,7 @@ public class FBUtilities
private static ObjectMapper jsonMapper = new ObjectMapper(new JsonFactory());
public static final BigInteger TWO = new BigInteger("2");
+ private static final String DEFAULT_TRIGGER_DIR = "triggers";
private static volatile InetAddress localInetAddress;
private static volatile InetAddress broadcastInetAddress;
@@ -341,10 +342,16 @@ public class FBUtilities
return scpurl.getFile();
}
- public static File cassandraHomeDir()
+ public static File cassandraTriggerDir()
{
- String libDir = new File(FBUtilities.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
- return new File(new File(libDir).getParent());
+ File triggerDir;
+ if (System.getProperty("cassandra.triggers_dir") != null)
+ triggerDir = new File(System.getProperty("cassandra.triggers_dir"));
+ else
+ triggerDir = new File(FBUtilities.class.getClassLoader().getResource(DEFAULT_TRIGGER_DIR).getFile());
+ if (!triggerDir.exists())
+ throw new RuntimeException("Trigger Directory doesnt exist, please create inside conf.");
+ return triggerDir;
}
public static String getReleaseVersionString()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/test/conf/triggers/README.txt
----------------------------------------------------------------------
diff --git a/test/conf/triggers/README.txt b/test/conf/triggers/README.txt
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/test/data/serialization/2.0/db.RowMutation.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/2.0/db.RowMutation.bin b/test/data/serialization/2.0/db.RowMutation.bin
index 698b0b6..aa75378 100644
Binary files a/test/data/serialization/2.0/db.RowMutation.bin and b/test/data/serialization/2.0/db.RowMutation.bin differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/test/triggers/README.txt
----------------------------------------------------------------------
diff --git a/test/triggers/README.txt b/test/triggers/README.txt
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f2fdc2e/triggers/README.txt
----------------------------------------------------------------------
diff --git a/triggers/README.txt b/triggers/README.txt
deleted file mode 100644
index e69de29..0000000