ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject git commit: AMBARI-3793. Do not store disks_info in DB. Store it as dynamic info in memory that can be used to show on the UI. (Vitaly Brodetskyi via dlysnichenko)
Date Mon, 18 Nov 2013 16:05:49 GMT
Updated Branches:
  refs/heads/trunk 015130d44 -> d44b3124f


AMBARI-3793. Do not store disks_info in DB. Store it as dynamic info in memory that can be
used to show on the UI. (Vitaly Brodetskyi via dlysnichenko)


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

Branch: refs/heads/trunk
Commit: d44b3124f15f0a1c3229e75f29c80085e5483170
Parents: 015130d
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Nov 18 18:03:47 2013 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Nov 18 18:03:47 2013 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/Hardware.py        |  5 +++--
 .../src/main/python/ambari_agent/Heartbeat.py       |  4 ++++
 .../src/main/python/ambari_agent/HostInfo.py        |  2 --
 ambari-agent/src/test/python/TestHostInfo.py        | 13 ++-----------
 .../org/apache/ambari/server/agent/AgentEnv.java    | 14 --------------
 .../org/apache/ambari/server/agent/HeartBeat.java   | 11 +++++++++++
 .../ambari/server/agent/HeartBeatHandler.java       |  2 +-
 .../ambari/server/orm/entities/HostEntity.java      | 16 ----------------
 .../state/host/HostHealthyHeartbeatEvent.java       | 15 ++++++++++++++-
 .../apache/ambari/server/state/host/HostImpl.java   | 14 +++++++++-----
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../src/main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql   |  2 +-
 .../resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql |  2 +-
 ambari-server/src/main/resources/Ambari-DDL.sql     |  1 -
 .../upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql       |  2 ++
 .../ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql       |  1 +
 .../ambari/server/agent/TestHeartbeatHandler.java   |  1 +
 .../ambari/server/state/cluster/ClusterTest.java    |  2 +-
 .../apache/ambari/server/state/host/HostTest.java   |  2 +-
 20 files changed, 54 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-agent/src/main/python/ambari_agent/Hardware.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Hardware.py b/ambari-agent/src/main/python/ambari_agent/Hardware.py
index fca32dd..96aef10 100644
--- a/ambari-agent/src/main/python/ambari_agent/Hardware.py
+++ b/ambari-agent/src/main/python/ambari_agent/Hardware.py
@@ -63,7 +63,8 @@ class Hardware:
     else:
       return None
 
-  def osdisks(self):
+  @staticmethod
+  def osdisks():
     """ Run df to find out the disks on the host. Only works on linux 
     platforms. Note that this parser ignores any filesystems with spaces 
     and any mounts with spaces. """
@@ -72,7 +73,7 @@ class Hardware:
     dfdata = df.communicate()[0]
     lines = dfdata.splitlines()
     for l in lines:
-      mountinfo = self.extractMountInfo(l)
+      mountinfo = Hardware.extractMountInfo(l)
       if mountinfo != None and os.access(mountinfo['mountpoint'], os.W_OK):
         mounts.append(mountinfo)
       pass

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
index f0e20c4..af19679 100644
--- a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
+++ b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
@@ -27,6 +27,7 @@ from ActionQueue import ActionQueue
 import AmbariConfig
 import hostname
 from HostInfo import HostInfo
+from Hardware import Hardware
 
 
 logger = logging.getLogger()
@@ -83,6 +84,9 @@ class Heartbeat:
       hostInfo.register(nodeInfo, componentsMapped, commandsInProgress)
       heartbeat['agentEnv'] = nodeInfo
       logger.debug("agentEnv : " + str(nodeInfo))
+      mounts = Hardware.osdisks()
+      heartbeat['mounts'] = mounts
+      logger.debug("mounts : " + str(mounts))
 
     return heartbeat
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index b737272..81b2d5c 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -313,8 +313,6 @@ class HostInfo:
     self.javaProcs(java)
     dict['hostHealth']['activeJavaProcs'] = java
 
