brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] git commit: Fix Cassandra v2
Date Fri, 31 Oct 2014 15:35:30 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master f3b967f44 -> e83025110


Fix Cassandra v2

- roll back to 2.0.9
- let bin/cassandra write pid, rather than us writing pid

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/327a2b95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/327a2b95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/327a2b95

Branch: refs/heads/master
Commit: 327a2b950e556118f943906220e9a5a5b5f77eb3
Parents: 63f29bd
Author: Aled Sage <aled.sage@gmail.com>
Authored: Fri Oct 31 14:36:08 2014 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri Oct 31 14:36:08 2014 +0000

----------------------------------------------------------------------
 .../nosql/cassandra/CassandraNodeSshDriver.java | 22 +++++++++++++++-----
 .../cassandra/CassandraNodeIntegrationTest.java |  9 +++++++-
 2 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/327a2b95/software/nosql/src/main/java/brooklyn/entity/nosql/cassandra/CassandraNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/cassandra/CassandraNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/cassandra/CassandraNodeSshDriver.java
index 65ed4a6..9a54c8a 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/cassandra/CassandraNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/cassandra/CassandraNodeSshDriver.java
@@ -117,10 +117,14 @@ public class CassandraNodeSshDriver extends JavaSoftwareProcessSshDriver
impleme
         return "apache-cassandra-"+getVersion();
     }
     
+    protected boolean isV2() {
+        String version = getVersion();
+        return version.startsWith("2.");
+    }
+    
     @Override
     public boolean installJava() {
-        String version = getVersion();
-        if (version.startsWith("2.")) {
+        if (isV2()) {
             return checkForAndInstallJava7or8();
         } else {
             return super.installJava();
@@ -292,12 +296,14 @@ public class CassandraNodeSshDriver extends JavaSoftwareProcessSshDriver
impleme
         }
 
         try {
-            newScript(MutableMap.of(USE_PID_FILE, getPidFile()), LAUNCHING)
+            // Relies on `bin/cassandra -p <pidfile>`, rather than us writing pid file
ourselves.
+            newScript(MutableMap.of(USE_PID_FILE, false), LAUNCHING)
                     .body.append(
                             // log the date to attempt to debug occasional http://wiki.apache.org/cassandra/FAQ#schema_disagreement
                             // (can be caused by machines out of synch time-wise; but in
our case it seems to be caused by other things!)
                             "echo date on cassandra server `hostname` when launching is `date`",
-                            launchEssentialCommand())
+                            launchEssentialCommand(),
+                            "echo after essential command")
                     .execute();
             if (!isClustered()) {
                 InputStream creationScript = DatastoreMixins.getDatabaseCreationScript(entity);
@@ -337,7 +343,13 @@ public class CassandraNodeSshDriver extends JavaSoftwareProcessSshDriver
impleme
     }
     
     protected String launchEssentialCommand() {
-        return String.format("nohup ./bin/cassandra -p %s > ./cassandra-console.log 2>&1
&", getPidFile());
+        if (isV2()) {
+            return String.format("./bin/cassandra -p %s > ./cassandra-console.log 2>&1",
getPidFile());
+        } else {
+            // TODO Could probably get rid of the nohup here, as script does equivalent itself
+            // with `exec ... <&- &`
+            return String.format("nohup ./bin/cassandra -p %s > ./cassandra-console.log
2>&1 &", getPidFile());
+        }
     }
 
     public String getPidFile() { return Os.mergePathsUnix(getRunDir(), "cassandra.pid");
}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/327a2b95/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
index 9c3989c..06686dd 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
@@ -83,7 +83,14 @@ public class CassandraNodeIntegrationTest extends AbstractCassandraNodeTest
{
      */
     @Test(groups = "Integration")
     public void testCassandraVersion2() throws Exception {
-        String version = "2.0.11";
+        // TODO In v2.0.10, the bin/cassandra script changed to add an additional check for
JMX connectivity.
+        // This causes cassandera script to hang for us (presumably due to the CLASSPATH/JVM_OPTS
we're passing
+        // in, regarding JMX agent).
+        // See:
+        //  - https://issues.apache.org/jira/browse/CASSANDRA-7254
+        //  - https://github.com/apache/cassandra/blame/trunk/bin/cassandra#L211-216
+        
+        String version = "2.0.9";
         String majorMinorVersion = "2.0";
         
         cassandra = app.createAndManageChild(EntitySpec.create(CassandraNode.class)


Mime
View raw message