ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [3/3] ambari git commit: AMBARI-10733. Saving config groups cause ambari server exceptions. (mpapirkovskyy)
Date Fri, 24 Apr 2015 19:01:11 GMT
AMBARI-10733. Saving config groups cause ambari server exceptions. (mpapirkovskyy)


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

Branch: refs/heads/trunk
Commit: 3e776a51165cd56cd59dee02236ed88e3825c10a
Parents: 0dd0821
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Fri Apr 24 19:49:57 2015 +0300
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Fri Apr 24 22:00:54 2015 +0300

----------------------------------------------------------------------
 .../internal/ServiceConfigVersionResourceProvider.java   |  2 +-
 .../org/apache/ambari/server/orm/dao/ClusterDAO.java     |  1 +
 .../main/java/org/apache/ambari/server/state/Config.java |  2 ++
 .../java/org/apache/ambari/server/state/ConfigImpl.java  | 11 +++++++----
 .../ambari/server/state/configgroup/ConfigGroupImpl.java |  1 +
 5 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3e776a51/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 52113ff..6ce904b 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
@@ -230,7 +230,7 @@ public class ServiceConfigVersionResourceProvider extends
       subResourceMap.put("type", config.getType());
       subResourceMap.put("tag", config.getVersionTag());
       subResourceMap.put("version", config.getVersion());
-      subResourceMap.put("properties", new TreeMap(config.getConfigs()));
+      subResourceMap.put("properties", new TreeMap<String, String>(config.getConfigs()));
       subResourceMap.put("properties_attributes", config.getConfigAttributes());
       result.add(subResourceMap);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3e776a51/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
index 35a1700..a57ef1f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.orm.dao;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 import javax.persistence.EntityManager;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3e776a51/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
index 7eeea7d..502e1bf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
@@ -26,6 +26,8 @@ import java.util.Map;
  */
 public interface Config {
 
+  void setStackId(StackId stackId);
+
   /**
    * @return Config Type
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/3e776a51/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java
index 4a62ff6..6866b0c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java
@@ -47,15 +47,12 @@ public class ConfigImpl implements Config {
   private Map<String, String> properties;
   private Map<String, Map<String, String>> propertiesAttributes;
   private ClusterConfigEntity entity;
-
   @Inject
   private ClusterDAO clusterDAO;
   @Inject
   private Gson gson;
   @Inject
   private ServiceConfigDAO serviceConfigDAO;
-
-
   @AssistedInject
   public ConfigImpl(@Assisted Cluster cluster, @Assisted String type, @Assisted Map<String,
String> properties,
       @Assisted Map<String, Map<String, String>> propertiesAttributes, Injector
injector) {
@@ -72,6 +69,7 @@ public class ConfigImpl implements Config {
 
   }
 
+
   @AssistedInject
   public ConfigImpl(@Assisted Cluster cluster, @Assisted ClusterConfigEntity entity, Injector
injector) {
     this.cluster = cluster;
@@ -97,11 +95,16 @@ public class ConfigImpl implements Config {
    * {@inheritDoc}
    */
   @Override
-  public StackId getStackId() {
+  public synchronized StackId getStackId() {
     return stackId;
   }
 
   @Override
+  public synchronized void setStackId(StackId stackId) {
+    this.stackId = stackId;
+  }
+
+  @Override
   public String getType() {
     return type;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3e776a51/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 4c5d016..656c452 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
@@ -406,6 +406,7 @@ public class ConfigGroupImpl implements ConfigGroup {
 
         if (clusterConfigEntity == null) {
           config.setVersion(cluster.getNextConfigVersion(config.getType()));
+          config.setStackId(cluster.getDesiredStackVersion());
           // Create configuration
           clusterConfigEntity = new ClusterConfigEntity();
           clusterConfigEntity.setClusterId(clusterEntity.getClusterId());


Mime
View raw message