You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2015/11/24 19:07:49 UTC
[1/4] incubator-brooklyn git commit: Ensure deterministic
DynamicCluster member removal order
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master 09b4e2361 -> 9a9e780e8
Ensure deterministic DynamicCluster member removal order
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/5947eb97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/5947eb97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/5947eb97
Branch: refs/heads/master
Commit: 5947eb97d6a6559101be367bbbdf0c7be0d2f4ef
Parents: 4a03c46
Author: Mike Zaccardo <mi...@cloudsoftcorp.com>
Authored: Tue Nov 24 10:59:54 2015 -0500
Committer: Mike Zaccardo <mi...@cloudsoftcorp.com>
Committed: Tue Nov 24 10:59:54 2015 -0500
----------------------------------------------------------------------
.../entity/group/DynamicClusterImpl.java | 23 ++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5947eb97/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
index ac79dd6..61180db 100644
--- a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
@@ -139,18 +139,33 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements DynamicClus
private static final Function<Collection<Entity>, Entity> defaultRemovalStrategy = new Function<Collection<Entity>, Entity>() {
@Override public Entity apply(Collection<Entity> contenders) {
- // choose newest entity that is stoppable, or if none are stoppable take the newest non-stoppable
- long newestTime = 0;
+ /*
+ * Choose the newest entity (largest cluster member ID or latest timestamp) that is stoppable.
+ * If none are stoppable, take the newest non-stoppable.
+ *
+ * Both cluster member ID and timestamp must be taken into consideration to account for legacy
+ * clusters that were created before the addition of the cluster member ID config value.
+ */
+ int largestClusterMemberId = -1;
+ long newestTime = 0L;
Entity newest = null;
for (Entity contender : contenders) {
- boolean newer = contender.getCreationTime() > newestTime;
+ Integer contenderClusterMemberId = contender.config().get(CLUSTER_MEMBER_ID);
+ long contenderCreationTime = contender.getCreationTime();
+
+ boolean newer = (contenderClusterMemberId != null && contenderClusterMemberId > largestClusterMemberId) ||
+ contenderCreationTime > newestTime;
+
if ((contender instanceof Startable && newer) ||
(!(newest instanceof Startable) && ((contender instanceof Startable) || newer))) {
newest = contender;
- newestTime = contender.getCreationTime();
+
+ if (contenderClusterMemberId != null) largestClusterMemberId = contenderClusterMemberId;
+ newestTime = contenderCreationTime;
}
}
+
return newest;
}
};
[3/4] incubator-brooklyn git commit: Closes #1058
Posted by sv...@apache.org.
Closes #1058
Ensure deterministic DynamicCluster member removal order
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3af24b3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3af24b3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3af24b3b
Branch: refs/heads/master
Commit: 3af24b3b76571808c5c397cb3c71319e49c9bae7
Parents: 09b4e23 5947eb9
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue Nov 24 20:06:52 2015 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Tue Nov 24 20:06:52 2015 +0200
----------------------------------------------------------------------
.../entity/group/DynamicClusterImpl.java | 23 ++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[4/4] incubator-brooklyn git commit: Closes #1067
Posted by sv...@apache.org.
Closes #1067
ShellTool/SshTool tests: always call connect()
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/9a9e780e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/9a9e780e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/9a9e780e
Branch: refs/heads/master
Commit: 9a9e780e8eca9b927295ea3a10e69f34ea0b2f96
Parents: 3af24b3 6eddb66
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue Nov 24 20:07:39 2015 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Tue Nov 24 20:07:39 2015 +0200
----------------------------------------------------------------------
.../brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java | 4 ++++
.../util/core/internal/ssh/SshToolAbstractIntegrationTest.java | 1 +
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
[2/4] incubator-brooklyn git commit: ShellTool/SshTool tests: always
call connect()
Posted by sv...@apache.org.
ShellTool/SshTool tests: always call connect()
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/6eddb66f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/6eddb66f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/6eddb66f
Branch: refs/heads/master
Commit: 6eddb66fd4619b0b80924ab7a002ac1854d53ae8
Parents: c89d136
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 24 17:36:20 2015 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Nov 24 17:36:20 2015 +0000
----------------------------------------------------------------------
.../brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java | 4 ++++
.../util/core/internal/ssh/SshToolAbstractIntegrationTest.java | 1 +
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6eddb66f/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java
index ca3e0f5..a9d34a5 100644
--- a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java
+++ b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ShellToolAbstractTest.java
@@ -336,6 +336,7 @@ public abstract class ShellToolAbstractTest {
@Test(groups = {"Integration"})
public void testScriptHeader() {
final ShellTool localtool = newTool();
+ connect(localtool);
String out = execScript(MutableMap.of("scriptHeader", "#!/bin/bash -e\necho hello world\n"),
localtool, Arrays.asList("echo goodbye world"), null);
assertTrue(out.contains("goodbye world"), "no goodbye in output: "+out);
@@ -345,6 +346,7 @@ public abstract class ShellToolAbstractTest {
@Test(groups = {"Integration"})
public void testStdErr() {
final ShellTool localtool = newTool();
+ connect(localtool);
Map<String,Object> props = new LinkedHashMap<String, Object>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
@@ -359,6 +361,7 @@ public abstract class ShellToolAbstractTest {
@Test(groups = {"Integration"})
public void testRunAsRoot() {
final ShellTool localtool = newTool();
+ connect(localtool);
Map<String,Object> props = new LinkedHashMap<String, Object>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
@@ -379,6 +382,7 @@ public abstract class ShellToolAbstractTest {
@Test(groups = {"Integration"})
public void testExecScriptEchosDontExecuteWhenToldNoExtraOutput() throws Exception {
final ShellTool localtool = newTool();
+ connect(localtool);
Map<String,Object> props = new LinkedHashMap<String, Object>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6eddb66f/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java
index a3bee86..07ca008 100644
--- a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java
+++ b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/SshToolAbstractIntegrationTest.java
@@ -225,6 +225,7 @@ public abstract class SshToolAbstractIntegrationTest extends ShellToolAbstractTe
@Test(groups = {"Integration"})
public void testAllocatePty() {
final ShellTool localtool = newTool(MutableMap.of("host", "localhost", SshTool.PROP_ALLOCATE_PTY.getName(), true));
+ connect(localtool);
Map<String,Object> props = new LinkedHashMap<String, Object>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();