You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2017/09/06 21:48:07 UTC
ambari git commit: AMBARI-21897: Fix NPE in InstallHostTask (jluniya)
Repository: ambari
Updated Branches:
refs/heads/trunk 0c45d48f5 -> 98b00094c
AMBARI-21897: Fix NPE in InstallHostTask (jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/98b00094
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/98b00094
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/98b00094
Branch: refs/heads/trunk
Commit: 98b00094c458c904b500919d4ab08190ff4c5155
Parents: 0c45d48
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Wed Sep 6 14:48:02 2017 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Wed Sep 6 14:48:02 2017 -0700
----------------------------------------------------------------------
.../server/topology/tasks/InstallHostTask.java | 24 +++++++++++---------
.../tasks/PersistHostResourcesTask.java | 3 +++
.../tasks/RegisterWithConfigGroupTask.java | 3 +++
.../server/topology/tasks/StartHostTask.java | 23 +++++++++++--------
4 files changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/98b00094/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/InstallHostTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/InstallHostTask.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/InstallHostTask.java
index f38022a..ceb58c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/InstallHostTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/InstallHostTask.java
@@ -50,19 +50,21 @@ public class InstallHostTask extends TopologyHostTask {
LOG.info("HostRequest: Executing INSTALL task for host: {}", hostRequest.getHostName());
boolean skipInstallTaskCreate = clusterTopology.getProvisionAction().equals(ProvisionAction.START_ONLY);
RequestStatusResponse response = clusterTopology.installHost(hostRequest.getHostName(), skipInstallTaskCreate, skipFailure);
- // map logical install tasks to physical install tasks
- List<ShortTaskStatus> underlyingTasks = response.getTasks();
- for (ShortTaskStatus task : underlyingTasks) {
+ if(response != null) {
+ // map logical install tasks to physical install tasks
+ List<ShortTaskStatus> underlyingTasks = response.getTasks();
+ for (ShortTaskStatus task : underlyingTasks) {
- String component = task.getRole();
- Long logicalInstallTaskId = hostRequest.getLogicalTasksForTopologyTask(this).get(component);
- if(logicalInstallTaskId == null) {
- LOG.info("Skipping physical install task registering, because component {} cannot be found", task.getRole());
- continue;
+ String component = task.getRole();
+ Long logicalInstallTaskId = hostRequest.getLogicalTasksForTopologyTask(this).get(component);
+ if (logicalInstallTaskId == null) {
+ LOG.info("Skipping physical install task registering, because component {} cannot be found", task.getRole());
+ continue;
+ }
+ //todo: for now only one physical task per component
+ long taskId = task.getTaskId();
+ hostRequest.registerPhysicalTaskId(logicalInstallTaskId, taskId);
}
- //todo: for now only one physical task per component
- long taskId = task.getTaskId();
- hostRequest.registerPhysicalTaskId(logicalInstallTaskId, taskId);
}
LOG.info("HostRequest: Exiting INSTALL task for host: {}", hostRequest.getHostName());
http://git-wip-us.apache.org/repos/asf/ambari/blob/98b00094/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
index e4b10c2..990aee7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
@@ -48,6 +48,7 @@ public class PersistHostResourcesTask extends TopologyHostTask {
@Override
public void runTask() {
LOG.info("HostRequest: Executing RESOURCE_CREATION task for host: {}", hostRequest.getHostName());
+
HostGroup group = hostRequest.getHostGroup();
Map<String, Collection<String>> serviceComponents = new HashMap<>();
for (String service : group.getServices()) {
@@ -55,5 +56,7 @@ public class PersistHostResourcesTask extends TopologyHostTask {
}
clusterTopology.getAmbariContext().createAmbariHostResources(hostRequest.getClusterId(),
hostRequest.getHostName(), serviceComponents);
+
+ LOG.info("HostRequest: Exiting RESOURCE_CREATION task for host: {}", hostRequest.getHostName());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/98b00094/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/RegisterWithConfigGroupTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/RegisterWithConfigGroupTask.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/RegisterWithConfigGroupTask.java
index 029f2a4..1613c19 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/RegisterWithConfigGroupTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/RegisterWithConfigGroupTask.java
@@ -43,8 +43,11 @@ public class RegisterWithConfigGroupTask extends TopologyHostTask {
@Override
public void runTask() {
LOG.info("HostRequest: Executing CONFIGURE task for host: {}", hostRequest.getHostName());
+
clusterTopology.getAmbariContext().registerHostWithConfigGroup(hostRequest.getHostName(), clusterTopology,
hostRequest.getHostgroupName());
+
+ LOG.info("HostRequest: Exiting CONFIGURE task for host: {}", hostRequest.getHostName());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/98b00094/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/StartHostTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/StartHostTask.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/StartHostTask.java
index 054ed1e..ab2ffbf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/StartHostTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/StartHostTask.java
@@ -47,19 +47,22 @@ public class StartHostTask extends TopologyHostTask {
@Override
public void runTask() {
LOG.info("HostRequest: Executing START task for host: {}", hostRequest.getHostName());
+
RequestStatusResponse response = clusterTopology.startHost(hostRequest.getHostName(), skipFailure);
- // map logical install tasks to physical install tasks
- List<ShortTaskStatus> underlyingTasks = response.getTasks();
- for (ShortTaskStatus task : underlyingTasks) {
+ if (response != null) {
+ // map logical install tasks to physical install tasks
+ List<ShortTaskStatus> underlyingTasks = response.getTasks();
+ for (ShortTaskStatus task : underlyingTasks) {
- String component = task.getRole();
- Long logicalStartTaskId = hostRequest.getLogicalTasksForTopologyTask(this).get(component);
- if(logicalStartTaskId == null) {
- LOG.info("Skipping physical start task registering, because component {} cannot be found", task.getRole());
- continue;
+ String component = task.getRole();
+ Long logicalStartTaskId = hostRequest.getLogicalTasksForTopologyTask(this).get(component);
+ if (logicalStartTaskId == null) {
+ LOG.info("Skipping physical start task registering, because component {} cannot be found", task.getRole());
+ continue;
+ }
+ // for now just set on outer map
+ hostRequest.registerPhysicalTaskId(logicalStartTaskId, task.getTaskId());
}
- // for now just set on outer map
- hostRequest.registerPhysicalTaskId(logicalStartTaskId, task.getTaskId());
}
LOG.info("HostRequest: Exiting START task for host: {}", hostRequest.getHostName());