You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2018/05/24 19:51:05 UTC
[ambari] branch branch-feature-AMBARI-14714-dep updated:
[AMBARI-22707] Implement resolving dependencies for each service
This is an automated email from the ASF dual-hosted git repository.
mradhakrishnan pushed a commit to branch branch-feature-AMBARI-14714-dep
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714-dep by this push:
new 9c025b9 [AMBARI-22707] Implement resolving dependencies for each service
9c025b9 is described below
commit 9c025b938015080f724a2c4b6651845fa9037cb1
Author: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
AuthorDate: Thu May 24 12:50:27 2018 -0700
[AMBARI-22707] Implement resolving dependencies for each service
---
.../ambari/server/api/services/ServiceKey.java | 21 +++++++++++--
.../controller/AmbariManagementController.java | 8 +++++
.../controller/AmbariManagementControllerImpl.java | 26 ++++++++++++++--
.../controller/ServiceDependencyRequest.java | 16 +++++++++-
.../controller/ServiceDependencyResponse.java | 20 ++++++++++--
.../ServiceDependencyResourceProvider.java | 16 ++++++++--
.../internal/ServiceResourceProvider.java | 36 ++++++++++++++++++++--
.../orm/entities/ServiceDependencyEntity.java | 16 ++++++++++
.../org/apache/ambari/server/state/Cluster.java | 2 +-
.../org/apache/ambari/server/state/Service.java | 2 +-
.../apache/ambari/server/state/ServiceImpl.java | 6 ++--
.../java/org/apache/ambari/server/state/State.java | 35 +++++++++++++++++++--
.../ambari/server/state/cluster/ClusterImpl.java | 5 +--
.../src/main/resources/Ambari-DDL-Derby-CREATE.sql | 1 +
.../src/main/resources/Ambari-DDL-MySQL-CREATE.sql | 1 +
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 1 +
.../main/resources/Ambari-DDL-Postgres-CREATE.sql | 2 ++
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 1 +
.../main/resources/Ambari-DDL-SQLServer-CREATE.sql | 1 +
.../AmbariCustomCommandExecutionHelperTest.java | 3 +-
.../controller/AmbariManagementControllerTest.java | 3 +-
.../ServiceDependencyResourceProviderTest.java | 17 +++++-----
22 files changed, 209 insertions(+), 30 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceKey.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceKey.java
index 32b87f5..635585c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceKey.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceKey.java
@@ -17,6 +17,8 @@
*/
package org.apache.ambari.server.api.services;
+import org.apache.ambari.server.state.ServiceDependencyType;
+
public class ServiceKey {
private Long serviceId;
@@ -26,12 +28,13 @@ public class ServiceKey {
private String serviceName;
private String serviceGroupName;
private String clusterName;
+ private ServiceDependencyType dependencyType;
public ServiceKey() {
}
public ServiceKey(Long clusterId, String clusterName, Long serviceGroupId, String serviceGroupName, Long serviceId, String serviceName,
- Long dependencyId) {
+ Long dependencyId, ServiceDependencyType dependencyType) {
this.clusterId = clusterId;
this.clusterName = clusterName;
this.serviceGroupId = serviceGroupId;
@@ -39,6 +42,8 @@ public class ServiceKey {
this.serviceId = serviceId;
this.serviceName = serviceName;
this.dependencyId = dependencyId;
+ this.dependencyType = dependencyType;
+
}
public Long getClusterId() {
@@ -97,15 +102,25 @@ public class ServiceKey {
this.dependencyId = dependencyId;
}
+ public ServiceDependencyType getDependencyType() {
+ return dependencyType;
+ }
+
+ public void setDependencyType(ServiceDependencyType dependencyType) {
+ this.dependencyType = dependencyType;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (!(o instanceof ServiceKey)) return false;
+ if (o == null || getClass() != o.getClass()) return false;
ServiceKey that = (ServiceKey) o;
if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (dependencyId != null ? !dependencyId.equals(that.dependencyId) : that.dependencyId != null) return false;
+ if (dependencyType != that.dependencyType) return false;
if (serviceGroupId != null ? !serviceGroupId.equals(that.serviceGroupId) : that.serviceGroupId != null)
return false;
if (serviceGroupName != null ? !serviceGroupName.equals(that.serviceGroupName) : that.serviceGroupName != null)
@@ -121,9 +136,11 @@ public class ServiceKey {
int result = serviceId != null ? serviceId.hashCode() : 0;
result = 31 * result + (serviceGroupId != null ? serviceGroupId.hashCode() : 0);
result = 31 * result + (clusterId != null ? clusterId.hashCode() : 0);
+ result = 31 * result + (dependencyId != null ? dependencyId.hashCode() : 0);
result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
result = 31 * result + (serviceGroupName != null ? serviceGroupName.hashCode() : 0);
result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
+ result = 31 * result + (dependencyType != null ? dependencyType.hashCode() : 0);
return result;
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index 4069e38..b0f368f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -663,6 +663,14 @@ public interface AmbariManagementController {
Collection<ServiceComponentHost> ignoredHosts,
boolean runSmokeTest, boolean reconfigureClients) throws AmbariException;
+ void updateServiceStates(
+ Cluster cluster,
+ Map<State, List<Service>> changedServices,
+ Map<State, List<ServiceComponent>> changedComps,
+ Map<String, Map<State, List<ServiceComponentHost>>> changedScHosts,
+ Collection<ServiceComponentHost> ignoredScHosts
+ );
+
/**
* Getter for the url of JDK, stored at server resources folder
*/
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 24b95e6..144f527 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3012,11 +3012,16 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
continue;
}
- RoleCommand roleCommand;
+ RoleCommand roleCommand = null;
State oldSchState = scHost.getState();
- ServiceComponentHostEvent event;
+ ServiceComponentHostEvent event = null;
switch (newState) {
+ case RESOLVED:
+ if (oldSchState == State.INIT){
+ scHost.setState(serviceComponent.getDesiredState());
+ }
+ break;
case INSTALLED:
if (oldSchState == State.INIT
|| oldSchState == State.UNINSTALLED
@@ -3209,6 +3214,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
} catch (InvalidStateTransitionException e) {
LOG.error("Error transitioning ServiceComponentHost state to INSTALLED", e);
}
+ } else if(newState == State.RESOLVED){
+ scHost.setState(serviceComponent.getDesiredState());
+ try {
+ scHost.handleEvent(new ServiceComponentHostOpSucceededEvent(scHost.getServiceComponentName(), scHost.getHostName(), System.currentTimeMillis()));
+ }catch (InvalidStateTransitionException e) {
+ LOG.error("Error transitioning ServiceComponentHost state to RESOLVED", e);
+ }
} else {
// !!! can never be null
createHostAction(cluster, stage, scHost, configurations, configurationAttributes, configTags,
@@ -3455,7 +3467,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
return response; }
@Transactional
- void updateServiceStates(
+ @Override
+ public void updateServiceStates(
Cluster cluster,
Map<State, List<Service>> changedServices,
Map<State, List<ServiceComponent>> changedComps,
@@ -3523,6 +3536,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
//actually set the new state
sch.setDesiredState(newState);
+ if(newState == State.RESOLVED || newState == State.RESOLVE_FAILED){
+ HostComponentStateEntity hostComponentStateEntity = hostComponentStateDAO.findById(sch.getHostComponentId());
+ hostComponentStateEntity.setCurrentState(newState);
+ hostComponentStateDAO.merge(hostComponentStateEntity);
+ hostComponentStateDAO.refresh(hostComponentStateEntity);
+
+ }
}
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyRequest.java
index 7f1e80c..ef6a08d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyRequest.java
@@ -17,6 +17,8 @@
*/
package org.apache.ambari.server.controller;
+import org.apache.ambari.server.state.ServiceDependencyType;
+
public class ServiceDependencyRequest {
private String clusterName;
@@ -26,9 +28,10 @@ public class ServiceDependencyRequest {
private String dependentServiceName;
private String dependentServiceGroupName;
private Long dependencyId;
+ private ServiceDependencyType dependencyType;
public ServiceDependencyRequest(String clusterName, String serviceName, String serviceGroupName, String dependentClusterName,
- String dependentServiceGroupName, String dependentServiceName, Long dependencyId) {
+ String dependentServiceGroupName, String dependentServiceName, Long dependencyId, ServiceDependencyType dependencyType) {
this.clusterName = clusterName;
this.serviceName = serviceName;
this.serviceGroupName = serviceGroupName;
@@ -36,6 +39,8 @@ public class ServiceDependencyRequest {
this.dependentServiceGroupName = dependentServiceGroupName;
this.dependentServiceName = dependentServiceName;
this.dependencyId = dependencyId;
+ this.dependencyType = dependencyType;
+
}
public String getClusterName() {
@@ -94,6 +99,14 @@ public class ServiceDependencyRequest {
this.serviceName = serviceName;
}
+ public ServiceDependencyType getDependencyType() {
+ return dependencyType;
+ }
+
+ public void setDependencyType(ServiceDependencyType dependencyType) {
+ this.dependencyType = dependencyType;
+ }
+
@Override
public String toString() {
return "ServiceDependencyRequest{" +
@@ -104,6 +117,7 @@ public class ServiceDependencyRequest {
", dependentServiceName='" + dependentServiceName + '\'' +
", dependentServiceGroupName='" + dependentServiceGroupName + '\'' +
", dependencyId=" + dependencyId +
+ ", dependencyType=" + dependencyType +
'}';
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyResponse.java
index 89a5441..1b435e1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceDependencyResponse.java
@@ -18,6 +18,8 @@
package org.apache.ambari.server.controller;
+import org.apache.ambari.server.state.ServiceDependencyType;
+
public class ServiceDependencyResponse {
private Long clusterId;
@@ -33,11 +35,12 @@ public class ServiceDependencyResponse {
private String dependencyServiceName;
private String dependencyClusterName;
private String dependencyServiceGroupName;
+ private ServiceDependencyType dependencyType;
public ServiceDependencyResponse(Long clusterId, String clusterName, Long dependencyClusterId, String dependencyClusterName,
Long dependencyServiceGroupId, String dependencyServiceGroupName, Long dependencyServiceId,
String dependencyServiceName, Long serviceGroupId, String serviceGroupName,
- Long serviceId, String serviceName, Long dependencyId) {
+ Long serviceId, String serviceName, Long dependencyId, ServiceDependencyType dependencyType) {
this.clusterId = clusterId;
this.clusterName = clusterName;
this.dependencyClusterId = dependencyClusterId;
@@ -51,6 +54,7 @@ public class ServiceDependencyResponse {
this.serviceId = serviceId;
this.serviceName = serviceName;
this.dependencyId = dependencyId;
+ this.dependencyType = dependencyType;
}
public Long getClusterId() {
@@ -157,10 +161,18 @@ public class ServiceDependencyResponse {
this.dependencyId = dependencyId;
}
+ public ServiceDependencyType getDependencyType() {
+ return dependencyType;
+ }
+
+ public void setDependencyType(ServiceDependencyType dependencyType) {
+ this.dependencyType = dependencyType;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (!(o instanceof ServiceDependencyResponse)) return false;
+ if (o == null || getClass() != o.getClass()) return false;
ServiceDependencyResponse that = (ServiceDependencyResponse) o;
@@ -168,6 +180,7 @@ public class ServiceDependencyResponse {
if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
if (dependencyClusterId != null ? !dependencyClusterId.equals(that.dependencyClusterId) : that.dependencyClusterId != null)
return false;
+ if (dependencyId != null ? !dependencyId.equals(that.dependencyId) : that.dependencyId != null) return false;
if (dependencyClusterName != null ? !dependencyClusterName.equals(that.dependencyClusterName) : that.dependencyClusterName != null)
return false;
if (dependencyServiceGroupId != null ? !dependencyServiceGroupId.equals(that.dependencyServiceGroupId) : that.dependencyServiceGroupId != null)
@@ -178,6 +191,7 @@ public class ServiceDependencyResponse {
return false;
if (dependencyServiceName != null ? !dependencyServiceName.equals(that.dependencyServiceName) : that.dependencyServiceName != null)
return false;
+ if (dependencyType != that.dependencyType) return false;
if (serviceGroupId != null ? !serviceGroupId.equals(that.serviceGroupId) : that.serviceGroupId != null)
return false;
if (serviceGroupName != null ? !serviceGroupName.equals(that.serviceGroupName) : that.serviceGroupName != null)
@@ -196,12 +210,14 @@ public class ServiceDependencyResponse {
result = 31 * result + (dependencyClusterId != null ? dependencyClusterId.hashCode() : 0);
result = 31 * result + (dependencyServiceId != null ? dependencyServiceId.hashCode() : 0);
result = 31 * result + (dependencyServiceGroupId != null ? dependencyServiceGroupId.hashCode() : 0);
+ result = 31 * result + (dependencyId != null ? dependencyId.hashCode() : 0);
result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
result = 31 * result + (serviceGroupName != null ? serviceGroupName.hashCode() : 0);
result = 31 * result + (dependencyServiceName != null ? dependencyServiceName.hashCode() : 0);
result = 31 * result + (dependencyClusterName != null ? dependencyClusterName.hashCode() : 0);
result = 31 * result + (dependencyServiceGroupName != null ? dependencyServiceGroupName.hashCode() : 0);
+ result = 31 * result + (dependencyType != null ? dependencyType.hashCode() : 0);
return result;
}
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProvider.java
index 3cb7d18..049516a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProvider.java
@@ -53,6 +53,7 @@ import org.apache.ambari.server.security.authorization.RoleAuthorization;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceDependencyType;
import org.apache.ambari.server.state.ServiceGroup;
import org.apache.ambari.server.utils.StageUtils;
import org.apache.commons.lang.StringUtils;
@@ -83,6 +84,7 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
public static final String SERVICE_DEPENDENCY_DEPENDENT_SERVICE_GROUP_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "dependent_service_group_name";
public static final String SERVICE_DEPENDENCY_DEPENDENT_SERVICE_GROUP_ID_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "dependent_service_group_id";
public static final String SERVICE_DEPENDENCY_DEPENDENCY_ID_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "dependency_id";
+ public static final String SERVICE_DEPENDENCY_DEPENDENCY_TYPE_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "dependency_type";
protected ObjectMapper mapper = new ObjectMapper();;
@@ -120,6 +122,7 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
PROPERTY_IDS.add(SERVICE_DEPENDENCY_DEPENDENT_SERVICE_GROUP_ID_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_DEPENDENCY_DEPENDENT_SERVICE_GROUP_NAME_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_DEPENDENCY_DEPENDENCY_ID_PROPERTY_ID);
+ PROPERTY_IDS.add(SERVICE_DEPENDENCY_DEPENDENCY_TYPE_PROPERTY_ID);
// keys
KEY_PROPERTY_IDS.put(Resource.Type.Cluster, SERVICE_DEPENDENCY_CLUSTER_NAME_PROPERTY_ID);
@@ -196,6 +199,9 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
response.getDependencyServiceGroupName());
resource.setProperty(SERVICE_DEPENDENCY_DEPENDENCY_ID_PROPERTY_ID,
response.getDependencyId());
+ resource.setProperty(SERVICE_DEPENDENCY_DEPENDENCY_TYPE_PROPERTY_ID,
+ response.getDependencyType());
+
associatedResources.add(resource);
}
@@ -253,6 +259,8 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
response.getDependencyServiceGroupName(), requestedIds);
setResourceProperty(resource, SERVICE_DEPENDENCY_DEPENDENCY_ID_PROPERTY_ID,
response.getDependencyId(), requestedIds);
+ setResourceProperty(resource, SERVICE_DEPENDENCY_DEPENDENCY_TYPE_PROPERTY_ID,
+ response.getDependencyType(), requestedIds);
resources.add(resource);
}
@@ -328,10 +336,12 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
String dependentClusterName = (String) properties.get(SERVICE_DEPENDENCY_DEPENDENT_CLUSTER_NAME_PROPERTY_ID);
String dependentServiceName = (String) properties.get(SERVICE_DEPENDENCY_DEPENDENT_SERVICE_NAME_PROPERTY_ID);
String dependentServiceGroupName = (String) properties.get(SERVICE_DEPENDENCY_DEPENDENT_SERVICE_GROUP_NAME_PROPERTY_ID);
+ String dependencyTypeStr = (String)properties.get(SERVICE_DEPENDENCY_DEPENDENCY_TYPE_PROPERTY_ID);
+ ServiceDependencyType dependencyType = StringUtils.isEmpty(dependencyTypeStr) ? null : ServiceDependencyType.valueOf(dependencyTypeStr);
String strDependencyId = (String) properties.get(SERVICE_DEPENDENCY_DEPENDENCY_ID_PROPERTY_ID);
Long dependencyId = strDependencyId == null ? null : Long.valueOf(strDependencyId);
ServiceDependencyRequest svcRequest = new ServiceDependencyRequest(clusterName, serviceName, serviceGroupName,
- dependentClusterName, dependentServiceGroupName, dependentServiceName, dependencyId);
+ dependentClusterName, dependentServiceGroupName, dependentServiceName, dependencyId, dependencyType);
return svcRequest;
}
@@ -368,7 +378,7 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
Service dependentService = cluster.getService(dependentServiceGroup.getServiceGroupName(), request.getDependentServiceName());
- Service updatedService = cluster.addDependencyToService(request.getServiceGroupName(), request.getServiceName(), dependentService.getServiceId());
+ Service updatedService = cluster.addDependencyToService(request.getServiceGroupName(), request.getServiceName(), dependentService.getServiceId(),request.getDependencyType());
createdServiceDependencies.addAll(updatedService.getServiceDependencyResponses());
}
return createdServiceDependencies;
@@ -498,11 +508,13 @@ public class ServiceDependencyResourceProvider extends AbstractControllerResourc
final String dependentClusterName = request.getDependentClusterName();
final String dependentServiceGroupName = request.getDependentServiceGroupName();
final String dependentServiceName = request.getDependentServiceName();
+ final ServiceDependencyType dependencyType = request.getDependencyType();
Validate.notNull(clusterName, "Cluster name should be provided when creating a service dependency");
Validate.notNull(serviceGroupName, "Service group name should be provided when creating a service dependency");
Validate.notNull(serviceName, "Service name should be provided when creating a service dependency");
Validate.notNull(dependentServiceName, "Dependency service name should be provided when creating a service dependency");
+ Validate.notNull(dependencyType, "Dependency type should be provided when creating a service dependency");
//throws cluster not found exception
Cluster cluster = clusters.getCluster(clusterName);
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 72e43f7..213754e 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
@@ -66,6 +66,7 @@ import org.apache.ambari.server.serveraction.kerberos.KerberosMissingAdminCreden
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RequiredService;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
@@ -598,6 +599,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
boolean reconfigureClients, boolean startDependencies) throws AmbariException, AuthorizationException {
AmbariManagementController controller = getManagementController();
+ AmbariMetaInfo ambariMetaInfo = controller.getAmbariMetaInfo();
if (requests.isEmpty()) {
LOG.warn("Received an empty requests set");
@@ -743,6 +745,8 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
seenNewStates.add(newState);
+ Map<State, List<Service>> resolvedService = new EnumMap<>(State.class);
+ State desiredState = null;
if (newState != oldState) {
// The if user is trying to start or stop the service, ensure authorization
if (((newState == State.INSTALLED) || (newState == State.STARTED)) &&
@@ -764,15 +768,43 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
changedServices.put(newState, new ArrayList<>());
}
changedServices.get(newState).add(s);
+
+ if(newState == State.RESOLVED) {
+ // create service dependencies
+ ServiceInfo currentServiceInfo = ambariMetaInfo.getService(s);
+ for (RequiredService requiredService : currentServiceInfo.getRequiredServices()) {
+ if (!cluster.getServices().containsKey(requiredService.getName())) {
+ desiredState = State.RESOLVE_FAILED;
+ break;
+ }
+ Service reqService = cluster.getService(requiredService.getName());
+ cluster.addDependencyToService(s.getServiceGroupName(), s.getName(), reqService.getServiceId(), requiredService.getDependencyType());
+ }
+ if(desiredState != State.RESOLVE_FAILED)
+ desiredState = State.RESOLVED;
}
+ }
// TODO should we check whether all servicecomponents and
// servicecomponenthosts are in the required desired state?
updateServiceComponents(requestStages, changedComps, changedScHosts,
- ignoredScHosts, reqOpLvl, s, newState);
+ ignoredScHosts, reqOpLvl, s, (desiredState == null? newState : desiredState));
+ if(newState == State.RESOLVED){
+ resolvedService.put(desiredState, new ArrayList<>());
+ resolvedService.get(desiredState).add(s);
+ changedServices.put(desiredState, new ArrayList<>());
+ changedServices.get(desiredState).add(s);
+ controller.updateServiceStates(cluster, resolvedService, changedComps, changedScHosts, ignoredScHosts);
+ }
}
+
+ if(changedServices.containsKey(State.RESOLVED)){
+ return requestStages;
+ }
+
+
if (startDependencies && changedServices.containsKey(State.STARTED)) {
HashSet<Service> depServices = new HashSet<>();
for (Service service : changedServices.get(State.STARTED)) {
@@ -863,7 +895,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
}
continue;
}
- //
+
if (newState == oldSchState) {
ignoredScHosts.add(sch);
if (LOG.isDebugEnabled()) {
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDependencyEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDependencyEntity.java
index b8e2650..91382f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDependencyEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDependencyEntity.java
@@ -19,6 +19,8 @@ package org.apache.ambari.server.orm.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -27,6 +29,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
+import org.apache.ambari.server.state.ServiceDependencyType;
+
@Entity
@Table(name = "servicedependencies")
@TableGenerator(name = "service_dependency_id_generator",
@@ -50,6 +54,10 @@ public class ServiceDependencyEntity {
@Column(name = "service_group_id", nullable = false, insertable = true, updatable = false)
private long serviceGroupId;
+ @Column(name = "dependency_type", nullable = false, length = 255)
+ @Enumerated(value = EnumType.STRING)
+ private ServiceDependencyType dependencyType;
+
@Column(name = "dependent_service_id", nullable = false, insertable = false, updatable = false)
private long dependentServiceId;
@@ -135,6 +143,14 @@ public class ServiceDependencyEntity {
this.serviceId = serviceId;
}
+ public ServiceDependencyType getDependencyType() {
+ return dependencyType;
+ }
+
+ public void setDependencyType(ServiceDependencyType dependencyType) {
+ this.dependencyType = dependencyType;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 03e3151..afd84c5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -76,7 +76,7 @@ public interface Cluster {
throws AmbariException;
Service addDependencyToService(String serviceGroupName, String serviceName,
- Long dependencyServiceId) throws AmbariException;
+ Long dependencyServiceId, ServiceDependencyType dependencyType) throws AmbariException;
Service removeDependencyFromService(String serviceGroupName, String serviceName, Long dependencyServiceId);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
index b640d77..b0c360d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
@@ -93,7 +93,7 @@ public interface Service {
ClusterServiceEntity removeDependencyService(Long dependencyServiceId);
- ClusterServiceEntity addDependencyService(Long dependencyServiceId) throws AmbariException;
+ ClusterServiceEntity addDependencyService(Long dependencyServiceId, ServiceDependencyType dependencyType) throws AmbariException;
void delete(DeleteHostComponentStatusMetaData deleteMetaData);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 63603ea..2d36fff 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -377,7 +377,7 @@ public class ServiceImpl implements Service {
responses.add(new ServiceDependencyResponse(cluster.getClusterId(), cluster.getClusterName(),
sk.getClusterId(), sk.getClusterName(), sk.getServiceGroupId(), sk.getServiceGroupName(),
sk.getServiceId(), sk.getServiceName(), getServiceGroupId(), getServiceGroupName(),
- getServiceId(), getName(), sk.getDependencyId()));
+ getServiceId(), getName(), sk.getDependencyId(), sk.getDependencyType()));
}
}
return responses;
@@ -417,6 +417,7 @@ public class ServiceImpl implements Service {
serviceKey.setServiceName(dependencyService.getServiceName());
serviceKey.setServiceId(dependencyService.getServiceId());
serviceKey.setDependencyId(sde.getServiceDependencyId());
+ serviceKey.setDependencyType(sde.getDependencyType());
serviceDependenciesList.add(serviceKey);
}
}
@@ -575,7 +576,7 @@ public class ServiceImpl implements Service {
}
@Override
- public ClusterServiceEntity addDependencyService(Long dependencyServiceId) throws AmbariException {
+ public ClusterServiceEntity addDependencyService(Long dependencyServiceId, ServiceDependencyType dependencyType) throws AmbariException {
Service dependentService = null;
for (Cluster cl : clusters.getClusters().values()) {
if (cl.getServicesById().containsKey(dependencyServiceId)) {
@@ -588,6 +589,7 @@ public class ServiceImpl implements Service {
ClusterServiceEntity dependentServiceEntity = clusterServiceDAO.findByPK(dependentService.getServiceId());
ServiceDependencyEntity newServiceDependency = new ServiceDependencyEntity();
+ newServiceDependency.setDependencyType(dependencyType);
newServiceDependency.setService(currentServiceEntity);
newServiceDependency.setServiceGroupId(currentServiceEntity.getServiceGroupId());
newServiceDependency.setServiceClusterId(currentServiceEntity.getClusterId());
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/State.java b/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
index 351c587..a1c3947 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
@@ -38,6 +38,14 @@ public enum State {
*/
INSTALLED,
/**
+ * State when dependencies have been resolved successfully.
+ */
+ RESOLVED,
+ /**
+ * State when dependency resolution fails.
+ */
+ RESOLVE_FAILED,
+ /**
* In the process of starting.
*/
STARTING,
@@ -87,6 +95,7 @@ public enum State {
case STARTED:
case UNINSTALLED:
case DISABLED:
+ case RESOLVED:
return true;
default:
return false;
@@ -120,6 +129,8 @@ public enum State {
case INSTALLING:
case INSTALLED:
case INSTALL_FAILED:
+ case RESOLVED:
+ case RESOLVE_FAILED:
case UNINSTALLED:
case UNKNOWN:
case DISABLED:
@@ -149,7 +160,8 @@ public enum State {
|| startState == State.UPGRADING
|| startState == State.STOPPING
|| startState == State.UNKNOWN
- || startState == State.DISABLED) {
+ || startState == State.DISABLED
+ || startState == State.RESOLVED) {
return true;
}
break;
@@ -181,6 +193,18 @@ public enum State {
return true;
}
break;
+ case RESOLVED:
+ if (startState == State.INIT
+ || startState == State.RESOLVE_FAILED) {
+ return true;
+ }
+ break;
+ case INSTALL_FAILED:
+ if (startState == State.RESOLVED
+ || startState == State.INSTALLING) {
+ return true;
+ }
+ break;
}
return false;
}
@@ -200,7 +224,8 @@ public enum State {
|| startState == State.UNINSTALLED
|| startState == State.INSTALLED
|| startState == State.STARTED
- || startState == State.STOPPING) {
+ || startState == State.STOPPING
+ || startState == State.RESOLVED) {
return true;
}
break;
@@ -210,6 +235,12 @@ public enum State {
return true;
}
break;
+ case RESOLVED:
+ if (startState == State.INIT
+ || startState == State.RESOLVE_FAILED) {
+ return true;
+ }
+ break;
}
return false;
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index c1f5ef9..10f144f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -135,6 +135,7 @@ import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.ServiceComponentHostEvent;
import org.apache.ambari.server.state.ServiceComponentHostEventType;
+import org.apache.ambari.server.state.ServiceDependencyType;
import org.apache.ambari.server.state.ServiceFactory;
import org.apache.ambari.server.state.ServiceGroup;
import org.apache.ambari.server.state.ServiceGroupFactory;
@@ -971,7 +972,7 @@ public class ClusterImpl implements Cluster {
}
@Override
- public Service addDependencyToService(String serviceGroupName, String serviceName, Long dependencyServiceId) throws AmbariException {
+ public Service addDependencyToService(String serviceGroupName, String serviceName, Long dependencyServiceId, ServiceDependencyType dependencyType ) throws AmbariException {
Service currentService = null;
for (Service service : getServicesById().values()) {
if (service.getName().equals(serviceName) && service.getServiceGroupName().equals(serviceGroupName)) {
@@ -984,7 +985,7 @@ public class ClusterImpl implements Cluster {
clusterGlobalLock.writeLock().lock();
try {
- updatedServiceEntity = currentService.addDependencyService(dependencyServiceId);
+ updatedServiceEntity = currentService.addDependencyService(dependencyServiceId, dependencyType);
updatedService = serviceFactory.createExisting(this, getServiceGroup(currentService.getServiceGroupName()), updatedServiceEntity);
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 5c0e8a1..9f0ba5b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -188,6 +188,7 @@ CREATE TABLE servicedependencies (
service_id BIGINT NOT NULL,
service_group_id BIGINT NOT NULL,
service_cluster_id BIGINT NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id BIGINT NOT NULL,
dependent_service_group_id BIGINT NOT NULL,
dependent_service_cluster_id BIGINT NOT NULL,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index d9f1472..b92b5e9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -207,6 +207,7 @@ CREATE TABLE servicedependencies (
service_id BIGINT NOT NULL,
service_group_id BIGINT NOT NULL,
service_cluster_id BIGINT NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id BIGINT NOT NULL,
dependent_service_group_id BIGINT NOT NULL,
dependent_service_cluster_id BIGINT NOT NULL,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index a2b9dee..796124e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -187,6 +187,7 @@ CREATE TABLE servicedependencies (
service_id NUMBER(19) NOT NULL,
service_group_id NUMBER(19) NOT NULL,
service_cluster_id NUMBER(19) NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id NUMBER(19) NOT NULL,
dependent_service_group_id NUMBER(19) NOT NULL,
dependent_service_cluster_id NUMBER(19) NOT NULL,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 505e8db..6eae513 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -1,4 +1,5 @@
--
+--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
@@ -190,6 +191,7 @@ CREATE TABLE servicedependencies (
service_id BIGINT NOT NULL,
service_group_id BIGINT NOT NULL,
service_cluster_id BIGINT NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id BIGINT NOT NULL,
dependent_service_group_id BIGINT NOT NULL,
dependent_service_cluster_id BIGINT NOT NULL,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index 0033a69..fb92084 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -186,6 +186,7 @@ CREATE TABLE servicedependencies (
service_id NUMBER(19) NOT NULL,
service_group_id NUMBER(19) NOT NULL,
service_cluster_id NUMBER(19) NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id NUMBER(19) NOT NULL,
dependent_service_group_id NUMBER(19) NOT NULL,
dependent_service_cluster_id NUMBER(19) NOT NULL,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index c6cca3c..573dd48 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -201,6 +201,7 @@ CREATE TABLE servicedependencies (
service_id BIGINT NOT NULL,
service_group_id BIGINT NOT NULL,
service_cluster_id BIGINT NOT NULL,
+ dependency_type VARCHAR(255) NOT NULL,
dependent_service_id BIGINT NOT NULL,
dependent_service_group_id BIGINT NOT NULL,
dependent_service_cluster_id BIGINT NOT NULL,
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
index d1e0d21..97a2e4a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
@@ -83,6 +83,7 @@ import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
+import org.apache.ambari.server.state.ServiceDependencyType;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.State;
@@ -628,7 +629,7 @@ public class AmbariCustomCommandExecutionHelperTest {
}
//add dependency from HDFS to HADOOP_CLIENTS
- c1.addDependencyToService("CORE", "HDFS", clientService.getServiceId());
+ c1.addDependencyToService("CORE", "HDFS", clientService.getServiceId(), ServiceDependencyType.INSTALL);
ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<>(), null);
}
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index afaf395..c28018e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -136,6 +136,7 @@ import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentFactory;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.ServiceComponentHostFactory;
+import org.apache.ambari.server.state.ServiceDependencyType;
import org.apache.ambari.server.state.ServiceFactory;
import org.apache.ambari.server.state.ServiceGroup;
import org.apache.ambari.server.state.ServiceInfo;
@@ -5973,7 +5974,7 @@ public class AmbariManagementControllerTest {
Service mapred = cluster.addService(serviceGroup, "YARN", "YARN");
Service hadoop_clients = cluster.addService(serviceGroup, "HADOOP_CLIENTS", "HADOOP_CLIENTS");
- hdfs = cluster.addDependencyToService("CORE", "HDFS", hadoop_clients.getServiceId());
+ hdfs = cluster.addDependencyToService("CORE", "HDFS", hadoop_clients.getServiceId(), ServiceDependencyType.INSTALL);
hdfs.addServiceComponent(Role.HDFS_CLIENT.name(), Role.HDFS_CLIENT.name());
hdfs.addServiceComponent(Role.NAMENODE.name(), Role.NAMENODE.name());
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProviderTest.java
index 46b572a..ee1b500 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceDependencyResourceProviderTest.java
@@ -54,6 +54,7 @@ import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostState;
import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceDependencyType;
import org.apache.ambari.server.state.ServiceGroup;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
@@ -306,7 +307,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null);
+ cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -337,7 +338,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- cluster1, serviceGroupTest.getServiceGroupName(), zookeeper.getName(), null);
+ cluster1, serviceGroupTest.getServiceGroupName(), zookeeper.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -366,7 +367,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- cluster1, "invalid_service_group_name", zookeeper.getName(), null);
+ cluster1, "invalid_service_group_name", zookeeper.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -396,7 +397,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- "invalid_cluster_name", serviceGroupCore.getServiceGroupName(), zookeeper.getName(), null);
+ "invalid_cluster_name", serviceGroupCore.getServiceGroupName(), zookeeper.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -427,7 +428,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null);
+ cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -446,7 +447,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> deleteRequests = new HashSet<>();
ServiceDependencyRequest deleteRequest = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- null, null, null, serviceDependencyResponse.getDependencyId());
+ null, null, null, serviceDependencyResponse.getDependencyId(), ServiceDependencyType.INSTALL);
deleteRequests.add(deleteRequest);
serviceDependencyResourceProvider.deleteServiceDependencies(deleteRequests);
@@ -468,7 +469,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> requests = new HashSet<>();
ServiceDependencyRequest request = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null);
+ cluster1, serviceGroupCore.getServiceGroupName(), yarn.getName(), null, ServiceDependencyType.INSTALL);
requests.add(request);
ServiceDependencyResourceProvider serviceDependencyResourceProvider = new ServiceDependencyResourceProvider(controller);
@@ -487,7 +488,7 @@ public class ServiceDependencyResourceProviderTest {
Set<ServiceDependencyRequest> getRequests = new HashSet<>();
ServiceDependencyRequest getRequest = new ServiceDependencyRequest(cluster1, hdfs.getName(), serviceGroupCore.getServiceGroupName(),
- null, null, null, serviceDependencyResponse.getDependencyId());
+ null, null, null, serviceDependencyResponse.getDependencyId(), ServiceDependencyType.INSTALL);
Set<ServiceDependencyResponse> getResponses = serviceDependencyResourceProvider.getServiceDependencies(getRequests);
--
To stop receiving notification emails like this one, please contact
mradhakrishnan@apache.org.