You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/05/24 18:37:34 UTC
[1/4] ambari git commit: AMBARI-16749: Auto-start services: Ambari
agent should set auto_start_only to True when recovery_type is AUTO_START
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 d5624726d -> ba4493c66
AMBARI-16749: Auto-start services: Ambari agent should set auto_start_only to True when recovery_type is AUTO_START
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/723181ed
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/723181ed
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/723181ed
Branch: refs/heads/branch-2.4
Commit: 723181ed6dc4386eeae58243c6a3f5c6fc3204e9
Parents: d562472
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Wed May 18 14:43:21 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Tue May 24 11:35:30 2016 -0700
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/RecoveryManager.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/723181ed/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
index 9cce7f3..87d9483 100644
--- a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
+++ b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
@@ -546,7 +546,7 @@ class RecoveryManager:
"""
recovery_enabled = False
- auto_start_only = True
+ auto_start_only = False
max_count = 6
window_in_min = 60
retry_gap = 5
@@ -561,8 +561,8 @@ class RecoveryManager:
if "type" in config:
if config["type"] in ["AUTO_START", "FULL"]:
recovery_enabled = True
- if config["type"] == "FULL":
- auto_start_only = False
+ if config["type"] == "AUTO_START":
+ auto_start_only = True
if "maxCount" in config:
max_count = self._read_int_(config["maxCount"], max_count)
if "windowInMinutes" in config:
[2/4] ambari git commit: AMBARI-16806: AMS Collector is not
automatically being configured for auto-start during blueprint deployment
Posted by sm...@apache.org.
AMBARI-16806: AMS Collector is not automatically being configured for auto-start during blueprint deployment
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4bd3951f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4bd3951f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4bd3951f
Branch: refs/heads/branch-2.4
Commit: 4bd3951f2ce956e19d1688556368c31af92078e9
Parents: 723181e
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Sun May 22 18:47:57 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Tue May 24 11:36:13 2016 -0700
----------------------------------------------------------------------
.../internal/ComponentResourceProvider.java | 5 ++++
.../ambari/server/topology/AmbariContext.java | 2 +-
.../ambari/server/topology/Blueprint.java | 4 ++--
.../ambari/server/topology/BlueprintImpl.java | 25 ++++++++++++--------
4 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4bd3951f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index dd2b31b..cc13e39 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -359,6 +359,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
if (StringUtils.isNotEmpty(request.getRecoveryEnabled())) {
boolean recoveryEnabled = Boolean.parseBoolean(request.getRecoveryEnabled());
sc.setRecoveryEnabled(recoveryEnabled);
+ LOG.info("Component: {}, recovery_enabled from request: {}", request.getComponentName(), recoveryEnabled);
} else {
StackId stackId = s.getDesiredStackVersion();
ComponentInfo componentInfo = ambariMetaInfo.getComponent(stackId.getStackName(),
@@ -368,6 +369,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
stackId.toString() + ", Service=" + s.getName() + ", Component=" + request.getComponentName());
}
sc.setRecoveryEnabled(componentInfo.isRecoveryEnabled());
+ LOG.info("Component: {}, recovery_enabled from stack definition:{}", componentInfo.getName(),
+ componentInfo.isRecoveryEnabled());
}
s.addServiceComponent(sc);
@@ -548,6 +551,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
boolean newRecoveryEnabled = Boolean.parseBoolean(request.getRecoveryEnabled());
boolean oldRecoveryEnabled = sc.isRecoveryEnabled();
+ LOG.info("Component: {}, oldRecoveryEnabled: {}, newRecoveryEnabled {}",
+ componentName, oldRecoveryEnabled, newRecoveryEnabled);
if (newRecoveryEnabled != oldRecoveryEnabled) {
if (newRecoveryEnabled) {
recoveryEnabledComponents.add(sc);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4bd3951f/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
index e3b51c0..849c696 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
@@ -196,7 +196,7 @@ public class AmbariContext {
for (String service : services) {
serviceRequests.add(new ServiceRequest(clusterName, service, null));
for (String component : topology.getBlueprint().getComponents(service)) {
- String recoveryEnabled = String.valueOf(topology.getBlueprint().isRecoveryEnabled(service, component));
+ String recoveryEnabled = topology.getBlueprint().getRecoveryEnabled(service, component);
componentRequests.add(new ServiceComponentRequest(clusterName, service, component, null, recoveryEnabled));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4bd3951f/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
index 2fc74de..0edbaea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
@@ -92,9 +92,9 @@ public interface Blueprint {
* @param serviceName - Service name.
* @param componentName - Component name.
*
- * @return True or false.
+ * @return null if value is not specified; true or false if specified.
*/
- public boolean isRecoveryEnabled(String serviceName, String componentName);
+ public String getRecoveryEnabled(String serviceName, String componentName);
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/4bd3951f/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
index 0bb4874..aeb9a2d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
@@ -39,7 +39,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -166,22 +165,24 @@ public class BlueprintImpl implements Blueprint {
* @param serviceName - Service name.
* @param componentName - Component name.
*
- * @return True or false.
+ * @return null if value is not specified; true or false if specified.
*/
@Override
- public boolean isRecoveryEnabled(String serviceName, String componentName) {
- if (setting == null)
- return false;
-
+ public String getRecoveryEnabled(String serviceName, String componentName) {
Set<HashMap<String, String>> settingValue;
+ if (setting == null)
+ return null;
+
// If component name was specified in the list of "component_settings",
// determine if recovery_enabled is true or false and return it.
settingValue = setting.getSettingValue(Setting.SETTING_NAME_COMPONENT_SETTINGS);
for (Map<String, String> setting : settingValue) {
String name = setting.get(Setting.SETTING_NAME_NAME);
if (StringUtils.equals(name, componentName)) {
- return Boolean.parseBoolean(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED));
+ if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED))) {
+ return setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED);
+ }
}
}
@@ -190,17 +191,21 @@ public class BlueprintImpl implements Blueprint {
for ( Map<String, String> setting : settingValue){
String name = setting.get(Setting.SETTING_NAME_NAME);
if (StringUtils.equals(name, serviceName)) {
- return Boolean.parseBoolean(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED));
+ if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED))) {
+ return setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED);
+ }
}
}
// If service name is not specified, look up the cluster setting.
settingValue = setting.getSettingValue(Setting.SETTING_NAME_RECOVERY_SETTINGS);
for (Map<String, String> setting : settingValue) {
- return Boolean.parseBoolean(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED));
+ if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED))) {
+ return setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED);
+ }
}
- return false;
+ return null;
}
@Override
[3/4] ambari git commit: AMBARI-16751: Refresh stale host entity
reference when deleting a service
Posted by sm...@apache.org.
AMBARI-16751: Refresh stale host entity reference when deleting a service
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/db7f6cb4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/db7f6cb4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/db7f6cb4
Branch: refs/heads/branch-2.4
Commit: db7f6cb4527e3651545a8be1144465600f13868b
Parents: 4bd3951
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Thu May 19 07:24:46 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Tue May 24 11:36:41 2016 -0700
----------------------------------------------------------------------
.../ambari/server/orm/dao/HostComponentDesiredStateDAO.java | 7 ++++++-
.../server/orm/dao/HostComponentDesiredStateDAOTest.java | 4 +++-
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/db7f6cb4/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAO.java
index 46da9da..176e15b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAO.java
@@ -95,7 +95,12 @@ public class HostComponentDesiredStateDAO {
@Transactional
public void remove(HostComponentDesiredStateEntity hostComponentDesiredStateEntity) {
- HostEntity hostEntity = hostComponentDesiredStateEntity.getHostEntity();
+ HostEntity hostEntity = hostDAO.findById(hostComponentDesiredStateEntity.getHostId());
+
+ if (hostEntity == null) {
+ throw new IllegalStateException(String.format("Missing hostEntity for host id %1d",
+ hostComponentDesiredStateEntity.getHostId()));
+ }
entityManagerProvider.get().remove(merge(hostComponentDesiredStateEntity));
http://git-wip-us.apache.org/repos/asf/ambari/blob/db7f6cb4/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAOTest.java
index b7a0677..28adb8c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostComponentDesiredStateDAOTest.java
@@ -48,7 +48,7 @@ public class HostComponentDesiredStateDAOTest {
HostEntity hostEntity = createNiceMock(HostEntity.class);
HostComponentDesiredStateEntity hostComponentDesiredStateEntity = createNiceMock(HostComponentDesiredStateEntity.class);
- expect(hostComponentDesiredStateEntity.getHostEntity()).andReturn(hostEntity);
+ expect(hostComponentDesiredStateEntity.getHostId()).andReturn(1L).anyTimes();
expect(entityManagerProvider.get()).andReturn(entityManager).anyTimes();
expect(entityManager.merge(hostComponentDesiredStateEntity)).andReturn(hostComponentDesiredStateEntity).anyTimes();
@@ -58,6 +58,8 @@ public class HostComponentDesiredStateDAOTest {
expect(hostDAO.merge(hostEntity)).andReturn(hostEntity).anyTimes();
+ expect(hostDAO.findById(1L)).andReturn(hostEntity).anyTimes();
+
replay(entityManagerProvider, entityManager, hostDAO, hostEntity, hostComponentDesiredStateEntity);
HostComponentDesiredStateDAO dao = new HostComponentDesiredStateDAO();
[4/4] ambari git commit: AMBARI-16826: Unit Test failure:
ComponentResourceProviderTest
Posted by sm...@apache.org.
AMBARI-16826: Unit Test failure: ComponentResourceProviderTest
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba4493c6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba4493c6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba4493c6
Branch: refs/heads/branch-2.4
Commit: ba4493c66c00fa96ebca661ed42a15087989943b
Parents: db7f6cb
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Mon May 23 13:24:04 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Tue May 24 11:37:17 2016 -0700
----------------------------------------------------------------------
.../server/controller/internal/ComponentResourceProviderTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba4493c6/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index 7ec6e66..d299fad 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -146,6 +146,7 @@ public class ComponentResourceProviderTest {
expect(ambariMetaInfo.isValidServiceComponent("HDP", "99", "Service100", "Component100")).andReturn(true).anyTimes();
+ expect(componentInfo.getName()).andReturn("Component100").anyTimes();
expect(componentInfo.isRecoveryEnabled()).andReturn(true).anyTimes();
expect(ambariMetaInfo.getComponent("HDP", "99", "Service100", "Component100")).andReturn(componentInfo).anyTimes();
@@ -153,7 +154,7 @@ public class ComponentResourceProviderTest {
// replay
replay(managementController, response, clusters, cluster, service, stackId, ambariMetaInfo,
- serviceComponentFactory, serviceComponent);
+ serviceComponentFactory, serviceComponent, componentInfo);
SecurityContextHolder.getContext().setAuthentication(authentication);