ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject git commit: AMBARI-6811. API needs to expose a way to set "notes" when creating a new service config. (mpapirkovskyy)
Date Thu, 14 Aug 2014 07:18:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 646ef29b6 -> 30f8c43f8


AMBARI-6811. API needs to expose a way to set "notes" when creating a new service config.
(mpapirkovskyy)


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

Branch: refs/heads/trunk
Commit: 30f8c43f81173eea94863c0a1ebb964da2a40b49
Parents: 646ef29
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Thu Aug 14 10:15:42 2014 +0300
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Thu Aug 14 10:17:23 2014 +0300

----------------------------------------------------------------------
 .../AmbariManagementControllerImpl.java         |  5 ++-
 .../server/controller/ConfigurationRequest.java |  9 ++++
 .../controller/ServiceConfigVersionRequest.java |  8 ++++
 .../ServiceConfigVersionResponse.java           | 11 +++++
 .../internal/AbstractResourceProvider.java      |  3 ++
 .../internal/ClusterResourceProvider.java       | 11 +++--
 .../ServiceConfigVersionResourceProvider.java   |  5 ++-
 .../ServiceConfigApplicationEntity.java         | 12 ++++++
 .../org/apache/ambari/server/state/Cluster.java | 14 ++++++-
 .../server/state/cluster/ClusterImpl.java       | 43 +++++++++++---------
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  2 +-
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql     |  2 +-
 .../src/main/resources/properties.json          |  3 +-
 15 files changed, 101 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
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 2a9ea73..9cf5de9 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
@@ -1173,7 +1173,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       Config baseConfig = cluster.getConfig(cr.getType(), cr.getVersionTag());
       if (null != baseConfig) {
         String authName = getAuthName();
-        serviceConfigVersionResponse = cluster.addDesiredConfig(authName, baseConfig);
+        serviceConfigVersionResponse = cluster.addDesiredConfig(authName, baseConfig, cr.getServiceConfigVersionNote());
         if (serviceConfigVersionResponse != null) {
           Logger logger = LoggerFactory.getLogger("configchange");
           logger.info("cluster '" + request.getClusterName() + "' "
@@ -1249,7 +1249,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       }
 
       cluster.setServiceConfigVersion(serviceConfigVersionRequest.getServiceName(),
-          serviceConfigVersionRequest.getVersion(), getAuthName());
+          serviceConfigVersionRequest.getVersion(), getAuthName(),
+          serviceConfigVersionRequest.getNote());
     }
 
     if (serviceConfigVersionResponse != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
index 7c56eb5..0e28a86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
@@ -31,6 +31,7 @@ public class ConfigurationRequest {
   private String type;
   private String tag;
   private Long version;
+  private String serviceConfigVersionNote;
   private Map<String, String> configs;
   private boolean selected = true;
   private Map<String, Map<String, String>> configsAttributes;
@@ -166,4 +167,12 @@ public class ConfigurationRequest {
   public void setVersion(Long version) {
     this.version = version;
   }
+
+  public String getServiceConfigVersionNote() {
+    return serviceConfigVersionNote;
+  }
+
+  public void setServiceConfigVersionNote(String serviceConfigVersionNote) {
+    this.serviceConfigVersionNote = serviceConfigVersionNote;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
index 4784970..3d51468 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
@@ -25,6 +25,7 @@ public class ServiceConfigVersionRequest {
   private Long createTime;
   private Long applyTime;
   private String userName;
+  private String note;
 
   public ServiceConfigVersionRequest() {
   }
@@ -86,4 +87,11 @@ public class ServiceConfigVersionRequest {
     this.clusterName = clusterName;
   }
 
+  public String getNote() {
+    return note;
+  }
+
+  public void setNote(String note) {
+    this.note = note;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
index 765e765..491f112 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
@@ -32,6 +32,7 @@ public class ServiceConfigVersionResponse {
   private Long createTime;
   private Long applyTime;
   private String userName;
+  private String note;
   private List<ConfigurationResponse> configurations;
 
   @JsonProperty("service_name")
@@ -100,5 +101,15 @@ public class ServiceConfigVersionResponse {
   public void setConfigurations(List<ConfigurationResponse> configurations) {
     this.configurations = configurations;
   }
+
+  @JsonProperty("service_config_version_note")
+  @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+  public String getNote() {
+    return note;
+  }
+
+  public void setNote(String note) {
+    this.note = note;
+  }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
index 53e683c..a881730 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
@@ -363,6 +363,9 @@ public abstract class AbstractResourceProvider extends BaseProvider implements
R
         else if (propName.equals("selected")) {
           config.setSelected(Boolean.parseBoolean(entry.getValue().toString()));
         }
+        else if (propName.equals("service_config_version_note")) {
+          config.setServiceConfigVersionNote(entry.getValue().toString());
+        }
         else if (absCategory.endsWith("/properties")) {
           config.getProperties().put(propName, entry.getValue().toString());
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 64cdb4d..b0e2dd4 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
@@ -225,9 +225,11 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
             Resource resource = new ResourceImpl(Resource.Type.ServiceConfigVersion);
             ServiceConfigVersionResponse serviceConfigVersionResponse = stringServiceConfigVersionResponseEntry.getValue();
             resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID,
-                serviceConfigVersionResponse.getServiceName());
+              serviceConfigVersionResponse.getServiceName());
             resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID,
-                serviceConfigVersionResponse.getVersion());
+              serviceConfigVersionResponse.getVersion());
+            resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID,
+              serviceConfigVersionResponse.getNote());
             if (serviceConfigVersionResponse.getConfigurations() != null) {
               resource.setProperty(
                   ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
@@ -349,6 +351,9 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
           serviceConfigVersionRequest.setServiceName(entry.getValue().toString());
         else if (propName.equals("serviceconfigversion"))
           serviceConfigVersionRequest.setVersion(Long.valueOf(entry.getValue().toString()));
+        else if (propName.equals("service_config_version_note")) {
+          serviceConfigVersionRequest.setNote(entry.getValue().toString());
+        }
 
       }
     }
@@ -698,7 +703,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
       }
     }
     getManagementController().updateClusters(
-        Collections.singleton(getRequest(clusterProperties)), null);
+      Collections.singleton(getRequest(clusterProperties)), null);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
index a265e73..581ed54 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
@@ -38,6 +38,7 @@ public class ServiceConfigVersionResourceProvider extends
   public static final String SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null,
"createtime");
   public static final String SERVICE_CONFIG_VERSION_APPLY_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null,
