ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [2/2] ambari git commit: AMBARI-15831. DB exception when trying to add 700 hosts to cluster. (mpapirkovskyy)
Date Tue, 12 Apr 2016 12:14:56 GMT
AMBARI-15831. DB exception when trying to add 700 hosts to cluster. (mpapirkovskyy)


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

Branch: refs/heads/trunk
Commit: 7f8da72ffbbb6c44060e1df11a10a3baeb3227a0
Parents: 0da6867
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Mon Apr 11 19:50:15 2016 +0300
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Tue Apr 12 15:09:18 2016 +0300

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/agent/HeartbeatProcessor.java | 2 --
 .../main/java/org/apache/ambari/server/state/host/HostImpl.java | 5 ++++-
 .../java/org/apache/ambari/server/topology/TopologyManager.java | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7f8da72f/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
index 37a8395..8e50da6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
@@ -335,14 +335,12 @@ public class HeartbeatProcessor extends AbstractService{
         }
 
         host.setStatus(healthStatus.name());
-        host.persist();
       }
 
       //If host doesn't belong to any cluster
       if ((clusterFsm.getClustersForHost(host.getHostName())).size() == 0) {
         healthStatus = HostHealthStatus.HealthStatus.HEALTHY;
         host.setStatus(healthStatus.name());
-        host.persist();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7f8da72f/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
index f946771..186590e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
@@ -255,7 +255,7 @@ public class HostImpl implements Host {
       hostEntity.setHostStateEntity(hostStateEntity);
       hostStateEntity.setHealthStatus(gson.toJson(new HostHealthStatus(HealthStatus.UNKNOWN,
"")));
       if (persisted) {
-        persist();
+        hostStateDAO.create(hostStateEntity);
       }
     } else {
       stateMachine.setCurrentState(hostStateEntity.getCurrentState());
@@ -1218,6 +1218,9 @@ public class HostImpl implements Host {
         }
         persisted = true;
       } else {
+        //refresh entities from active session
+        getHostEntity();
+        getHostStateEntity();
         saveIfPersisted();
       }
     } finally {

http://git-wip-us.apache.org/repos/asf/ambari/blob/7f8da72f/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 769fc41..3eb0c39 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -627,7 +627,7 @@ public class TopologyManager {
 
     if (null != rackInfoFromTemplate) {
       host.setRackInfo(rackInfoFromTemplate);
-      host.persist();
+      host.persist(); //todo this is required only if host is not persisted to database yet,
is it really so?
       try {
         // todo: do we need this in case of blueprints?
         ambariContext.getController().registerRackChange(ambariContext.getClusterName(topology.getClusterId()));


Mime
View raw message