You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/11/16 19:39:13 UTC
[1/3] ambari git commit: AMBARI-22244. Use service type instead of
service name - addendum (adoroszlai)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-14714-blueprintv2 f7d4d7322 -> 35834d5f9
AMBARI-22244. Use service type instead of service name - addendum (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/384595a6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/384595a6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/384595a6
Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 384595a64abb248f1d051c0760ff9a156062f9f2
Parents: f7d4d73
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Nov 16 19:00:42 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Thu Nov 16 19:00:42 2017 +0100
----------------------------------------------------------------------
.../checks/ServiceCheckValidityCheck.java | 7 ++++---
.../internal/ServiceResourceProvider.java | 9 ++++----
.../serveraction/upgrades/ConfigureAction.java | 5 +++--
.../ambari/server/state/ConfigHelper.java | 14 ++++++-------
.../ambari/server/state/ConfigMergeHelper.java | 4 ++--
.../ambari/server/state/UpgradeHelper.java | 22 ++++++++++----------
6 files changed, 31 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
index 2582c71..1126424 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
@@ -101,11 +101,12 @@ public class ServiceCheckValidityCheck extends AbstractCheckDescriptor {
continue;
}
StackId stackId = service.getDesiredStackId();
- boolean isServiceWitNoConfigs = ambariMetaInfo.get().isServiceWithNoConfigs(stackId.getStackName(), stackId.getStackVersion(), service.getName());
+ String serviceType = service.getServiceType();
+ boolean isServiceWitNoConfigs = ambariMetaInfo.get().isServiceWithNoConfigs(stackId.getStackName(), stackId.getStackVersion(), serviceType);
if (isServiceWitNoConfigs){
- LOG.info(String.format("%s in %s version %s does not have customizable configurations. Skip checking service configuration history.", service.getName(), stackId.getStackName(), stackId.getStackVersion()));
+ LOG.info("{} in {} version {} does not have customizable configurations. Skip checking service configuration history.", serviceType, stackId.getStackName(), stackId.getStackVersion());
} else {
- LOG.info(String.format("%s in %s version %s has customizable configurations. Check service configuration history.", service.getName(), stackId.getStackName(), stackId.getStackVersion()));
+ LOG.info("{} in {} version {} has customizable configurations. Check service configuration history.", serviceType, stackId.getStackName(), stackId.getStackVersion());
ServiceConfigEntity lastServiceConfig = serviceConfigDAO.getLastServiceConfig(clusterId, service.getServiceId());
lastServiceConfigUpdates.put(service.getName(), lastServiceConfig.getCreateTimestamp());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index 931035d..e353b3c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -276,8 +276,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
setResourceProperty(resource, SERVICE_SERVICE_TYPE_PROPERTY_ID,
response.getServiceType(), requestedIds);
setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
- calculateServiceState(response.getClusterName(), response.getServiceName()),
- requestedIds);
+ calculateServiceState(response.getClusterName(), response.getServiceType(), response.getServiceName()), requestedIds);
setResourceProperty(resource, SERVICE_MAINTENANCE_STATE_PROPERTY_ID,
response.getMaintenanceState(), requestedIds);
setResourceProperty(resource, SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID,
@@ -1004,9 +1003,9 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
}
// calculate the service state, accounting for the state of the host components
- private String calculateServiceState(String clusterName, String serviceName) {
- ServiceCalculatedState serviceCalculatedState = ServiceCalculatedStateFactory.getServiceStateProvider(serviceName);
- return serviceCalculatedState.getState(clusterName, serviceName).toString();
+ private State calculateServiceState(String clusterName, String serviceType, String serviceName) {
+ ServiceCalculatedState serviceCalculatedState = ServiceCalculatedStateFactory.getServiceStateProvider(serviceType);
+ return serviceCalculatedState.getState(clusterName, serviceName);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
index 6bb248e..1639e40 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
@@ -43,6 +43,7 @@ import org.apache.ambari.server.state.ConfigMergeHelper;
import org.apache.ambari.server.state.ConfigMergeHelper.ThreeWayValue;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.PropertyInfo;
+import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.UpgradeContext;
import org.apache.ambari.server.state.stack.upgrade.ConfigUpgradeChangeDefinition.ConfigurationKeyValue;
@@ -596,9 +597,9 @@ public class ConfigureAction extends AbstractUpgradeServerAction {
// has the correct config type (ie oozie-site or hdfs-site) then add it to
// the list of original stack propertiess
Set<String> stackPropertiesForType = new HashSet<>(50);
- for (String serviceName : cluster.getServices().keySet()) {
+ for (Service service : cluster.getServices().values()) {
Set<PropertyInfo> serviceProperties = m_ambariMetaInfo.get().getServiceProperties(
- oldStack.getStackName(), oldStack.getStackVersion(), serviceName);
+ oldStack.getStackName(), oldStack.getStackVersion(), service.getServiceType());
for (PropertyInfo property : serviceProperties) {
String type = ConfigHelper.fileNameToConfigType(property.getFilename());
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index e999e24..e9310a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -512,7 +512,7 @@ public class ConfigHelper {
Set<String> result = new HashSet<>();
for (Service service : clusters.getCluster(clusterName).getServices().values()) {
- Set<PropertyInfo> stackProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), service.getName());
+ Set<PropertyInfo> stackProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), service.getServiceType());
Set<PropertyInfo> stackLevelProperties = ambariMetaInfo.getStackProperties(stack.getName(), stack.getVersion());
stackProperties.addAll(stackLevelProperties);
@@ -543,7 +543,7 @@ public class ConfigHelper {
StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
Map<String, Map<String, String>> result = new HashMap<>();
Map<String, String> passwordProperties;
- Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), service.getName());
+ Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), service.getServiceType());
for (PropertyInfo serviceProperty : serviceProperties) {
if (serviceProperty.getPropertyTypes().contains(propertyType)) {
if (!serviceProperty.getPropertyValueAttributes().isKeyStore()) {
@@ -846,7 +846,7 @@ public class ConfigHelper {
stackId.getStackVersion());
for (ServiceInfo serviceInfo : stack.getServices()) {
- Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), serviceInfo.getName());
+ Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), serviceInfo.getServiceType());
Set<PropertyInfo> stackProperties = ambariMetaInfo.getStackProperties(stack.getName(), stack.getVersion());
serviceProperties.addAll(stackProperties);
@@ -922,7 +922,7 @@ public class ConfigHelper {
StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
for (ServiceInfo serviceInfo : stack.getServices()) {
- Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), serviceInfo.getName());
+ Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), serviceInfo.getServiceType());
for (PropertyInfo stackProperty : serviceProperties) {
String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
@@ -1237,13 +1237,13 @@ public class ConfigHelper {
*
* @param stack
* the stack to pull stack-values from (not {@code null})
- * @param serviceName
+ * @param stackServiceName
* the service name {@code null}).
* @return a mapping of configuration type to map of key/value pairs for the
* default configurations.
* @throws AmbariException
*/
- public Map<String, Map<String, String>> getDefaultProperties(StackId stack, String serviceName)
+ public Map<String, Map<String, String>> getDefaultProperties(StackId stack, String stackServiceName)
throws AmbariException {
Map<String, Map<String, String>> defaultPropertiesByType = new HashMap<>();
@@ -1264,7 +1264,7 @@ public class ConfigHelper {
// for every installed service, populate the default service properties
Set<org.apache.ambari.server.state.PropertyInfo> serviceConfigurationProperties = ambariMetaInfo.getServiceProperties(
- stack.getStackName(), stack.getStackVersion(), serviceName);
+ stack.getStackName(), stack.getStackVersion(), stackServiceName);
// !!! use new stack as the basis
for (PropertyInfo serviceDefaultProperty : serviceConfigurationProperties) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java
index 36918cc..9bede20 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java
@@ -63,11 +63,11 @@ public class ConfigMergeHelper {
Service service = cluster.getService(serviceName);
oldStack = service.getDesiredStackId();
Set<PropertyInfo> oldStackProperties = m_ambariMetaInfo.get().getServiceProperties(
- oldStack.getStackName(), oldStack.getStackVersion(), serviceName);
+ oldStack.getStackName(), oldStack.getStackVersion(), service.getServiceType());
addToMap(oldMap, oldStackProperties);
Set<PropertyInfo> newStackProperties = m_ambariMetaInfo.get().getServiceProperties(
- targetStack.getStackName(), targetStack.getStackVersion(), serviceName);
+ targetStack.getStackName(), targetStack.getStackVersion(), service.getServiceType());
addToMap(newMap, newStackProperties);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/384595a6/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index a6c6507..1a4c27c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -971,28 +971,29 @@ public class UpgradeHelper {
ConfigHelper configHelper = m_configHelperProvider.get();
// downgrade is easy - just remove the new and make the old current
+ Service service = cluster.getService(null, serviceName);
if (direction == Direction.DOWNGRADE) {
//TODO pass serviceGroupName
- cluster.applyLatestConfigurations(targetStackId, cluster.getService(null, serviceName).getServiceId());
+ cluster.applyLatestConfigurations(targetStackId, service.getServiceId());
continue;
}
// the auto-merge must take read-only properties even if they have changed
// - if the properties was read-only in the source stack, then we must
// take the new stack's value
- Map<String, Set<String>> readOnlyProperties = getReadOnlyProperties(sourceStackId, serviceName);
+ Map<String, Set<String>> readOnlyProperties = getReadOnlyProperties(sourceStackId, service.getServiceType());
// upgrade is a bit harder - we have to merge new stack configurations in
// populate a map of default configurations for the service on the old
// stack (this is used when determining if a property has been
- // customized and should be overriden with the new stack value)
+ // customized and should be overridden with the new stack value)
Map<String, Map<String, String>> oldServiceDefaultConfigsByType = configHelper.getDefaultProperties(
- sourceStackId, serviceName);
+ sourceStackId, service.getServiceType());
// populate a map with default configurations from the new stack
Map<String, Map<String, String>> newServiceDefaultConfigsByType = configHelper.getDefaultProperties(
- targetStackId, serviceName);
+ targetStackId, service.getServiceType());
if (null == oldServiceDefaultConfigsByType || null == newServiceDefaultConfigsByType) {
continue;
@@ -1005,7 +1006,7 @@ public class UpgradeHelper {
List<ServiceConfigEntity> latestServiceConfigs = m_serviceConfigDAO.getLastServiceConfigsForService(
//TODO pass serviceGroupName
- cluster.getClusterId(), cluster.getService(null, serviceName).getServiceId());
+ cluster.getClusterId(), service.getServiceId());
for (ServiceConfigEntity serviceConfig : latestServiceConfigs) {
List<ClusterConfigEntity> existingConfigurations = serviceConfig.getClusterConfigEntities();
@@ -1161,13 +1162,12 @@ public class UpgradeHelper {
*
* @param stackId
* the stack to get read-only properties for (not {@code null}).
- * @param serviceName
- * the namee of the service (not {@code null}).
+ * @param stackServiceName
+ * the name of the service (not {@code null}).
* @return a map of configuration type to set of property names which are
* read-only
- * @throws AmbariException
*/
- private Map<String, Set<String>> getReadOnlyProperties(StackId stackId, String serviceName)
+ private Map<String, Set<String>> getReadOnlyProperties(StackId stackId, String stackServiceName)
throws AmbariException {
Map<String, Set<String>> readOnlyProperties = new HashMap<>();
@@ -1177,7 +1177,7 @@ public class UpgradeHelper {
stackId.getStackName(), stackId.getStackVersion());
Set<PropertyInfo> serviceProperties = m_ambariMetaInfoProvider.get().getServiceProperties(
- stackId.getStackName(), stackId.getStackVersion(), serviceName);
+ stackId.getStackName(), stackId.getStackVersion(), stackServiceName);
if (CollectionUtils.isNotEmpty(stackProperties)) {
properties.addAll(stackProperties);
[2/3] ambari git commit: AMBARI-22253. Fix order of arguments in
ServiceRequest call (adoroszlai)
Posted by ad...@apache.org.
AMBARI-22253. Fix order of arguments in ServiceRequest call (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1a05827c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1a05827c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1a05827c
Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 1a05827c870f68a90d15f54236bb6ad2a025c98e
Parents: 384595a
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Nov 16 20:33:38 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Thu Nov 16 20:33:38 2017 +0100
----------------------------------------------------------------------
.../main/java/org/apache/ambari/server/topology/AmbariContext.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a05827c/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 8a32265..4c23e2f 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
@@ -265,7 +265,7 @@ public class AmbariContext {
repoVersion));
}
- serviceRequests.add(new ServiceRequest(clusterName, serviceGroup.getName(), service.getType(), service.getName(),
+ serviceRequests.add(new ServiceRequest(clusterName, serviceGroup.getName(), service.getName(), service.getType(),
repoVersion.getId(), null, credentialStoreEnabled, null));
for (ComponentV2 component : topology.getBlueprint().getComponents(service)) {
[3/3] ambari git commit: AMBARI-22297. componentInfos should be keyed
by component name, not service name (adoroszlai)
Posted by ad...@apache.org.
AMBARI-22297. componentInfos should be keyed by component name, not service name (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/35834d5f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/35834d5f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/35834d5f
Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 35834d5f91967eaebac099e134c4b5b9b11e900c
Parents: 1a05827
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Nov 16 20:36:28 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Thu Nov 16 20:36:28 2017 +0100
----------------------------------------------------------------------
.../server/controller/StackV2Factory.java | 21 ++++++++------------
1 file changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/35834d5f/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 5d3bcfd..201fcb1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -18,16 +18,12 @@
package org.apache.ambari.server.controller;
-import static java.util.AbstractMap.SimpleImmutableEntry;
-
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
@@ -97,19 +93,18 @@ public class StackV2Factory {
}
private void getComponentInfos(StackData stackData) {
- List<Map.Entry<String, String>> componentServices = stackData.serviceComponents.entrySet().stream().
- flatMap(e -> e.getValue().stream().map( v -> new SimpleImmutableEntry<>(e.getKey(), v))).
- collect(Collectors.toList());
- componentServices.forEach( componentService -> {
+ stackData.componentService.forEach( (componentName, serviceName) -> {
try {
- ComponentInfo componentInfo = controller.getAmbariMetaInfo().getComponent(stackData.stackName,
- stackData.stackVersion, componentService.getKey(), componentService.getValue());
+ ComponentInfo componentInfo = controller.getAmbariMetaInfo().getComponent(stackData.stackName, stackData.stackVersion, serviceName, componentName);
if (null != componentInfo) {
- stackData.componentInfos.put(componentService.getKey(), componentInfo);
+ stackData.componentInfos.put(componentName, componentInfo);
+ } else {
+ LOG.debug("No component info for service: {}, component: {}, stack name: {}, stack version: {}",
+ serviceName, componentName, stackData.stackName, stackData.stackVersion);
}
} catch (AmbariException e) {
- LOG.debug("No component info for service: {}, component: {}, stack name: {}, stack version: {}, Exception: {}",
- componentService.getKey(), componentService.getValue(), stackData.stackName, stackData.stackVersion, e);
+ LOG.debug("No component info for service: {}, component: {}, stack name: {}, stack version: {}",
+ serviceName, componentName, stackData.stackName, stackData.stackVersion, e);
}
});
}