You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2017/10/26 15:55:42 UTC
ambari git commit: AMBARI-22253. Add topology_configurations tabel to
all sql scripts (magyari_sandor)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-14714 b0f5639cb -> d8406d0be
AMBARI-22253. Add topology_configurations tabel to all sql scripts (magyari_sandor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d8406d0b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d8406d0b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d8406d0b
Branch: refs/heads/branch-feature-AMBARI-14714
Commit: d8406d0be5f3c8e1c3aa3ebef762b107c51cff73
Parents: b0f5639
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Thu Oct 26 17:44:21 2017 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Thu Oct 26 17:47:08 2017 +0200
----------------------------------------------------------------------
.../internal/ClusterResourceProvider.java | 2 +-
.../internal/ProvisionClusterRequest.java | 41 ++++++++++++++------
.../server/topology/PersistedStateImpl.java | 5 ++-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 12 ++++++
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 12 ++++++
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 12 ++++++
.../resources/Ambari-DDL-Postgres-CREATE.sql | 2 +-
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 12 ++++++
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 12 ++++++
9 files changed, 95 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 54c8360..ed80291 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -202,7 +202,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
baseUnsupported.remove("blueprint");
baseUnsupported.remove("host_groups");
baseUnsupported.remove("default_password");
- baseUnsupported.remove("configurations");
+ baseUnsupported.remove("services");
baseUnsupported.remove("credentials");
baseUnsupported.remove("config_recommendation_strategy");
baseUnsupported.remove("provision_action");
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index 0e1753b..f773fc8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -31,12 +31,16 @@ import org.apache.ambari.server.stack.NoSuchStackException;
import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfileBuilder;
import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfileEvaluationException;
import org.apache.ambari.server.topology.ConfigRecommendationStrategy;
+import org.apache.ambari.server.topology.Configuration;
import org.apache.ambari.server.topology.ConfigurationFactory;
import org.apache.ambari.server.topology.Credential;
import org.apache.ambari.server.topology.HostGroupInfo;
import org.apache.ambari.server.topology.InvalidTopologyTemplateException;
import org.apache.ambari.server.topology.NoSuchBlueprintException;
import org.apache.ambari.server.topology.SecurityConfiguration;
+import org.apache.ambari.server.topology.Service;
+import org.apache.ambari.server.topology.ServiceId;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -124,6 +128,8 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
* The service and component level quick link filters property
*/
public static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY = "quicklinks_profile/services";
+ public static final String SERVICE_GROUP_NAME_PROPERETY = "service_group";
+ public static final String SERVICE_NAME_PROPERTY = "name";
/**
@@ -189,21 +195,34 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
this.securityConfiguration = securityConfiguration;
- //TODO parse service configs and mereg with BP service configs
-// Collection<Map<String, String>> services = properties.get(SERVICES_PROPERTY);
-// Configuration configuration = configurationFactory.getConfiguration(
-// (Collection<Map<String, String>>) properties.get(CONFIGURATIONS_PROPERTY));
-// configuration.setParentConfiguration(blueprint.getConfiguration());
-// setConfiguration(configuration);
-
- //TODO load services, merge servie configs from Cluster template with service configs from Blueprint
+ // parse service configs and merge with BP service configs
serviceConfigs = new ArrayList<>();
-
+ Collection<Map> services = (Collection<Map>) properties.get(SERVICES_PROPERTY);
+ for (Map serviceMap : services) {
+ String serviceName = (String) serviceMap.get(SERVICE_NAME_PROPERTY);
+ if (StringUtils.isEmpty(serviceName)) {
+ throw new InvalidTopologyTemplateException("Service name must be specified.");
+ }
+ String serviceGroupName = (String) serviceMap.get(SERVICE_GROUP_NAME_PROPERETY);
+ if (StringUtils.isEmpty(serviceGroupName)) {
+ throw new InvalidTopologyTemplateException("Service group name must be specified for service: " + serviceName);
+ }
+ Configuration configuration = configurationFactory.getConfiguration((Collection<Map<String, String>>)
+ serviceMap.get(CONFIGURATIONS_PROPERTY));
+ ServiceId serviceId = ServiceId.of(serviceName, serviceGroupName);
+ Service service = blueprint.getServiceById(serviceId);
+ if (service == null) {
+ throw new InvalidTopologyTemplateException("Service: " + serviceName + " in service group: "
+ + serviceGroupName + " not found.");
+ }
+ service.getConfiguration().setParentConfiguration(service.getStack().getConfiguration());
+ configuration.setParentConfiguration(service.getConfiguration());
+ service.setConfiguration(configuration);
+ serviceConfigs.add(service);
+ }
parseHostGroupInfo(properties);
-
this.credentialsMap = parseCredentials(properties);
-
this.configRecommendationStrategy = parseConfigRecommendationStrategy(properties);
setProvisionAction(parseProvisionAction(properties));
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index b18915c..3bfa644 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -414,11 +414,12 @@ public class PersistedStateImpl implements PersistedState {
&& topologyConfigurationsEntity.getHostGroupName() == null))
.forEach(topologyConfigurationsEntity -> {
- ServiceId serviceId = ServiceId.of(topologyConfigurationsEntity.getServiceGroupName(),
- topologyConfigurationsEntity.getServiceName());
+ ServiceId serviceId = ServiceId.of(topologyConfigurationsEntity.getServiceName(),
+ topologyConfigurationsEntity.getServiceGroupName());
Service service = blueprint.getServiceById(serviceId);
Configuration configuration = createConfiguration(topologyConfigurationsEntity.getConfigProperties(),
topologyConfigurationsEntity.getConfigAttributes());
+ service.getConfiguration().setParentConfiguration(service.getStack().getConfiguration());
configuration.setParentConfiguration(service.getConfiguration());
service.setConfiguration(configuration);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
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 0d82cd4..ff0c587 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -766,6 +766,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id BIGINT NOT NULL,
+ request_id BIGINT NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties VARCHAR(3000),
+ cluster_attributes VARCHAR(3000),
+ CONSTRAINT PK_topology_configurations PRIMARY KEY (id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id BIGINT NOT NULL,
name VARCHAR(255) NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
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 d70d853..cbe0f97 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -782,6 +782,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id BIGINT NOT NULL,
+ request_id BIGINT NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties LONGTEXT,
+ cluster_attributes LONGTEXT,
+ CONSTRAINT PK_topology_configurations PRIMARY KEY (id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id BIGINT NOT NULL,
name VARCHAR(255) NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
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 54e890d..d0fffeb 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -763,6 +763,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id NUMBER(19) NOT NULL,
+ request_id NUMBER(19) NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties CLOB,
+ cluster_attributes CLOB,
+ CONSTRAINT PK_topology_configurations PRIMARY KEY (id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id NUMBER(19) NOT NULL,
name VARCHAR(255) NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
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 437756a..2f91323 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -39,7 +39,7 @@ CREATE TABLE stack (
stack_id BIGINT NOT NULL,
stack_name VARCHAR(255) NOT NULL,
stack_version VARCHAR(255) NOT NULL,
- repo_version VARCHAR(255) NOT NULL,
+ repo_version VARCHAR(255),
current_mpack_id BIGINT,
CONSTRAINT PK_stack PRIMARY KEY (stack_id),
CONSTRAINT FK_mpacks FOREIGN KEY (current_mpack_id) REFERENCES mpacks(id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
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 74e3e69..ceb269e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -761,6 +761,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id NUMERIC(19) NOT NULL,
+ request_id NUMERIC(19) NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties TEXT,
+ cluster_attributes TEXT,
+ CONSTRAINT PK_topology_configurations PRIMARY KEY (id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id NUMERIC(19) NOT NULL,
name VARCHAR(255) NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
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 cffe53d..cc86d50 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -782,6 +782,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY CLUSTERED (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id BIGINT NOT NULL,
+ request_id BIGINT NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties TEXT,
+ cluster_attributes TEXT,
+ CONSTRAINT PK_topology_configurations PRIMARY KEY CLUSTERED(id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id BIGINT NOT NULL,
name VARCHAR(255) NOT NULL,