"appliedtime");
   public static final String SERVICE_CONFIG_VERSION_USER_PROPERTY_ID = PropertyHelper.getPropertyId(null,
"user");
+  public static final String SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID = PropertyHelper.getPropertyId(null,
"service_config_version_note");
   public static final String SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID = PropertyHelper.getPropertyId(null,
"configurations");
 
   /**
@@ -101,6 +102,7 @@ public class ServiceConfigVersionResourceProvider extends
       resource.setProperty(SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID, response.getCreateTime());
       resource.setProperty(SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
           convertToSubResources(response.getClusterName(), response.getConfigurations()));
+      resource.setProperty(SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID, response.getNote());
 
       resources.add(resource);
     }
@@ -130,7 +132,8 @@ public class ServiceConfigVersionResourceProvider extends
 
       if (!propertyId.equals("cluster_name") && !propertyId.equals("serviceconfigversion")
&&
           !propertyId.equals("service_name") && !propertyId.equals("createtime")
&&
-          !propertyId.equals("appliedtime") && !propertyId.equals("user")) {
+          !propertyId.equals("appliedtime") && !propertyId.equals("user") &&
+          !propertyId.equals("service_config_version_note")) {
 
         unsupportedProperties.add(propertyId);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
index ba5adb5..6f2f441 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
@@ -55,6 +55,10 @@ public class ServiceConfigApplicationEntity {
   @Column(name = "user_name")
   private String user = "_db";
 
+  @Basic
+  @Column(name = "note")
+  private String note;
+
   @ManyToOne
   @JoinColumn(name = "service_config_id", referencedColumnName = "service_config_id")
   private ServiceConfigEntity serviceConfigEntity;
@@ -99,4 +103,12 @@ public class ServiceConfigApplicationEntity {
   public void setUser(String user) {
     this.user = user;
   }
+
+  public String getNote() {
+    return note;
+  }
+
+  public void setNote(String note) {
+    this.note = note;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
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 8c0638a..d62b0cf 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
@@ -164,14 +164,26 @@ public interface Cluster {
   public ServiceConfigVersionResponse addDesiredConfig(String user, Config config);
 
   /**
+   * Adds and sets a DESIRED configuration to be applied to a cluster.  There
+   * can be only one selected config per type.
+   * @param user the user making the change for audit purposes
+   * @param config  the {@link org.apache.ambari.server.state.Config} object to set as desired
+   * @param serviceConfigVersionNote note to attach to service config version if created
+   * @return <code>true</code> if the config was added, or <code>false</code>
+   * if the config is already set as the current
+   */
+  ServiceConfigVersionResponse addDesiredConfig(String user, Config config, String serviceConfigVersionNote);
+
+  /**
    * Apply specified service config version (rollback)
    * @param serviceName service name
    * @param version service config version
    * @param user the user making the change for audit purposes
+   * @param note
    * @return true if service config version applied
    * @throws AmbariException
    */
