ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject git commit: AMBARI-7001. Handle upgrade for Service Config versions for config groups. (myroslav via mahadev)
Date Sun, 24 Aug 2014 17:21:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a6febc087 -> ebf47965b


AMBARI-7001. Handle upgrade for Service Config versions for config groups. (myroslav via mahadev)


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

Branch: refs/heads/trunk
Commit: ebf47965b9312ace3c56adbf4416021e21f8cdcb
Parents: a6febc0
Author: Mahadev Konar <mahadev@apache.org>
Authored: Sun Aug 24 10:21:13 2014 -0700
Committer: Mahadev Konar <mahadev@apache.org>
Committed: Sun Aug 24 10:21:19 2014 -0700

----------------------------------------------------------------------
 .../api/services/ConfigurationService.java      |  2 +-
 .../internal/ConfigGroupResourceProvider.java   | 26 ++++++++++++++++----
 .../ambari/server/orm/dao/ServiceConfigDAO.java |  9 ++++++-
 .../server/orm/entities/ConfigGroupEntity.java  | 11 +++++++++
 .../server/state/cluster/ClusterImpl.java       |  8 ++++--
 .../server/state/configgroup/ConfigGroup.java   |  4 +++
 .../state/configgroup/ConfigGroupImpl.java      | 21 ++++++++++++++++
 .../server/upgrade/UpgradeCatalog170.java       | 11 +++++++++
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  4 +--
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  4 +--
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  4 +--
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql     |  4 +--
 12 files changed, 91 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
index 18fa335..cfbfc7f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
@@ -51,7 +51,7 @@ public class ConfigurationService extends BaseService {
     m_clusterName = clusterName;
   }
 
-  @Path("serviceconfigversions")
+  @Path("service_config_versions")
   public ServiceConfigVersionService getServiceConfigVersionService() {
     return new ServiceConfigVersionService(m_clusterName);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index bb75832..c803c5a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -17,6 +17,8 @@
  */
 package org.apache.ambari.server.controller.internal;
 
+import com.google.common.collect.MapDifference;
+import com.google.common.collect.Maps;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ClusterNotFoundException;
 import org.apache.ambari.server.ConfigGroupNotFoundException;
@@ -44,6 +46,7 @@ import org.apache.ambari.server.state.ConfigImpl;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -457,9 +460,10 @@ public class ConfigGroupResourceProvider extends
         request.getConfigs(), hosts);
 
       String serviceName = null;
-      if (configGroup.getConfigurations() != null) {
-        serviceName = cluster.getServiceForConfigTypes(configGroup.getConfigurations().keySet());
+      if (request.getConfigs() != null && !request.getConfigs().isEmpty()) {
+        serviceName = cluster.getServiceForConfigTypes(request.getConfigs().keySet());
       }
+      configGroup.setServiceName(serviceName);
 
       // Persist before add, since id is auto-generated
       configLogger.info("Persisting new Config group"
@@ -472,6 +476,9 @@ public class ConfigGroupResourceProvider extends
       cluster.addConfigGroup(configGroup);
       if (serviceName != null) {
         cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(),
null, configGroup);
+      } else {
+        LOG.warn("Could not determine service name for config group {}, service config version
not created",
+            configGroup.getId());
       }
 
       ConfigGroupResponse response = new ConfigGroupResponse(configGroup
@@ -517,9 +524,15 @@ public class ConfigGroupResourceProvider extends
                                  + ", clusterName = " + request.getClusterName()
                                  + ", groupId = " + request.getId());
       }