-    dict['hostHealth']['diskStatus'] = [self.osdiskAvailableSpace("/")]
-
     liveSvcs = []
     self.checkLiveServices(self.DEFAULT_LIVE_SERVICES, liveSvcs)
     dict['hostHealth']['liveServices'] = liveSvcs

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-agent/src/test/python/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/TestHostInfo.py b/ambari-agent/src/test/python/TestHostInfo.py
index 5718058..95712f0 100644
--- a/ambari-agent/src/test/python/TestHostInfo.py
+++ b/ambari-agent/src/test/python/TestHostInfo.py
@@ -232,7 +232,6 @@ class TestHostInfo(TestCase):
 
   @patch.object(HostInfo, 'get_os_type')
   @patch('os.umask')
-  @patch.object(HostInfo, 'osdiskAvailableSpace')
   @patch.object(HostCheckReportFileHandler, 'writeHostCheckFile')
   @patch.object(PackagesAnalyzer, 'allAvailablePackages')
   @patch.object(PackagesAnalyzer, 'allInstalledPackages')
@@ -249,14 +248,12 @@ class TestHostInfo(TestCase):
   @patch.object(HostInfo, 'hadoopVarLogCount')
   def test_hostinfo_register_suse(self, hvlc_mock, hvrc_mock, eac_mock, cf_mock, jp_mock,
                              cls_mock, cu_mock, gir_mock, gipbr_mock, gipbn_mock,
-                             gpd_mock, aip_mock, aap_mock, whcf_mock, odas_mock,
-                             os_umask_mock, get_os_type_mock):
+                             gpd_mock, aip_mock, aap_mock, whcf_mock, os_umask_mock, get_os_type_mock):
     hvlc_mock.return_value = 1
     hvrc_mock.return_value = 1
     gipbr_mock.return_value = ["pkg1"]
     gipbn_mock.return_value = ["pkg2"]
     gpd_mock.return_value = ["pkg1", "pkg2"]
-    odas_mock.return_value = [{'name':'name1'}]
     get_os_type_mock.return_value = "suse"
 
     hostInfo = HostInfo()
@@ -266,7 +263,6 @@ class TestHostInfo(TestCase):
     self.assertFalse(gpd_mock.called)
     self.assertFalse(aip_mock.called)
     self.assertFalse(aap_mock.called)
-    self.assertTrue(odas_mock.called)
     self.assertTrue(os_umask_mock.called)
     self.assertFalse(whcf_mock.called)
 
@@ -276,7 +272,6 @@ class TestHostInfo(TestCase):
 
   @patch.object(HostInfo, 'get_os_type')
   @patch('os.umask')
-  @patch.object(HostInfo, 'osdiskAvailableSpace')
   @patch.object(HostCheckReportFileHandler, 'writeHostCheckFile')
   @patch.object(PackagesAnalyzer, 'allAvailablePackages')
   @patch.object(PackagesAnalyzer, 'allInstalledPackages')
@@ -294,15 +289,13 @@ class TestHostInfo(TestCase):
   @patch.object(HostInfo, 'checkIptables')
   def test_hostinfo_register(self, cit_mock, hvlc_mock, hvrc_mock, eac_mock, cf_mock, jp_mock,
                              cls_mock, cu_mock, gir_mock, gipbr_mock, gipbn_mock,
-                             gpd_mock, aip_mock, aap_mock, whcf_mock, odas_mock,
-                             os_umask_mock, get_os_type_mock):
+                             gpd_mock, aip_mock, aap_mock, whcf_mock, os_umask_mock, get_os_type_mock):
     cit_mock.return_value = True
     hvlc_mock.return_value = 1
     hvrc_mock.return_value = 1
     gipbr_mock.return_value = ["pkg1"]
     gipbn_mock.return_value = ["pkg2"]
     gpd_mock.return_value = ["pkg1", "pkg2"]
-    odas_mock.return_value = [{'name':'name1'}]
     get_os_type_mock.return_value = "redhat"
 
     hostInfo = HostInfo()
