brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/13] incubator-brooklyn git commit: more HA change mode fixes
Date Wed, 19 Nov 2014 17:48:00 GMT
more HA change mode fixes


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

Branch: refs/heads/master
Commit: b9e8e6bc7bbc267dc80c1621b8f2febd128f8ece
Parents: 288ffd7
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Nov 19 13:36:58 2014 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Nov 19 13:53:07 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/config/BrooklynServerConfig.java   |  1 -
 .../ha/HighAvailabilityManagerImpl.java         | 26 ++++++++------------
 2 files changed, 10 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9e8e6bc/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
index 02f8dc0..c5ff294 100644
--- a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
+++ b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
@@ -30,7 +30,6 @@ import org.slf4j.LoggerFactory;
 
 import brooklyn.catalog.CatalogLoadMode;
 import brooklyn.entity.basic.ConfigKeys;
-import brooklyn.event.basic.Sensors;
 import brooklyn.management.ManagementContext;
 import brooklyn.util.guava.Maybe;
 import brooklyn.util.os.Os;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9e8e6bc/core/src/main/java/brooklyn/management/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/management/ha/HighAvailabilityManagerImpl.java b/core/src/main/java/brooklyn/management/ha/HighAvailabilityManagerImpl.java
index 3c1196d..5511c29 100644
--- a/core/src/main/java/brooklyn/management/ha/HighAvailabilityManagerImpl.java
+++ b/core/src/main/java/brooklyn/management/ha/HighAvailabilityManagerImpl.java
@@ -309,18 +309,21 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager
{
                 if (!nodeStateTransitionComplete) throw new IllegalStateException("Cannot
switch to AUTO when in the middle of a transition to "+getInternalNodeState());
                 // else change us to standby, desiring to go to hot standby, and continue
to below
                 setInternalNodeState(ManagementNodeState.STANDBY);
-                startMode = HighAvailabilityMode.HOT_STANDBY;
+                startMode = HighAvailabilityMode.HOT_BACKUP;
             case HOT_STANDBY:
             case STANDBY:
-                if (getInternalNodeState()==ManagementNodeState.STANDBY && oldState==ManagementNodeState.INITIALIZING
+                if (getInternalNodeState()==ManagementNodeState.STANDBY && oldState==ManagementNodeState.INITIALIZING
&& startMode!=HighAvailabilityMode.HOT_BACKUP
                         && BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY))
{
                     // auto requested; not promoted; so it should become hot standby
-                    setInternalNodeState(ManagementNodeState.HOT_STANDBY);
+                    startMode = HighAvailabilityMode.HOT_STANDBY;
                 }
                 ManagementPlaneSyncRecord newState = loadManagementPlaneSyncRecord(true);
                 String masterNodeId = newState.getMasterNodeId();
                 ManagementNodeSyncRecord masterNodeDetails = newState.getManagementNodes().get(masterNodeId);
-                LOG.info("Management node "+ownNodeId+" running as HA " + getInternalNodeState()
+ " autodetected, " +
+                LOG.info("Management node "+ownNodeId+" running as HA " + getInternalNodeState()
+ " autodetected"
+                        + (startMode == HighAvailabilityMode.HOT_STANDBY || startMode ==
HighAvailabilityMode.HOT_BACKUP ? 
+                            " (will change to "+startMode+")" : "")
+                        + ", " +
                     (Strings.isBlank(masterNodeId) ? "no master currently (other node should
promote itself soon)" : "master "
                         + (existingMaster==null ? "(new) " : "")
                         + "is "+masterNodeId +
@@ -402,15 +405,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager
{
             throw new IllegalStateException("Unexpected high availability mode "+startMode+"
requested for "+this);
         }
         
-        if (startMode==HighAvailabilityMode.AUTO) {
-            if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_DEFAULT_STANDBY_IS_HOT_PROPERTY))
{
-                startMode = HighAvailabilityMode.HOT_STANDBY;
-            } else {
-                startMode = HighAvailabilityMode.STANDBY;
-            }
-        }
-        if ((getInternalNodeState()==ManagementNodeState.STANDBY && startMode==HighAvailabilityMode.HOT_STANDBY)
|| 
-                (startMode==HighAvailabilityMode.HOT_BACKUP && !ManagementNodeState.isHotProxy(oldState)))
{
+        if ((startMode==HighAvailabilityMode.HOT_STANDBY || startMode==HighAvailabilityMode.HOT_BACKUP)
&& !ManagementNodeState.isHotProxy(oldState)) {
             // now transition to hot proxy
             nodeStateTransitionComplete = false;
             if (startMode==HighAvailabilityMode.HOT_STANDBY) {
@@ -685,7 +680,6 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager
{
         ManagementNodeSyncRecord ownNodeRecord = memento.getManagementNodes().get(ownNodeId);
         
         ManagementNodeSyncRecord newMasterNodeRecord = null;
-        boolean weWereMaster = getNodeState()==ManagementNodeState.MASTER;
         boolean demotingSelfInFavourOfOtherMaster = false;
         
         if (currMasterNodeRecord != null && currMasterNodeRecord.getStatus() == ManagementNodeState.MASTER
&& isHeartbeatOk(currMasterNodeRecord, ownNodeRecord)) {
@@ -769,8 +763,8 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager
{
                     (weAreNewMaster ? "us " : "")
                     + newMasterNodeId + " (" + timestampString(newMasterNodeRecord.getRemoteTimestamp())
+ ")" 
                     + (newMasterNodeUri!=null ? " "+newMasterNodeUri : "")  );
-            if (weWereMaster || weAreNewMaster) LOG.info(message);
-            else LOG.debug(message);
+            // always log, if you're looking at a standby node it's useful to see the new
master's URL
+            LOG.info(message);
         }
 
         // New master is ourself: promote


Mime
View raw message