-      String serviceName = null;
-      if (configGroup.getConfigurations() != null) {
-        serviceName = cluster.getServiceForConfigTypes(configGroup.getConfigurations().keySet());
+      String serviceName = configGroup.getServiceName();
+      String requestServiceName = cluster.getServiceForConfigTypes(request.getConfigs().keySet());
+      if (serviceName != null && requestServiceName !=null && !StringUtils.equals(serviceName,
requestServiceName)) {
+        throw new IllegalArgumentException("Config group " + configGroup.getId() +
+            " is mapped to service " + serviceName + ", " +
+            "but request contain configs from service " + requestServiceName);
+      } else if (serviceName == null && requestServiceName != null) {
+        configGroup.setServiceName(requestServiceName);
+        serviceName = requestServiceName;
       }
 
       // Update hosts
@@ -555,6 +568,9 @@ public class ConfigGroupResourceProvider extends
       configGroup.persist();
       if (serviceName != null) {
         cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(),
null, configGroup);
+      } else {
+        LOG.warn("Could not determine service name for config group {}, service config version
not created",
+            configGroup.getId());
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
index add58fc..9d13eb2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
@@ -32,7 +32,6 @@ import java.util.List;
 import java.util.Map;
 
 @Singleton
-@RequiresSession
 public class ServiceConfigDAO {
   @Inject
   Provider<EntityManager> entityManagerProvider;
@@ -40,10 +39,12 @@ public class ServiceConfigDAO {
   DaoUtils daoUtils;
 
 
+  @RequiresSession
   public ServiceConfigEntity find(Long serviceConfigId) {
     return entityManagerProvider.get().find(ServiceConfigEntity.class, serviceConfigId);
   }
 
+  @RequiresSession
   public ServiceConfigEntity findByServiceAndVersion(String serviceName, Long version) {
     TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
         createQuery("SELECT scv FROM ServiceConfigEntity scv " +
@@ -51,6 +52,7 @@ public class ServiceConfigDAO {
     return daoUtils.selectOne(query, serviceName, version);
   }
 
+  @RequiresSession
   public Map<String, Long> findMaxVersions(Long clusterId) {
     Map<String, Long> maxVersions = new HashMap<String, Long>();
 
@@ -64,6 +66,7 @@ public class ServiceConfigDAO {
     return maxVersions;
   }
 
+  @RequiresSession
   public List<Long> getServiceConfigVersionsByConfig(Long clusterId, String configType,
Long configVersion) {
     TypedQuery<Long> query = entityManagerProvider.get().createQuery("SELECT scv.version
" +
         "FROM ServiceConfigEntity scv JOIN scv.clusterConfigEntities cc " +
@@ -71,6 +74,7 @@ public class ServiceConfigDAO {
     return daoUtils.selectList(query, clusterId, configType, configVersion);
   }
 
+  @RequiresSession
   public List<ServiceConfigEntity> getLastServiceConfigs(Long clusterId) {
     TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
       createQuery("SELECT scv FROM ServiceConfigEntity scv " +
@@ -82,6 +86,7 @@ public class ServiceConfigDAO {
     return daoUtils.selectList(query, clusterId);
   }
 
+  @RequiresSession
   public ServiceConfigEntity getLastServiceConfig(Long clusterId, String serviceName) {
     TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
         createQuery("SELECT scv FROM ServiceConfigEntity scv " +
@@ -92,6 +97,7 @@ public class ServiceConfigDAO {
     return daoUtils.selectOne(query, clusterId, serviceName);
   }
 
+  @RequiresSession
   public ServiceConfigEntity findMaxVersion(Long clusterId, String serviceName) {
     TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().createQuery("SELECT
scv FROM ServiceConfigEntity scv " +
       "WHERE scv.clusterId=?1 AND scv.serviceName=?2 AND scv.version = (" +
@@ -101,6 +107,7 @@ public class ServiceConfigDAO {
     return daoUtils.selectSingle(query, clusterId, serviceName);
   }
 
+  @RequiresSession
   public List<ServiceConfigEntity> getServiceConfigs(Long clusterId) {
     TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get()
       .createQuery("SELECT scv FROM ServiceConfigEntity scv " +

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigGroupEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigGroupEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigGroupEntity.java
index a5e293c..f791ffd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigGroupEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigGroupEntity.java
@@ -73,6 +73,9 @@ public class ConfigGroupEntity {
   @Column(name = "create_timestamp", nullable=false, insertable=true, updatable=false)
   private long timestamp;
 
+  @Column(name = "service_name")
+  private String serviceName;
+
   @ManyToOne
   @JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false)
   private ClusterEntity clusterEntity;
@@ -178,4 +181,12 @@ public class ConfigGroupEntity {
     result = 31 * result + tag.hashCode();
     return result;
   }
+
+  public String getServiceName() {
+    return serviceName;
+  }
+
+  public void setServiceName(String serviceName) {
+    this.serviceName = serviceName;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
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 baf58e7..ee6952a 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
@@ -209,7 +209,7 @@ public class ClusterImpl implements Cluster {
   }
 
 
-  public void loadServiceConfigTypes() throws AmbariException {
+  private void loadServiceConfigTypes() throws AmbariException {
     try {
       serviceConfigTypes = collectServiceConfigTypesMapping();
     } catch (AmbariException e) {
@@ -1425,10 +1425,11 @@ public class ClusterImpl implements Cluster {
     serviceConfigEntity.setNote(note);
 
     if (configGroup != null) {
+      serviceConfigEntity.setGroupId(configGroup.getId());
       Collection<Config> configs = configGroup.getConfigurations().values();
       List<ClusterConfigEntity> configEntities = new ArrayList<ClusterConfigEntity>(configs.size());
       for (Config config : configs) {
-        configEntities.add(clusterDAO.findConfig(getClusterId(), config.getType(), config.getVersion()));
+        configEntities.add(clusterDAO.findConfig(getClusterId(), config.getType(), config.getTag()));
       }
       serviceConfigEntity.setClusterConfigEntities(configEntities);
 
@@ -1458,6 +1459,8 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public String getServiceForConfigTypes(Collection<String> configTypes) {
+    //debug
+    LOG.info("Looking for service for config types {}", configTypes);
     String serviceName = null;
     for (String configType : configTypes) {
       for (Entry<String, String> entry : serviceConfigTypes.entries()) {
@@ -1473,6 +1476,7 @@ public class ClusterImpl implements Cluster {
         }
       }
     }
+    LOG.info("Service {} returning", serviceName);
     return serviceName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroup.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroup.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroup.java
index 8ec257e..a4cc6ac 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroup.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroup.java
@@ -149,4 +149,8 @@ public interface ConfigGroup {
    * Remove host mapping
    */
   public void removeHost(String hostname) throws AmbariException;
+
+  String getServiceName();
+
+  void setServiceName(String serviceName);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index fa06c07..9aea618 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -531,4 +531,25 @@ public class ConfigGroupImpl implements ConfigGroup {
   }
 
 
+  @Override
+  public String getServiceName() {
+    readWriteLock.readLock().lock();
+    try {
+      return this.configGroupEntity.getServiceName();
+    } finally {
+      readWriteLock.readLock().unlock();
+    }
+
+  }
+
+  @Override
+  public void setServiceName(String serviceName) {
+    readWriteLock.writeLock().lock();
+    try {
+      this.configGroupEntity.setServiceName(serviceName);
+    } finally {
+      readWriteLock.writeLock().unlock();
+    }
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
index 33f79f4..9f61c3d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
@@ -337,8 +337,14 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
     columns.add(new DBColumnInfo("create_timestamp", Long.class, null, null, false));
     columns.add(new DBColumnInfo("user_name", String.class, null, "_db", false));
     columns.add(new DBColumnInfo("note", char[].class, null, null, true));
+    columns.add(new DBColumnInfo("group_id", Long.class, null, null, true));
     dbAccessor.createTable("serviceconfig", columns, "service_config_id");
 
+    columns.clear();
+    columns.add(new DBColumnInfo("service_config_id", Long.class, null, null, false));
+    columns.add(new DBColumnInfo("hostname", String.class, 255, null, false));
+    dbAccessor.createTable("serviceconfighosts", columns, "service_config_id", "hostname");
+
     dbAccessor.executeQuery("ALTER TABLE serviceconfig ADD CONSTRAINT UQ_scv_service_version
UNIQUE (cluster_id, service_name, version)", true);
 
     columns.clear();
@@ -350,6 +356,11 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
       new String[]{"cluster_id", "config_type", "version_tag"}, "clusterconfig",
       new String[]{"cluster_id", "type_name", "version_tag"}, true);
 
+    dbAccessor.addFKConstraint("serviceconfighosts", "FK_scvhosts_scv",
+      new String[]{"service_config_id"}, "serviceconfig",
+      new String[]{"service_config_id"}, true);
+
+    dbAccessor.addColumn("configgroup", new DBColumnInfo("service_name", String.class, 255));
 
     dbAccessor.executeQuery("INSERT INTO ambari_sequences(sequence_name, sequence_value)
VALUES('alert_definition_id_seq', 0)", false);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/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 f513711..0a372b5 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -29,7 +29,7 @@ delimiter ;
 CREATE TABLE clusters (cluster_id BIGINT NOT NULL, resource_id BIGINT NOT NULL, cluster_info
VARCHAR(255) NOT NULL, cluster_name VARCHAR(100) NOT NULL UNIQUE, provisioning_state VARCHAR(255)
NOT NULL DEFAULT 'INIT', desired_cluster_state VARCHAR(255) NOT NULL, desired_stack_version
VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE clusterconfig (config_id BIGINT NOT NULL, version_tag VARCHAR(255) NOT NULL,
version BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data
LONGTEXT NOT NULL, config_attributes LONGTEXT, create_timestamp BIGINT NOT NULL, PRIMARY KEY
(config_id));
 CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL,
service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL,
user_name VARCHAR(255) NOT NULL DEFAULT '_db', group_id BIGINT, note LONGTEXT, PRIMARY KEY
(service_config_id));
-CREATE TABLE serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255),
PRIMARY KEY(service_config_id, hostname));
+CREATE TABLE serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255)
NOT NULL, PRIMARY KEY(service_config_id, hostname));
 CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT
NULL, PRIMARY KEY(service_config_id, config_id));
 CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL,
service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255)
NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
@@ -56,7 +56,7 @@ CREATE TABLE metainfo (`metainfo_key` VARCHAR(255), `metainfo_value` LONGTEXT,
P
 CREATE TABLE ClusterHostMapping (cluster_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL,
PRIMARY KEY (cluster_id, host_name));
 CREATE TABLE ambari_sequences (sequence_name VARCHAR(255), sequence_value DECIMAL(38) NOT
NULL, PRIMARY KEY (sequence_name));
 CREATE TABLE confgroupclusterconfigmapping (config_group_id BIGINT NOT NULL, cluster_id BIGINT
NOT NULL, config_type VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, user_name
VARCHAR(255) DEFAULT '_db', create_timestamp BIGINT NOT NULL, PRIMARY KEY(config_group_id,
cluster_id, config_type));
-CREATE TABLE configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name VARCHAR(255)
NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp BIGINT NOT
NULL, PRIMARY KEY(group_id));
+CREATE TABLE configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name VARCHAR(255)
NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp BIGINT NOT
NULL, service_name VARCHAR(255), PRIMARY KEY(group_id));
 CREATE TABLE configgrouphostmapping (config_group_id BIGINT NOT NULL, host_name VARCHAR(255)
NOT NULL, PRIMARY KEY(config_group_id, host_name));
 CREATE TABLE requestschedule (schedule_id bigint, cluster_id BIGINT NOT NULL, description
varchar(255), status varchar(255), batch_separation_seconds smallint, batch_toleration_limit
smallint, create_user varchar(255), create_timestamp bigint, update_user varchar(255), update_timestamp
bigint, minutes varchar(10), hours varchar(10), days_of_month varchar(10), month varchar(10),
day_of_week varchar(10), yearToSchedule varchar(10), startTime varchar(50), endTime varchar(50),
last_execution_status varchar(255), PRIMARY KEY(schedule_id));
 CREATE TABLE requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id
bigint, request_type varchar(255), request_uri varchar(1024), request_body LONGBLOB, request_status
varchar(255), return_code smallint, return_message varchar(2000), PRIMARY KEY(schedule_id,
batch_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/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 7ac557d..817d1e9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -20,7 +20,7 @@
 CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, resource_id NUMBER(19) NOT NULL, cluster_info
VARCHAR2(255) NULL, cluster_name VARCHAR2(100) NOT NULL UNIQUE, provisioning_state VARCHAR2(255)
DEFAULT 'INIT' NOT NULL, desired_cluster_state VARCHAR2(255) NULL, desired_stack_version VARCHAR2(255)
NULL, PRIMARY KEY (cluster_id));
 CREATE TABLE clusterconfig (config_id NUMBER(19) NOT NULL, version_tag VARCHAR2(255) NOT
NULL, version NUMBER(19) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19)
NOT NULL, config_data CLOB NOT NULL, config_attributes CLOB, create_timestamp NUMBER(19) NOT
NULL, PRIMARY KEY (config_id));
 CREATE TABLE serviceconfig (service_config_id NUMBER(19) NOT NULL, cluster_id NUMBER(19)
NOT NULL, service_name VARCHAR(255) NOT NULL, version NUMBER(19) NOT NULL, create_timestamp
NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL, group_id NUMBER(19), note
CLOB, PRIMARY KEY (service_config_id));
-CREATE TABLE serviceconfighosts (service_config_id NUMBER(19) NOT NULL, hostname VARCHAR(255),
PRIMARY KEY(service_config_id, hostname));
+CREATE TABLE serviceconfighosts (service_config_id NUMBER(19) NOT NULL, hostname VARCHAR(255)
NOT NULL, PRIMARY KEY(service_config_id, hostname));
 CREATE TABLE serviceconfigmapping (service_config_id NUMBER(19) NOT NULL, config_id NUMBER(19)
NOT NULL, PRIMARY KEY(service_config_id, config_id));
 CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19)
NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
 CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255)
NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
@@ -46,7 +46,7 @@ CREATE TABLE hostconfigmapping (create_timestamp NUMBER(19) NOT NULL, host_name
 CREATE TABLE metainfo ("metainfo_key" VARCHAR2(255) NOT NULL, "metainfo_value" CLOB NULL,
PRIMARY KEY ("metainfo_key"));
 CREATE TABLE ClusterHostMapping (cluster_id NUMBER(19) NOT NULL, host_name VARCHAR2(255)
NOT NULL, PRIMARY KEY (cluster_id, host_name));
 CREATE TABLE ambari_sequences (sequence_name VARCHAR2(50) NOT NULL, sequence_value NUMBER(38)
NULL, PRIMARY KEY (sequence_name));
-CREATE TABLE configgroup (group_id NUMBER(19), cluster_id NUMBER(19) NOT NULL, group_name
VARCHAR2(255) NOT NULL, tag VARCHAR2(1024) NOT NULL, description VARCHAR2(1024), create_timestamp
NUMBER(19) NOT NULL, PRIMARY KEY(group_id));
+CREATE TABLE configgroup (group_id NUMBER(19), cluster_id NUMBER(19) NOT NULL, group_name
VARCHAR2(255) NOT NULL, tag VARCHAR2(1024) NOT NULL, description VARCHAR2(1024), create_timestamp
NUMBER(19) NOT NULL, service_name VARCHAR(255), PRIMARY KEY(group_id));
 CREATE TABLE confgroupclusterconfigmapping (config_group_id NUMBER(19) NOT NULL, cluster_id
NUMBER(19) NOT NULL, config_type VARCHAR2(255) NOT NULL, version_tag VARCHAR2(255) NOT NULL,
user_name VARCHAR2(255) DEFAULT '_db', create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY(config_group_id,
cluster_id, config_type));
 CREATE TABLE configgrouphostmapping (config_group_id NUMBER(19) NOT NULL, host_name VARCHAR2(255)
NOT NULL, PRIMARY KEY(config_group_id, host_name));
 CREATE TABLE requestschedule (schedule_id NUMBER(19), cluster_id NUMBER(19) NOT NULL, description
VARCHAR2(255), status VARCHAR2(255), batch_separation_seconds smallint, batch_toleration_limit
smallint, create_user VARCHAR2(255), create_timestamp NUMBER(19), update_user VARCHAR2(255),
update_timestamp NUMBER(19), minutes VARCHAR2(10), hours VARCHAR2(10), days_of_month VARCHAR2(10),
month VARCHAR2(10), day_of_week VARCHAR2(10), yearToSchedule VARCHAR2(10), startTime VARCHAR2(50),
endTime VARCHAR2(50), last_execution_status VARCHAR2(255), PRIMARY KEY(schedule_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/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 aa742f7..1ea4a55 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -25,7 +25,7 @@ CREATE TABLE clusterconfigmapping (cluster_id BIGINT NOT NULL, type_name
VARCHAR
 
 CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL,
service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL,
user_name VARCHAR(255) NOT NULL DEFAULT '_db', group_id BIGINT, note TEXT, PRIMARY KEY (service_config_id));
 
-CREATE TABLE serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255),
PRIMARY KEY(service_config_id, hostname));
+CREATE TABLE serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255)
NOT NULL, PRIMARY KEY(service_config_id, hostname));
 
 CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT
NULL, PRIMARY KEY(service_config_id, config_id));
 
@@ -75,7 +75,7 @@ CREATE TABLE metainfo ("metainfo_key" VARCHAR(255), "metainfo_value" VARCHAR,
PR
 
 CREATE TABLE ambari_sequences (sequence_name VARCHAR(255) PRIMARY KEY, sequence_value BIGINT
NOT NULL);
 
-CREATE TABLE configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name VARCHAR(255)
NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp BIGINT NOT
NULL, PRIMARY KEY(group_id));
+CREATE TABLE configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name VARCHAR(255)
NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp BIGINT NOT
NULL, service_name VARCHAR(255), PRIMARY KEY(group_id));
 
 CREATE TABLE confgroupclusterconfigmapping (config_group_id BIGINT NOT NULL, cluster_id BIGINT
NOT NULL, config_type VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, user_name
VARCHAR(255) DEFAULT '_db', create_timestamp BIGINT NOT NULL, PRIMARY KEY(config_group_id,
cluster_id, config_type));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index c421cc9..ef8a24d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -40,7 +40,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username;
 CREATE TABLE ambari.serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT
NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT
NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', group_id BIGINT, note TEXT, PRIMARY
KEY (service_config_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfig TO :username;
 
-CREATE TABLE ambari.serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255),
PRIMARY KEY(service_config_id, hostname));
+CREATE TABLE ambari.serviceconfighosts (service_config_id BIGINT NOT NULL, hostname VARCHAR(255)
NOT NULL, PRIMARY KEY(service_config_id, hostname));
 GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfighosts TO :username;
 
 CREATE TABLE ambari.serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT
NOT NULL, PRIMARY KEY(service_config_id, config_id));
@@ -115,7 +115,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.metainfo TO :username;
 CREATE TABLE ambari.ambari_sequences (sequence_name VARCHAR(255) PRIMARY KEY, sequence_value
BIGINT NOT NULL);
 GRANT ALL PRIVILEGES ON TABLE ambari.ambari_sequences TO :username;
 
-CREATE TABLE ambari.configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name
VARCHAR(255) NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp
BIGINT NOT NULL, PRIMARY KEY(group_id));
+CREATE TABLE ambari.configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name
VARCHAR(255) NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp
BIGINT NOT NULL, service_name VARCHAR(255), PRIMARY KEY(group_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.configgroup TO :username;
 
 CREATE TABLE ambari.confgroupclusterconfigmapping (config_group_id BIGINT NOT NULL, cluster_id
BIGINT NOT NULL, config_type VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, user_name
VARCHAR(255) DEFAULT '_db', create_timestamp BIGINT NOT NULL, PRIMARY KEY(config_group_id,
cluster_id, config_type));


Mime
View raw message