-  boolean setServiceConfigVersion(String serviceName, Long version, String user) throws AmbariException;
+  boolean setServiceConfigVersion(String serviceName, Long version, String user, String note)
throws AmbariException;
 
   /**
    * Get currently active service config versions for stack services

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 3daf32a..eb5d36d 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
@@ -1336,6 +1336,11 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public ServiceConfigVersionResponse addDesiredConfig(String user, Config config) {
+    return addDesiredConfig(user, config, null);
+  }
+
+  @Override
+  public ServiceConfigVersionResponse addDesiredConfig(String user, Config config, String
serviceConfigVersionNote) {
     if (null == user)
       throw new NullPointerException("User must be specified.");
 
@@ -1351,7 +1356,7 @@ public class ClusterImpl implements Cluster {
         }
 
         ServiceConfigVersionResponse serviceConfigVersionResponse =
-            applyConfig(config.getType(), config.getTag(), user);
+            applyConfig(config.getType(), config.getTag(), user, serviceConfigVersionNote);
 
         configHelper.invalidateStaleConfigsCache();
         return serviceConfigVersionResponse;
@@ -1409,7 +1414,7 @@ public class ClusterImpl implements Cluster {
   }
 
   @Override
-  public boolean setServiceConfigVersion(String serviceName, Long version, String user) throws
AmbariException {
+  public boolean setServiceConfigVersion(String serviceName, Long version, String user, String
note) throws AmbariException {
     if (null == user)
       throw new NullPointerException("User must be specified.");
 
@@ -1417,7 +1422,7 @@ public class ClusterImpl implements Cluster {
     try {
       readWriteLock.writeLock().lock();
       try {
-        applyServiceConfigVersion(serviceName, version, user);
+        applyServiceConfigVersion(serviceName, version, user, note);
 
         return true;
       } finally {
@@ -1458,25 +1463,19 @@ public class ClusterImpl implements Cluster {
       try {
         List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<ServiceConfigVersionResponse>();
         for (ServiceConfigApplicationEntity applicationEntity : serviceConfigDAO.getServiceConfigApplications(getClusterId()))
{
-          ServiceConfigVersionResponse serviceConfigVersionResponse = new ServiceConfigVersionResponse();
-
-          ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
-
+          ServiceConfigVersionResponse serviceConfigVersionResponse =
+            convertToServiceConfigVersionResponse(applicationEntity);
 
-          serviceConfigVersionResponse.setClusterName(getClusterName());
-          serviceConfigVersionResponse.setServiceName(serviceConfigEntity.getServiceName());
-          serviceConfigVersionResponse.setVersion(serviceConfigEntity.getVersion());
-          serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
-          serviceConfigVersionResponse.setApplyTime(applicationEntity.getApplyTimestamp());
-          serviceConfigVersionResponse.setUserName(applicationEntity.getUser());
           serviceConfigVersionResponse.setConfigurations(new ArrayList<ConfigurationResponse>());
 
+          ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
+
           List<ClusterConfigEntity> clusterConfigEntities = serviceConfigEntity.getClusterConfigEntities();
           for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
             Config config = allConfigs.get(clusterConfigEntity.getType()).get(clusterConfigEntity.getTag());
             serviceConfigVersionResponse.getConfigurations().add(new ConfigurationResponse(getClusterName(),
-                config.getType(), config.getTag(), config.getVersion(), config.getProperties(),
-                config.getPropertiesAttributes()));
+              config.getType(), config.getTag(), config.getVersion(), config.getProperties(),
+              config.getPropertiesAttributes()));
           }
 
           serviceConfigVersionResponses.add(serviceConfigVersionResponse);
@@ -1523,11 +1522,13 @@ public class ClusterImpl implements Cluster {
     serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
     serviceConfigVersionResponse.setApplyTime(applicationEntity.getApplyTimestamp());
     serviceConfigVersionResponse.setUserName(applicationEntity.getUser());
+    serviceConfigVersionResponse.setNote(applicationEntity.getNote());
     return serviceConfigVersionResponse;
   }
 
   @Transactional
-  void applyServiceConfigVersion(String serviceName, Long serviceConfigVersion, String user)
throws AmbariException {
+  void applyServiceConfigVersion(String serviceName, Long serviceConfigVersion, String user,
+                                 String serviceConfigVersionNote) throws AmbariException
{
     ServiceConfigEntity serviceConfigEntity = serviceConfigDAO.findByServiceAndVersion(serviceName,
serviceConfigVersion);
     if (serviceConfigEntity == null) {
       throw new ObjectNotFoundException("Service config version with serviceName={} and version={}
not found");
@@ -1550,6 +1551,7 @@ public class ClusterImpl implements Cluster {
     applicationEntity.setApplyTimestamp(System.currentTimeMillis());
     applicationEntity.setServiceConfigEntity(serviceConfigEntity);
     applicationEntity.setUser(user);
+    applicationEntity.setNote(serviceConfigVersionNote);
 
     serviceConfigEntity.getServiceConfigApplicationEntities().add(applicationEntity);
 
@@ -1582,7 +1584,7 @@ public class ClusterImpl implements Cluster {
   }
 
   @Transactional
-  ServiceConfigVersionResponse applyConfig(String type, String tag, String user) {
+  ServiceConfigVersionResponse applyConfig(String type, String tag, String user, String serviceConfigVersionNote)
{
 
     selectConfig(type, tag, user);
 
@@ -1599,12 +1601,13 @@ public class ClusterImpl implements Cluster {
       LOG.error("No service found for config type '{}', service config version not created");
       return null;
     } else {
-      return createServiceConfigVersion(serviceName, user);
+      return createServiceConfigVersion(serviceName, user, serviceConfigVersionNote);
     }
 
   }
 
-  private ServiceConfigVersionResponse createServiceConfigVersion(String serviceName, String
user) {
+  private ServiceConfigVersionResponse createServiceConfigVersion(String serviceName, String
user,
+                                                                  String serviceConfigVersionNote)
{
     //create next service config version
     ServiceConfigEntity serviceConfigEntity = new ServiceConfigEntity();
     serviceConfigEntity.setServiceName(serviceName);
@@ -1617,6 +1620,7 @@ public class ClusterImpl implements Cluster {
     serviceConfigApplicationEntity.setApplyTimestamp(serviceConfigEntity.getCreateTimestamp());
     serviceConfigApplicationEntity.setServiceConfigEntity(serviceConfigEntity);
     serviceConfigApplicationEntity.setUser(user);
+    serviceConfigApplicationEntity.setNote(serviceConfigVersionNote);
     serviceConfigEntity.getServiceConfigApplicationEntities().add(serviceConfigApplicationEntity);
 
     List<ClusterConfigEntity> configEntities = new ArrayList<ClusterConfigEntity>();
@@ -1646,6 +1650,7 @@ public class ClusterImpl implements Cluster {
     response.setServiceName(serviceConfigEntity.getServiceName());
     response.setCreateTime(serviceConfigEntity.getCreateTimestamp());
     response.setApplyTime(serviceConfigApplicationEntity.getApplyTimestamp());
+    response.setNote(serviceConfigApplicationEntity.getNote());
     return response;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 ff6c8c0..5fc03b1 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -30,7 +30,7 @@ CREATE TABLE clusters (cluster_id BIGINT NOT NULL, resource_id BIGINT NOT
NULL,
 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,
PRIMARY KEY (service_config_id));
 CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT
NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT
NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db',
 PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT
NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db',
note LONGTEXT,  PRIMARY KEY(apply_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));
 CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255)
NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL,
host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', restart_required TINYINT(1) NOT NULL
DEFAULT 0, PRIMARY KEY (cluster_id, component_name, host_name, service_name));

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 bdb20b8..c8897f7 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -21,7 +21,7 @@ CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, resource_id NUMBER(19)
NO
 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, PRIMARY KEY (service_config_id));
 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 serviceconfigapplication (apply_id NUMBER(19) NOT NULL, service_config_id NUMBER(19)
NOT NULL, apply_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL,
 PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id NUMBER(19) NOT NULL, service_config_id NUMBER(19)
NOT NULL, apply_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL,
note CLOB,  PRIMARY KEY(apply_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));
 CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255)
NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL,
host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, admin_state VARCHAR2(32)
NULL, maintenance_state VARCHAR2(32) NOT NULL, restart_required NUMBER(1) DEFAULT 0 NOT NULL,
PRIMARY KEY (cluster_id, component_name, host_name, service_name));

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 1f3b3e5..eb4d073 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -27,7 +27,7 @@ CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id
BIGINT
 
 CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT
NULL, PRIMARY KEY(service_config_id, config_id));
 
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT
NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db',
 PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT
NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db',
note TEXT, PRIMARY KEY(apply_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));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/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 58ad54a..d775eea 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
@@ -43,7 +43,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfig TO :username;
 CREATE TABLE ambari.serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT
NOT NULL, PRIMARY KEY(service_config_id, config_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigmapping TO :username;
 
-CREATE TABLE ambari.serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id
BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT
'_db',  PRIMARY KEY(apply_id));
+CREATE TABLE ambari.serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id
BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT
'_db', note TEXT, PRIMARY KEY(apply_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigapplication TO :username;
 
 CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT
NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/30f8c43f/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index e515b91..ff5c11f 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -91,7 +91,8 @@
         "ServiceConfigVersion/serviceconfigversion",
         "ServiceConfigVersion/createtime",
         "ServiceConfigVersion/appliedtime",
-        "ServiceConfigVersion/user"
+        "ServiceConfigVersion/user",
+        "ServiceConfigVersion/service_config_version_note"
     ],
     "ConfigGroup": [
         "ConfigGroup/id",


Mime
View raw message