@@ -323,7 +316,6 @@ class TestHostInfo(TestCase):
     self.assertTrue(gir_mock.called)
     self.assertTrue(gpd_mock.called)
     self.assertTrue(aip_mock.called)
-    self.assertTrue(odas_mock.called)
     self.assertTrue(cit_mock.called)
 
     for existingPkg in ["pkg1", "pkg2"]:
@@ -339,7 +331,6 @@ class TestHostInfo(TestCase):
     self.assertEqual(dict['existingUsers'], [])
     self.assertEqual(dict['existingRepos'][0], hostInfo.RESULT_UNAVAILABLE)
     self.assertEqual(dict['installedPackages'], [])
-    self.assertEqual(1, len(dict['hostHealth']['diskStatus']))
     self.assertTrue(dict['iptablesIsRunning'])
 
   @patch("os.path.exists")

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
index d6368a5..912de7e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
@@ -149,12 +149,6 @@ public class AgentEnv {
     @SerializedName("liveServices")
     private LiveService[] liveServices = new LiveService[0];
 
-    /**
-     * The available space in the root disk
-     */
-    @SerializedName("diskStatus")
-    private DiskInfo[] diskStatus = new DiskInfo[0];
-
     public void setAgentTimeStampAtReporting(long currentTime) {
       agentTimeStampAtReporting = currentTime;
     }
@@ -186,14 +180,6 @@ public class AgentEnv {
     public LiveService[] getLiveServices() {
       return liveServices;
     }
-
-    public void setDiskStatus(DiskInfo[] diskInfo) {
-      diskStatus = diskInfo;
-    }
-
-    public DiskInfo[] getDiskStatus() {
-      return diskStatus;
-    }
   }
 
   public static class PackageDetail {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
index 62ea7f3..80cad4e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeat.java
@@ -36,6 +36,7 @@ public class HeartBeat {
   private String hostname;
   List<CommandReport> reports = new ArrayList<CommandReport>();
   List<ComponentStatus> componentStatus = new ArrayList<ComponentStatus>();
+  private List<DiskInfo> mounts = new ArrayList<DiskInfo>();
   HostStatus nodeStatus;
   private AgentEnv agentEnv = null;
 
@@ -99,6 +100,16 @@ public class HeartBeat {
     this.componentStatus = componentStatus;
   }
 
+  @JsonProperty("mounts")
+  public List<DiskInfo> getMounts() {
+    return this.mounts;
+  }
+
+  @JsonProperty("mounts")
+  public void setMounts(List<DiskInfo> mounts) {
+    this.mounts = mounts;
+  }
+
   @Override
   public String toString() {
     return "HeartBeat{" +

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 9da4d45..0866446 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -162,7 +162,7 @@ public class HeartBeatHandler {
     try {
       if (heartbeat.getNodeStatus().getStatus().equals(HostStatus.Status.HEALTHY)) {
         hostObject.handleEvent(new HostHealthyHeartbeatEvent(hostname, now,
-            heartbeat.getAgentEnv()));
+            heartbeat.getAgentEnv(), heartbeat.getMounts()));
       } else {
         hostObject.handleEvent(new HostUnhealthyHeartbeatEvent(hostname, now,
             null));

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
index 8a9db0d..0739ddf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
@@ -63,12 +63,6 @@ public class HostEntity {
   @Basic
   private String osArch = "";
 
-  @Lob
-  @Column(name = "disks_info", nullable = false, insertable = true,
-      updatable = true, length = 32000)
-  @Basic
-  private String disksInfo = "";
-
   @Column(name = "os_info", insertable = true, updatable = true,
       length = 1000)
   @Basic
@@ -188,14 +182,6 @@ public class HostEntity {
     this.osArch = osArch;
   }
 
-  public String getDisksInfo() {
-    return defaultString(disksInfo);
-  }
-
-  public void setDisksInfo(String disksInfo) {
-    this.disksInfo = disksInfo;
-  }
-
   public String getOsInfo() {
     return defaultString(osInfo);
   }
@@ -257,7 +243,6 @@ public class HostEntity {
     if (cpuInfo != null ? !cpuInfo.equals(that.cpuInfo) : that.cpuInfo != null) return false;
     if (discoveryStatus != null ? !discoveryStatus.equals(that.discoveryStatus) : that.discoveryStatus
!= null)
       return false;
-    if (disksInfo != null ? !disksInfo.equals(that.disksInfo) : that.disksInfo != null) return
false;
     if (hostAttributes != null ? !hostAttributes.equals(that.hostAttributes) : that.hostAttributes
!= null)
       return false;
     if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return
false;
@@ -278,7 +263,6 @@ public class HostEntity {
     result = 31 * result + cpuCount;
     result = 31 * result + (cpuInfo != null ? cpuInfo.hashCode() : 0);
     result = 31 * result + (osArch != null ? osArch.hashCode() : 0);
-    result = 31 * result + (disksInfo != null ? disksInfo.hashCode() : 0);
     result = 31 * result + (osInfo != null ? osInfo.hashCode() : 0);
     result = 31 * result + (osType != null ? osType.hashCode() : 0);
     result = 31 * result + (discoveryStatus != null ? discoveryStatus.hashCode() : 0);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostHealthyHeartbeatEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostHealthyHeartbeatEvent.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostHealthyHeartbeatEvent.java
index 9afb433..d4e93b8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostHealthyHeartbeatEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostHealthyHeartbeatEvent.java
@@ -20,18 +20,24 @@
 package org.apache.ambari.server.state.host;
 
 import org.apache.ambari.server.agent.AgentEnv;
+import org.apache.ambari.server.agent.DiskInfo;
 import org.apache.ambari.server.state.HostEvent;
 import org.apache.ambari.server.state.HostEventType;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class HostHealthyHeartbeatEvent extends HostEvent {
 
   private final long heartbeatTime;
   private AgentEnv agentEnv = null;
+  private List<DiskInfo> mounts = new ArrayList<DiskInfo>();;
 
-  public HostHealthyHeartbeatEvent(String hostName, long heartbeatTime, AgentEnv env) {
+  public HostHealthyHeartbeatEvent(String hostName, long heartbeatTime, AgentEnv env, List<DiskInfo>
mounts) {
     super(hostName, HostEventType.HOST_HEARTBEAT_HEALTHY);
     this.heartbeatTime = heartbeatTime;
     agentEnv = env;
+    this.mounts = mounts;
   }
 
   /**
@@ -49,4 +55,11 @@ public class HostHealthyHeartbeatEvent extends HostEvent {
     return agentEnv;
   }
 
+  /**
+   * @return the disks info, if present.  Can return <code>null</code> if
+   * there was no new info.
+   */
+  public List<DiskInfo> getMounts() {
+    return mounts;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/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 6a2cdb5..567623e 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
@@ -18,6 +18,7 @@
 package org.apache.ambari.server.state.host;
 
 import java.lang.reflect.Type;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -93,6 +94,7 @@ public class HostImpl implements Host {
 
   private long lastHeartbeatTime = 0L;
   private AgentEnv lastAgentEnv = null;
+  private List<DiskInfo> disksInfo = new ArrayList<DiskInfo>();
   private boolean persisted = false;
   private Integer currentPingPort = null;
 
@@ -298,8 +300,12 @@ public class HostImpl implements Host {
         case HOST_HEARTBEAT_HEALTHY:
           HostHealthyHeartbeatEvent hhevent = (HostHealthyHeartbeatEvent) event;
           heartbeatTime = hhevent.getHeartbeatTime();
-          if (null != hhevent.getAgentEnv())
+          if (null != hhevent.getAgentEnv()) {
             host.setLastAgentEnv(hhevent.getAgentEnv());
+          }
+          if (null != hhevent.getMounts() && !hhevent.getMounts().isEmpty()) {
+            host.setDisksInfo(hhevent.getMounts());
+          }
           break;
         case HOST_HEARTBEAT_UNHEALTHY:
           heartbeatTime =
@@ -815,8 +821,7 @@ public class HostImpl implements Host {
   public List<DiskInfo> getDisksInfo() {
     try {
       readLock.lock();
-      return gson.<List<DiskInfo>>fromJson(
-                hostEntity.getDisksInfo(), diskInfoType);
+      return this.disksInfo;
     } finally {
       readLock.unlock();
     }
@@ -826,8 +831,7 @@ public class HostImpl implements Host {
   public void setDisksInfo(List<DiskInfo> disksInfo) {
     try {
       writeLock.lock();
-      hostEntity.setDisksInfo(gson.toJson(disksInfo, diskInfoType));
-      saveIfPersisted();
+      this.disksInfo = disksInfo;
     } finally {
       writeLock.unlock();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/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 8a2d2d7..06de1ff 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -32,7 +32,7 @@ CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id
BIG
 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, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255)
NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL,
host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
-CREATE TABLE hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info
VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, disks_info LONGTEXT NOT NULL,
host_attributes LONGTEXT, ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT
NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255)
NOT NULL, ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR(255), rack_info VARCHAR(255)
NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info
VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes LONGTEXT,
ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255)
NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, ph_cpu_count INTEGER
NOT NULL, public_host_name VARCHAR(255), rack_info VARCHAR(255) NOT NULL, total_mem BIGINT
NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL,
current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT
NULL, time_in_state BIGINT NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id
BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT
NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER
NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, service_name));

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/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 fd2d285..e53bbbd 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -22,7 +22,7 @@ CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id
NU
 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, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
 CREATE TABLE hostcomponentstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255)
NOT NULL, current_stack_version VARCHAR2(255) NOT NULL, current_state VARCHAR2(255) NOT NULL,
host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
-CREATE TABLE hosts (host_name VARCHAR2(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info
VARCHAR2(255) NULL, discovery_status VARCHAR2(2000) NULL, disks_info CLOB NOT NULL, host_attributes
CLOB NULL, ipv4 VARCHAR2(255) NULL, ipv6 VARCHAR2(255) NULL, last_registration_time INTEGER
NOT NULL, os_arch VARCHAR2(255) NULL, os_info VARCHAR2(1000) NULL, os_type VARCHAR2(255) NULL,
ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR2(255) NULL, rack_info VARCHAR2(255)
NOT NULL, total_mem INTEGER NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE hosts (host_name VARCHAR2(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info
VARCHAR2(255) NULL, discovery_status VARCHAR2(2000) NULL, host_attributes CLOB NULL, ipv4
VARCHAR2(255) NULL, ipv6 VARCHAR2(255) NULL, last_registration_time INTEGER NOT NULL, os_arch
VARCHAR2(255) NULL, os_info VARCHAR2(1000) NULL, os_type VARCHAR2(255) NULL, ph_cpu_count
INTEGER NOT NULL, public_host_name VARCHAR2(255) NULL, rack_info VARCHAR2(255) NOT NULL, total_mem
INTEGER NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE hoststate (agent_version VARCHAR2(255) NULL, available_mem NUMBER(19) NOT NULL,
current_state VARCHAR2(255) NOT NULL, health_status VARCHAR2(255) NULL, host_name VARCHAR2(255)
NOT NULL, time_in_state NUMBER(19) NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR2(255) NOT NULL, cluster_id
NUMBER(19) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255)
NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicedesiredstate (cluster_id NUMBER(19) NOT NULL, desired_host_role_mapping
NUMBER(10) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255)
NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, service_name));

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/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 2992376..d8ea6f3 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -49,7 +49,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentdesiredstate TO :username;
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255)
NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL,
host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentstate TO :username;
 
-CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count
INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, disks_info
VARCHAR(32000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6
VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch
VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info
VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count
INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes
VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255),
last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000)
NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT
NOT NULL, PRIMARY KEY (host_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.hosts TO :username;
 
 CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT
NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255)
NOT NULL, time_in_state BIGINT NOT NULL, PRIMARY KEY (host_name));

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
index f166df1..145b229 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
@@ -26,7 +26,7 @@ CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL,
cluster
 CREATE TABLE ambari.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 ambari.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, PRIMARY KEY
(cluster_id, component_name, host_name, service_name));
 CREATE TABLE ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255)
NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL,
host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id,
component_name, host_name, service_name));
-CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count
INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, disks_info
VARCHAR(10000) NOT NULL, host_attributes VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6
VARCHAR(255), public_host_name VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch
VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info
VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count
INTEGER, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, host_attributes
VARCHAR(20000) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255),
last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000)
NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT
NOT NULL, PRIMARY KEY (host_name));
 CREATE TABLE ambari.hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT
NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255)
NOT NULL, time_in_state BIGINT NOT NULL,  PRIMARY KEY (host_name));
 CREATE TABLE ambari.servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id
BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT
NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE ambari.servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping
INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255)
NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, service_name));

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/resources/Ambari-DDL.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL.sql b/ambari-server/src/main/resources/Ambari-DDL.sql
index f144fe3..ab2ef78 100644
--- a/ambari-server/src/main/resources/Ambari-DDL.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL.sql
@@ -77,7 +77,6 @@ cpu_count INTEGER DEFAULT '0' NOT NULL,
 ph_cpu_count INTEGER DEFAULT '0' NOT NULL,
 cpu_info VARCHAR DEFAULT '' NOT NULL,
 os_arch VARCHAR DEFAULT '' NOT NULL,
