You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2018/01/03 10:58:10 UTC
[1/4] brooklyn-server git commit: DynamicCluster: resize to maxSize,
before throwing InsufficientCapacity
Repository: brooklyn-server
Updated Branches:
refs/heads/master b6df5bd84 -> 483c4afbf
DynamicCluster: resize to maxSize, before throwing InsufficientCapacity
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/72b0bf1e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/72b0bf1e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/72b0bf1e
Branch: refs/heads/master
Commit: 72b0bf1e38330806f5168fb613c3ae75c8307077
Parents: cd5be20
Author: Aled Sage <al...@gmail.com>
Authored: Thu Dec 21 15:21:22 2017 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Dec 21 15:21:22 2017 +0000
----------------------------------------------------------------------
.../brooklyn/entity/group/DynamicClusterImpl.java | 12 +++++++++---
.../brooklyn/entity/group/DynamicClusterTest.java | 18 ++++++++++++++++++
2 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/72b0bf1e/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 7102b3b..9b8b00a 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
@@ -797,10 +797,16 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements DynamicClus
Preconditions.checkArgument(delta > 0, "Must call grow with positive delta.");
Integer maxSize = config().get(MAX_SIZE);
if (maxSize != null) {
- final int desiredSize = getCurrentSize() + delta;
- if (desiredSize > maxSize) {
+ Integer currentSize = getCurrentSize();
+ final int desiredSize = currentSize + delta;
+ if (currentSize >= maxSize) {
throw new Resizable.InsufficientCapacityException(
- "Desired cluster size " + desiredSize + " exceeds maximum size of " + maxSize);
+ "Current cluster size " + currentSize + " already at maximum permitted");
+ } else if (desiredSize > maxSize) {
+ int allowedDelta = (maxSize - currentSize);
+ LOG.warn("Desired cluster size " + desiredSize + " exceeds maximum size of " + maxSize
+ + "; will only grow by " + allowedDelta + " instead of " + delta + " for " + this);
+ delta = allowedDelta;
}
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/72b0bf1e/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
index f7dc408..1984a0f 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
@@ -1416,6 +1416,24 @@ public class DynamicClusterTest extends AbstractDynamicClusterOrFabricTest {
}
}
+ @Test
+ public void testGrowsToClusterMaxSize() {
+ DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
+ .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TestEntity.class))
+ .configure(DynamicCluster.INITIAL_SIZE, 1)
+ .configure(DynamicCluster.MAX_SIZE, 3));
+ cluster.start(ImmutableList.of(loc));
+
+ cluster.resize(4);
+ Assert.assertEquals(cluster.getCurrentSize(), Integer.valueOf(3));
+ Assert.assertEquals(Iterables.size(Iterables.filter(Entities.descendantsAndSelf(app), TestEntity.class)), 3);
+
+ cluster.resize(1);
+ cluster.resizeByDelta(3);
+ Assert.assertEquals(cluster.getCurrentSize(), Integer.valueOf(3));
+ Assert.assertEquals(Iterables.size(Iterables.filter(Entities.descendantsAndSelf(app), TestEntity.class)), 3);
+ }
+
@ImplementedBy(ThrowOnAsyncStartEntityImpl.class)
public interface ThrowOnAsyncStartEntity extends TestEntity {
ConfigKey<Integer> MAX_CONCURRENCY = ConfigKeys.newConfigKey(Integer.class, "concurrency", "max concurrency", 1);
[2/4] brooklyn-server git commit: Fix reporting of master ID when web
API used before persistence is ready
Posted by he...@apache.org.
Fix reporting of master ID when web API used before persistence is ready
ServerResource#getHighAvailabilityPlaneStates obtains a new plane sync
record when the master node ID in the first one it obtained is null.
This generally only happens when the web-console tries to obtain the
HA status before the server has started up.
Fixes https://issues.apache.org/jira/browse/BROOKLYN-167.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4eafdba9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4eafdba9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4eafdba9
Branch: refs/heads/master
Commit: 4eafdba9fb89b7c62f0aaacb296261459b8f29ed
Parents: 47d8705
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Fri Dec 22 13:34:06 2017 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Dec 22 13:34:06 2017 +0000
----------------------------------------------------------------------
.../core/mgmt/ha/HighAvailabilityManagerImpl.java | 14 +++++++-------
.../brooklyn/rest/resources/ServerResource.java | 8 ++++++--
2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4eafdba9/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
index 7220091..9205b0a 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
@@ -234,7 +234,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
* Defaults to null which means to use the remote timestamp.
* Only for testing as this records the remote timestamp in the object.
* <p>
- * If this is supplied, one must also set {@link ManagementPlaneSyncRecordPersisterToObjectStore#useRemoteTimestampInMemento()}. */
+ * If this is supplied, one must also set {@link ManagementPlaneSyncRecordPersisterToObjectStore#preferRemoteTimestampInMemento()}. */
@VisibleForTesting
public HighAvailabilityManagerImpl setRemoteTicker(Ticker val) {
this.optionalRemoteTickerUtc = val;
@@ -570,11 +570,6 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
return myNodeState;
}
- @Override
- public ManagementPlaneSyncRecord getLastManagementPlaneSyncRecord() {
- return lastSyncRecord;
- }
-
protected void registerPollTask() {
final Runnable job = new Runnable() {
private boolean lastFailed;
@@ -1003,6 +998,11 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
lastSyncRecord = record;
return record;
}
+
+ @Override
+ public ManagementPlaneSyncRecord getLastManagementPlaneSyncRecord() {
+ return lastSyncRecord;
+ }
private ManagementPlaneSyncRecord loadManagementPlaneSyncRecordInternal(boolean useLocalKnowledgeForThisNode) {
if (disabled) {
@@ -1020,7 +1020,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
LOG.debug("High availablity manager has no persister; returning empty record");
return ManagementPlaneSyncRecordImpl.builder().build();
}
-
+
int maxLoadAttempts = 5;
Exception lastException = null;
Stopwatch timer = Stopwatch.createStarted();
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4eafdba9/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
index d1215bc..3c59624 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
@@ -29,7 +29,6 @@ import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
-
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@@ -52,6 +51,7 @@ import org.apache.brooklyn.core.entity.Attributes;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.StartableApplication;
import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
+import org.apache.brooklyn.core.mgmt.ShutdownHandler;
import org.apache.brooklyn.core.mgmt.entitlement.Entitlements;
import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils;
@@ -63,7 +63,6 @@ import org.apache.brooklyn.rest.domain.HighAvailabilitySummary;
import org.apache.brooklyn.rest.domain.VersionSummary;
import org.apache.brooklyn.rest.transform.BrooklynFeatureTransformer;
import org.apache.brooklyn.rest.transform.HighAvailabilityTransformer;
-import org.apache.brooklyn.core.mgmt.ShutdownHandler;
import org.apache.brooklyn.rest.util.WebResourceUtils;
import org.apache.brooklyn.util.collections.MutableMap;
import org.apache.brooklyn.util.core.ResourceUtils;
@@ -442,6 +441,11 @@ public class ServerResource extends AbstractBrooklynRestResource implements Serv
ManagementPlaneSyncRecord memento = mgmt().getHighAvailabilityManager().getLastManagementPlaneSyncRecord();
if (memento==null) memento = mgmt().getHighAvailabilityManager().loadManagementPlaneSyncRecord(true);
if (memento==null) return null;
+ // This may be the case if this method was called before persistence was properly initialised.
+ // Retry so that the server doesn't get stuck. See https://issues.apache.org/jira/browse/BROOKLYN-167.
+ if (memento.getMasterNodeId() == null) {
+ memento = mgmt().getHighAvailabilityManager().loadManagementPlaneSyncRecord(true);
+ }
return HighAvailabilityTransformer.highAvailabilitySummary(mgmt().getManagementNodeId(), memento);
}
[4/4] brooklyn-server git commit: This closes #923
Posted by he...@apache.org.
This closes #923
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/483c4afb
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/483c4afb
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/483c4afb
Branch: refs/heads/master
Commit: 483c4afbf6f6742bbfdb691160f9aaae263036cb
Parents: 20c4ecd 72b0bf1
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jan 3 10:57:53 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jan 3 10:57:53 2018 +0000
----------------------------------------------------------------------
.../brooklyn/entity/group/DynamicClusterImpl.java | 12 +++++++++---
.../brooklyn/entity/group/DynamicClusterTest.java | 18 ++++++++++++++++++
2 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[3/4] brooklyn-server git commit: This closes #925
Posted by he...@apache.org.
This closes #925
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/20c4ecd6
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/20c4ecd6
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/20c4ecd6
Branch: refs/heads/master
Commit: 20c4ecd6431c867c0401bcc459222df8b4ff70e9
Parents: b6df5bd 4eafdba
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jan 3 10:54:19 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jan 3 10:54:19 2018 +0000
----------------------------------------------------------------------
.../core/mgmt/ha/HighAvailabilityManagerImpl.java | 14 +++++++-------
.../brooklyn/rest/resources/ServerResource.java | 8 ++++++--
2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------