ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-14405. RU: Finalize Downgrade failed (ncole)
Date Wed, 16 Dec 2015 21:45:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c7c991e85 -> b3edc7099


AMBARI-14405. RU: Finalize Downgrade failed (ncole)


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

Branch: refs/heads/trunk
Commit: b3edc70991c9d974d470ee9bce8d16d0e6964657
Parents: c7c991e
Author: Nate Cole <ncole@hortonworks.com>
Authored: Wed Dec 16 15:53:26 2015 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Wed Dec 16 16:05:12 2015 -0500

----------------------------------------------------------------------
 .../ambari/server/orm/entities/ClusterConfigEntity.java     | 4 ++--
 .../org/apache/ambari/server/state/cluster/ClusterImpl.java | 9 +++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b3edc709/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
index ceefa60..bf0faee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
@@ -228,8 +228,8 @@ public class ClusterConfigEntity {
 
   @Override
   public int hashCode() {
-    int result = configId != null ? configId.intValue() : 0;
-    result = 31 * result + (clusterId != null ? clusterId.intValue() : 0);
+    int result = configId != null ? configId.hashCode() : 0;
+    result = 31 * result + (clusterId != null ? clusterId.hashCode() : 0);
     result = 31 * result + (type != null ? type.hashCode() : 0);
     result = 31 * result + (tag != null ? tag.hashCode() : 0);
     result = 31 * result + (stack != null ? stack.hashCode() : 0);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b3edc709/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 b2a8485..46dbe01 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
@@ -22,7 +22,6 @@ import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -39,7 +38,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 import javax.annotation.Nullable;
 import javax.persistence.RollbackException;
 
-import com.google.common.collect.Maps;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ConfigGroupNotFoundException;
 import org.apache.ambari.server.DuplicateResourceException;
@@ -134,6 +132,7 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
 import com.google.inject.Inject;
@@ -3018,6 +3017,7 @@ public class ClusterImpl implements Cluster {
   public void applyLatestConfigurations(StackId stackId) {
     clusterGlobalLock.writeLock().lock();
     try {
+
       Collection<ClusterConfigMappingEntity> configMappingEntities = clusterDAO.getClusterConfigMappingEntitiesByCluster(getClusterId());
 
       // disable previous config
@@ -3044,6 +3044,7 @@ public class ClusterImpl implements Cluster {
 
       clusterDAO.mergeConfigMappings(clusterConfigMappingEntities);
 
+      refresh();
       cacheConfigurations();
     } finally {
       clusterGlobalLock.writeLock().unlock();
@@ -3128,6 +3129,7 @@ public class ClusterImpl implements Cluster {
     // remove config mappings
     Collection<ClusterConfigMappingEntity> configMappingEntities =
         clusterDAO.getClusterConfigMappingEntitiesByCluster(getClusterId());
+
     for (ClusterConfigEntity removedClusterConfig : removedClusterConfigs) {
       String removedClusterConfigType = removedClusterConfig.getType();
       String removedClusterConfigTag = removedClusterConfig.getTag();
@@ -3156,6 +3158,9 @@ public class ClusterImpl implements Cluster {
   public void removeConfigurations(StackId stackId) {
     clusterGlobalLock.writeLock().lock();
     try {
+      // make sure the entity isn't stale in the current unit of work.
+      refresh();
+
       removeAllConfigsForStack(stackId);
 
       cacheConfigurations();


Mime
View raw message