-disks_info VARCHAR DEFAULT '' NOT NULL,
 os_info VARCHAR DEFAULT '' NOT NULL,
 os_type VARCHAR DEFAULT '' NOT NULL,
 discovery_status VARCHAR DEFAULT '' NOT NULL,

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql b/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql
index b4f6d01..69faa53 100644
--- a/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql
+++ b/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Oracle-UPGRADE.sql
@@ -74,4 +74,6 @@ SET
   
 ALTER TABLE stage MODIFY (cluster_host_info NOT NULL);
 
+ALTER TABLE ambari.hosts DROP COLUMN disks_info;
+
 commit;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
b/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
index 96d5956..38894e3 100644
--- a/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
+++ b/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
@@ -153,3 +153,4 @@ UPDATE ambari.stage sd
 --Set cluster_host_info column mandatory
 ALTER TABLE ambari.stage ALTER COLUMN cluster_host_info SET NOT NULL;
 
+ALTER TABLE ambari.hosts DROP COLUMN disks_info;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index 5763065..e8a3a1f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -1041,6 +1041,7 @@ public class TestHeartbeatHandler {
     hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
     hb.setReports(new ArrayList<CommandReport>());
     hb.setAgentEnv(new AgentEnv());
+    hb.setMounts(new ArrayList<DiskInfo>());
 
     ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
     ComponentStatus componentStatus1 = createComponentStatus(DummyCluster, HDFS, DummyHostStatus,
State.STARTED,

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index d083592..7e3a7db 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -172,7 +172,7 @@ public class ClusterTest {
 
     try {
       clusters.getHost("h1").handleEvent(
-          new HostHealthyHeartbeatEvent("h1", currentTime, null));
+          new HostHealthyHeartbeatEvent("h1", currentTime, null, null));
       fail("Exception should be thrown on invalid event");
     }
     catch (InvalidStateTransitionException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d44b3124/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
index b16a893..272a448 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
@@ -187,7 +187,7 @@ public class HostTest {
   private void sendHealthyHeartbeat(Host host, long counter)
       throws Exception {
     HostHealthyHeartbeatEvent e = new HostHealthyHeartbeatEvent(
-        host.getHostName(), counter, null);
+        host.getHostName(), counter, null, null);
     host.handleEvent(e);
   }
 


Mime
View raw message