You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/03/10 13:41:59 UTC
[1/3] incubator-brooklyn git commit: set IS_IN_CLUSTER on couchbase
primary node, fix problem noticed in #427
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master 0c74027ad -> fd22cc070
set IS_IN_CLUSTER on couchbase primary node, fix problem noticed in #427
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d26acd87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d26acd87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d26acd87
Branch: refs/heads/master
Commit: d26acd87c8dc8f995c94bf4f2deb1e8f8f2a018e
Parents: beeb4d8
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Jan 29 12:26:08 2015 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Jan 29 12:26:08 2015 +0000
----------------------------------------------------------------------
.../nosql/couchbase/CouchbaseClusterImpl.java | 9 +++++--
.../entity/nosql/couchbase/CouchbaseNode.java | 3 ++-
.../CouchbaseSyncGatewaySshDriver.java | 25 +++++++-------------
3 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d26acd87/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 7552928..0eb2586 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
@@ -229,8 +229,13 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
}
((CouchbaseNode)getPrimaryNode()).rebalance();
- } else if (getQuorumSize()>1) {
- log.warn(this+" is not quorate; will likely fail later, but proceeding for now");
+ } else {
+ if (getQuorumSize()>1) {
+ log.warn(this+" is not quorate; will likely fail later, but proceeding for now");
+ }
+ if (!serversToAdd.isEmpty()) {
+ ((EntityInternal) Iterables.getOnlyElement(serversToAdd)).setAttribute(CouchbaseNode.IS_IN_CLUSTER, true);
+ }
}
if (getConfig(CREATE_BUCKETS)!=null) {
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d26acd87/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNode.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNode.java b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNode.java
index f09114d..cb9f264 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNode.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNode.java
@@ -80,7 +80,8 @@ public interface CouchbaseNode extends SoftwareProcess {
PortAttributeSensorAndConfigKey NODE_DATA_EXCHANGE_PORT_RANGE_END = new PortAttributeSensorAndConfigKey("couchbase.nodeDataExchangePortRangeEnd", "Node data exchange Port Range End", "21199+");
AttributeSensor<Boolean> IS_PRIMARY_NODE = Sensors.newBooleanSensor("couchbase.isPrimaryNode", "flag to determine if the current couchbase node is the primary node for the cluster");
- AttributeSensor<Boolean> IS_IN_CLUSTER = Sensors.newBooleanSensor("couchbase.isInCluster", "flag to determine if the current couchbase node has been added to a cluster");
+ AttributeSensor<Boolean> IS_IN_CLUSTER = Sensors.newBooleanSensor("couchbase.isInCluster", "flag to determine if the current couchbase node has been added to a cluster, "
+ + "including being the first / primary node");
AttributeSensor<URI> COUCHBASE_WEB_ADMIN_URL = Attributes.MAIN_URI;
// Interesting stats
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d26acd87/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
index 164f60a..d21f9b5 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
@@ -26,12 +26,11 @@ import static java.lang.String.format;
import java.util.List;
-import javax.annotation.Nullable;
-
import brooklyn.entity.Entity;
import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
import brooklyn.entity.basic.Entities;
import brooklyn.entity.basic.EntityLocal;
+import brooklyn.entity.basic.EntityPredicates;
import brooklyn.entity.drivers.downloads.DownloadResolver;
import brooklyn.event.basic.DependentConfiguration;
import brooklyn.location.OsDetails;
@@ -42,7 +41,6 @@ import brooklyn.util.time.Duration;
import brooklyn.util.time.Time;
import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -88,22 +86,15 @@ public class CouchbaseSyncGatewaySshDriver extends AbstractSoftwareProcessSshDri
// Even once the bucket has published its API URL, it can still take a couple of seconds for it to become available
Time.sleep(10 * 1000);
if (cbNode instanceof CouchbaseCluster) {
- Optional<Entity> cbClusterNode = Iterables.tryFind(cbNode.getAttribute(CouchbaseCluster.GROUP_MEMBERS), new Predicate<Entity>() {
-
- @Override
- public boolean apply(@Nullable Entity entity) {
- // Must either be recognised by a cluster as added, or be the primary node in a cluster of ONE.
- return entity instanceof CouchbaseNode
- && (Boolean.TRUE.equals(entity.getAttribute(CouchbaseNode.IS_IN_CLUSTER))
- || Boolean.TRUE.equals(entity.getAttribute(CouchbaseNode.IS_PRIMARY_NODE)));
- }
- });
- if (cbClusterNode.isPresent()) {
- cbNode = cbClusterNode.get();
- } else {
+ // in_cluster now applies even to a node in a cluster of size 1
+ Optional<Entity> cbClusterNode = Iterables.tryFind(cbNode.getAttribute(CouchbaseCluster.GROUP_MEMBERS),
+ Predicates.and(Predicates.instanceOf(CouchbaseNode.class), EntityPredicates.attributeEqualTo(CouchbaseNode.IS_IN_CLUSTER, Boolean.TRUE)));
+
+ if (!cbClusterNode.isPresent()) {
throw new IllegalArgumentException(format("The cluster %s does not contain any suitable Couchbase nodes to connect to..", cbNode.getId()));
}
-
+
+ cbNode = cbClusterNode.get();
}
String hostname = cbNode.getAttribute(CouchbaseNode.HOSTNAME);
String webPort = cbNode.getAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT).toString();
[3/3] incubator-brooklyn git commit: This closes #488
Posted by al...@apache.org.
This closes #488
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/fd22cc07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/fd22cc07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/fd22cc07
Branch: refs/heads/master
Commit: fd22cc070df9332f96115be332305d18e67d5281
Parents: 0c74027 47d01d7
Author: Aled Sage <al...@gmail.com>
Authored: Tue Mar 10 12:41:45 2015 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Mar 10 12:41:45 2015 +0000
----------------------------------------------------------------------
.../nosql/couchbase/CouchbaseClusterImpl.java | 9 +++++--
.../entity/nosql/couchbase/CouchbaseNode.java | 3 ++-
.../CouchbaseSyncGatewaySshDriver.java | 25 +++++++-------------
3 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[2/3] incubator-brooklyn git commit: don't assume servers to add is a
singleton
Posted by al...@apache.org.
don't assume servers to add is a singleton
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/47d01d71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/47d01d71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/47d01d71
Branch: refs/heads/master
Commit: 47d01d719192e47ee4495431aad83dc94158387f
Parents: d26acd8
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Sat Feb 21 09:10:13 2015 -0800
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Feb 21 09:10:13 2015 -0800
----------------------------------------------------------------------
.../brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/47d01d71/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 0eb2586..8d26896 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
@@ -233,8 +233,8 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
if (getQuorumSize()>1) {
log.warn(this+" is not quorate; will likely fail later, but proceeding for now");
}
- if (!serversToAdd.isEmpty()) {
- ((EntityInternal) Iterables.getOnlyElement(serversToAdd)).setAttribute(CouchbaseNode.IS_IN_CLUSTER, true);
+ for (Entity server: serversToAdd) {
+ ((EntityInternal) server).setAttribute(CouchbaseNode.IS_IN_CLUSTER, true);
}
}