brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [10/18] git commit: tidy of couchbase logging and correct the destName (from the dest cluster ID)
Date Tue, 07 Oct 2014 23:59:49 GMT
tidy of couchbase logging and correct the destName (from the dest cluster ID)


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

Branch: refs/heads/master
Commit: ecaab97f20ec0e7084bd42223cd06a5f57ab17f0
Parents: 5697c1a
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Oct 6 22:52:13 2014 -0700
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Oct 6 22:52:36 2014 -0700

----------------------------------------------------------------------
 .../entity/nosql/couchbase/CouchbaseClusterImpl.java      | 10 ++++++++--
 .../entity/nosql/couchbase/CouchbaseNodeSshDriver.java    | 10 +++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ecaab97f/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
index 8adc308..9b7595c 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
@@ -27,6 +27,8 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.annotation.Nonnull;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -441,8 +443,13 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements
Couchbas
     public static String getClusterName(Entity node) {
         String name = node.getConfig(CLUSTER_NAME);
         if (!Strings.isBlank(name)) return Strings.makeValidFilename(name);
+        return getCluster(node).getId();
+    }
+    
+    /** returns Couchbase cluster in ancestry, defaulting to the given node if none */
+    @Nonnull public static Entity getCluster(Entity node) {
         Iterable<CouchbaseCluster> clusterNodes = Iterables.filter(Entities.ancestors(node),
CouchbaseCluster.class);
-        return Iterables.getFirst(clusterNodes, node).getId();
+        return Iterables.getFirst(clusterNodes, node);
     }
     
     public boolean isClusterInitialized() {
@@ -468,7 +475,6 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements
Couchbas
             Integer bucketRamSize = bucketMap.containsKey("bucket-ramsize") ? (Integer) bucketMap.get("bucket-ramsize")
: 200;
             Integer bucketReplica = bucketMap.containsKey("bucket-replica") ? (Integer) bucketMap.get("bucket-replica")
: 1;
 
-            log.info("adding bucket: {} to primary node: {}", bucketName, primaryNode.getId());
             createBucket(primaryNode, bucketName, bucketType, bucketPort, bucketRamSize,
bucketReplica);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ecaab97f/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
index 17a5a5a..a44a0f4 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
@@ -315,7 +315,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
                 }
             })
             .run();
-        log.info("rebalanced cluster via primary node {}", getEntity());
+        log.info("Rebalanced cluster via primary node {}", getEntity());
     }
 
     private Iterable<String> getNodesHostAndPort() throws URISyntaxException {
@@ -386,6 +386,8 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
 
     @Override
     public void bucketCreate(String bucketName, String bucketType, Integer bucketPort, Integer
bucketRamSize, Integer bucketReplica) {
+        log.info("Adding bucket: {} to cluster {} primary node: {}", new Object[] { bucketName,
CouchbaseClusterImpl.getCluster(getEntity()), getEntity() });
+        
         newScript("bucketCreate").body.append(couchbaseCli("bucket-create")
             + getCouchbaseHostnameAndCredentials() +
             " --bucket=" + bucketName +
@@ -401,9 +403,11 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
     public void addReplicationRule(Entity toCluster, String fromBucket, String toBucket)
{
         DynamicTasks.queue(DependentConfiguration.attributeWhenReady(toCluster, Attributes.SERVICE_UP)).getUnchecked();
         
-        log.info("Setting up XDCR for "+fromBucket+" from "+getEntity()+" to "+toCluster);
+        String destName = CouchbaseClusterImpl.getClusterName(toCluster);
+        
+        log.info("Setting up XDCR for "+fromBucket+" from "+CouchbaseClusterImpl.getClusterName(getEntity())+"
(via "+getEntity()+") "
+            + "to "+destName+" ("+toCluster+")");
         
-        String destName = CouchbaseClusterImpl.getClusterName(getEntity());
         Entity destPrimaryNode = toCluster.getAttribute(CouchbaseCluster.COUCHBASE_PRIMARY_NODE);
         String destHostname = destPrimaryNode.getAttribute(Attributes.HOSTNAME);
         String destUsername = toCluster.getConfig(CouchbaseNode.COUCHBASE_ADMIN_USERNAME);


Mime
View raw message