You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2017/05/08 13:35:46 UTC
[2/2] ambari git commit: AMBARI-20919. Change Storage of Data on
Request/Stage/Task To Reduce Redundency (dgrinenko via dlysnichenko)
AMBARI-20919. Change Storage of Data on Request/Stage/Task To Reduce Redundency (dgrinenko via dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed42f68f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed42f68f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed42f68f
Branch: refs/heads/branch-2.5
Commit: ed42f68f04a1cde072cc51049bada2e979850239
Parents: c787190
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon May 8 16:32:50 2017 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon May 8 16:33:36 2017 +0300
----------------------------------------------------------------------
.../server/actionmanager/ActionManager.java | 4 +-
.../server/actionmanager/ActionScheduler.java | 25 ++---
.../ambari/server/actionmanager/Request.java | 18 +++-
.../server/actionmanager/RequestFactory.java | 4 +-
.../ambari/server/actionmanager/Stage.java | 14 ---
.../server/actionmanager/StageFactory.java | 1 -
.../server/actionmanager/StageFactoryImpl.java | 4 +-
.../AmbariCustomCommandExecutionHelper.java | 12 ++-
.../AmbariManagementControllerImpl.java | 15 ++-
.../server/controller/KerberosHelperImpl.java | 51 +++++++----
.../ClusterStackVersionResourceProvider.java | 3 +-
.../HostStackVersionResourceProvider.java | 4 +-
.../internal/RequestResourceProvider.java | 9 +-
.../internal/RequestStageContainer.java | 11 ++-
.../internal/StageResourceProvider.java | 13 +--
.../internal/UpgradeResourceProvider.java | 13 +--
.../server/hooks/users/UserHookService.java | 3 +-
.../server/orm/entities/RequestEntity.java | 19 ++++
.../ambari/server/orm/entities/StageEntity.java | 18 ----
.../server/orm/entities/StageEntity_.java | 4 -
.../ambari/server/stageplanner/RoleGraph.java | 2 +-
.../server/upgrade/UpgradeCatalog251.java | 36 ++++++++
.../apache/ambari/server/utils/StageUtils.java | 8 +-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 2 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 2 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 2 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 2 +-
.../src/main/resources/properties.json | 1 +
.../ExecutionCommandWrapperTest.java | 4 +-
.../ambari/server/actionmanager/StageTest.java | 2 +-
.../actionmanager/TestActionDBAccessorImpl.java | 34 ++++---
.../server/actionmanager/TestActionManager.java | 8 +-
.../actionmanager/TestActionScheduler.java | 43 ++++++---
.../ambari/server/actionmanager/TestStage.java | 5 +-
.../server/agent/HeartbeatProcessorTest.java | 4 +-
.../server/agent/HeartbeatTestHelper.java | 4 +-
.../server/agent/TestHeartbeatHandler.java | 4 +-
.../AmbariManagementControllerTest.java | 18 ++--
.../server/controller/KerberosHelperTest.java | 96 +++++++++++++++++++-
.../internal/CalculatedStatusTest.java | 2 +-
...ClusterStackVersionResourceProviderTest.java | 10 +-
.../internal/RequestStageContainerTest.java | 3 +-
.../server/hooks/users/UserHookServiceTest.java | 4 +-
.../serveraction/ServerActionExecutorTest.java | 9 +-
.../server/stageplanner/TestStagePlanner.java | 2 +-
.../ambari/server/utils/StageUtilsTest.java | 2 +-
46 files changed, 362 insertions(+), 192 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
index 237214d..621b6b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
@@ -77,8 +77,8 @@ public class ActionManager {
scheduler.stop();
}
- public void sendActions(List<Stage> stages, ExecuteActionRequest actionRequest) throws AmbariException {
- Request request = requestFactory.createNewFromStages(stages, actionRequest);
+ public void sendActions(List<Stage> stages, String clusterHostInfo, ExecuteActionRequest actionRequest) throws AmbariException {
+ Request request = requestFactory.createNewFromStages(stages, clusterHostInfo, actionRequest);
sendActions(request, actionRequest);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 6eaf485..28e66a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -455,9 +455,10 @@ class ActionScheduler implements Runnable {
//Schedule what we have so far
+
for (ExecutionCommand cmd : commandsToSchedule) {
ConfigHelper.processHiddenAttribute(cmd.getConfigurations(), cmd.getConfigurationAttributes(), cmd.getRole(), false);
- processHostRole(stage, cmd, commandsToStart, commandsToUpdate);
+ processHostRole(request, stage, cmd, commandsToStart, commandsToUpdate);
}
LOG.debug("==> Commands to start: {}", commandsToStart.size());
@@ -1053,7 +1054,7 @@ class ActionScheduler implements Runnable {
return serviceEventMap;
}
- private void processHostRole(Stage s, ExecutionCommand cmd, List<ExecutionCommand> commandsToStart,
+ private void processHostRole(RequestEntity r, Stage s, ExecutionCommand cmd, List<ExecutionCommand> commandsToStart,
List<ExecutionCommand> commandsToUpdate)
throws AmbariException {
long now = System.currentTimeMillis();
@@ -1069,23 +1070,23 @@ class ActionScheduler implements Runnable {
}
s.setLastAttemptTime(hostname, roleStr, now);
s.incrementAttemptCount(hostname, roleStr);
- /** change the hostname in the command for the host itself **/
- cmd.setHostname(hostsMap.getHostMap(hostname));
- //Try to get clusterHostInfo from cache
+ String requestPK = r.getRequestId().toString();
String stagePk = s.getStageId() + "-" + s.getRequestId();
- Map<String, Set<String>> clusterHostInfo = clusterHostInfoCache.getIfPresent(stagePk);
+
+ // Try to get clusterHostInfo from cache
+ Map<String, Set<String>> clusterHostInfo = clusterHostInfoCache.getIfPresent(requestPK);
if (clusterHostInfo == null) {
Type type = new TypeToken<Map<String, Set<String>>>() {}.getType();
- clusterHostInfo = StageUtils.getGson().fromJson(s.getClusterHostInfo(), type);
- clusterHostInfoCache.put(stagePk, clusterHostInfo);
+ clusterHostInfo = StageUtils.getGson().fromJson(r.getClusterHostInfo(), type);
+ clusterHostInfoCache.put(requestPK, clusterHostInfo);
}
cmd.setClusterHostInfo(clusterHostInfo);
- //Try to get commandParams from cache and merge them with command-level parameters
+ // Try to get commandParams from cache and merge them with command-level parameters
Map<String, String> commandParams = commandParamsStageCache.getIfPresent(stagePk);
if (commandParams == null){
@@ -1106,10 +1107,10 @@ class ActionScheduler implements Runnable {
}
}
} catch (ClusterNotFoundException cnfe) {
- //NOP
+ // NOP
}
- //Try to get hostParams from cache and merge them with command-level parameters
+ // Try to get hostParams from cache and merge them with command-level parameters
Map<String, String> hostParams = hostParamsStageCache.getIfPresent(stagePk);
if (hostParams == null) {
Type type = new TypeToken<Map<String, String>>() {}.getType();
@@ -1120,6 +1121,8 @@ class ActionScheduler implements Runnable {
hostParamsCmd.putAll(hostParams);
cmd.setHostLevelParams(hostParamsCmd);
+ // change the hostname in the command for the host itself
+ cmd.setHostname(hostsMap.getHostMap(hostname));
commandsToUpdate.add(cmd);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java
index 31e11c1..2424d0d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java
@@ -58,6 +58,7 @@ public class Request {
private long createTime;
private long startTime;
private long endTime;
+ private String clusterHostInfo;
/**
* If true, this request can not be executed in parallel with any another
@@ -93,6 +94,7 @@ public class Request {
this.startTime = -1;
this.endTime = -1;
this.exclusive = false;
+ this.clusterHostInfo = "{}";
if (-1L != this.clusterId) {
try {
@@ -109,7 +111,7 @@ public class Request {
* Construct new entity from stages provided
*/
//TODO remove when not needed
- public Request(@Assisted Collection<Stage> stages, Clusters clusters){
+ public Request(@Assisted Collection<Stage> stages, @Assisted String clusterHostInfo, Clusters clusters){
if (stages != null && !stages.isEmpty()) {
this.stages.addAll(stages);
Stage stage = stages.iterator().next();
@@ -128,6 +130,7 @@ public class Request {
this.createTime = System.currentTimeMillis();
this.startTime = -1;
this.endTime = -1;
+ this.clusterHostInfo = clusterHostInfo;
this.requestType = RequestType.INTERNAL_REQUEST;
this.exclusive = false;
} else {
@@ -142,9 +145,9 @@ public class Request {
* Construct new entity from stages provided
*/
//TODO remove when not needed
- public Request(@Assisted Collection<Stage> stages, @Assisted ExecuteActionRequest actionRequest,
+ public Request(@Assisted Collection<Stage> stages, @Assisted String clusterHostInfo, @Assisted ExecuteActionRequest actionRequest,
Clusters clusters, Gson gson) throws AmbariException {
- this(stages, clusters);
+ this(stages, clusterHostInfo, clusters);
if (actionRequest != null) {
this.resourceFilters = actionRequest.getResourceFilters();
this.operationLevel = actionRequest.getOperationLevel();
@@ -182,6 +185,7 @@ public class Request {
this.exclusive = entity.isExclusive();
this.requestContext = entity.getRequestContext();
this.inputs = entity.getInputs();
+ this.clusterHostInfo = entity.getClusterHostInfo();
this.requestType = entity.getRequestType();
this.commandName = entity.getCommandName();
@@ -241,6 +245,7 @@ public class Request {
requestEntity.setInputs(inputs);
requestEntity.setRequestType(requestType);
requestEntity.setRequestScheduleId(requestScheduleId);
+ requestEntity.setClusterHostInfo(clusterHostInfo);
//TODO set all fields
if (resourceFilters != null) {
@@ -277,6 +282,13 @@ public class Request {
return requestEntity;
}
+ public String getClusterHostInfo() {
+ return clusterHostInfo;
+ }
+
+ public void setClusterHostInfo(String clusterHostInfo) {
+ this.clusterHostInfo = clusterHostInfo;
+ }
public Long getClusterId() {
return Long.valueOf(clusterId);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/RequestFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/RequestFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/RequestFactory.java
index 3313582..c72fed6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/RequestFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/RequestFactory.java
@@ -29,9 +29,9 @@ public interface RequestFactory {
Request createNew(long requestId, @Assisted("clusterId") Long clusterName) throws AmbariException;
- Request createNewFromStages(Collection<Stage> stages);
+ Request createNewFromStages(Collection<Stage> stages, String clusterHostInfo);
- Request createNewFromStages(Collection<Stage> stages, ExecuteActionRequest actionRequest);
+ Request createNewFromStages(Collection<Stage> stages, String clusterHostInfo, ExecuteActionRequest actionRequest);
Request createExisting(RequestEntity entity);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
index 319d72d..a01313e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
@@ -76,7 +76,6 @@ public class Stage {
private long stageId = -1;
private final String logDir;
private final String requestContext;
- private String clusterHostInfo;
private String commandParamsStage;
private String hostParamsStage;
@@ -110,7 +109,6 @@ public class Stage {
@Assisted("clusterName") @Nullable String clusterName,
@Assisted("clusterId") long clusterId,
@Assisted("requestContext") @Nullable String requestContext,
- @Assisted("clusterHostInfo") String clusterHostInfo,
@Assisted("commandParamsStage") String commandParamsStage,
@Assisted("hostParamsStage") String hostParamsStage,
HostRoleCommandFactory hostRoleCommandFactory, ExecutionCommandWrapperFactory ecwFactory) {
@@ -120,7 +118,6 @@ public class Stage {
this.clusterName = clusterName;
this.clusterId = clusterId;
this.requestContext = requestContext == null ? "" : requestContext;
- this.clusterHostInfo = clusterHostInfo;
this.commandParamsStage = commandParamsStage;
this.hostParamsStage = hostParamsStage;
@@ -155,7 +152,6 @@ public class Stage {
}
requestContext = stageEntity.getRequestContext();
- clusterHostInfo = stageEntity.getClusterHostInfo();
commandParamsStage = stageEntity.getCommandParamsStage();
hostParamsStage = stageEntity.getHostParamsStage();
commandExecutionType = stageEntity.getCommandExecutionType();
@@ -195,7 +191,6 @@ public class Stage {
stageEntity.setRequestContext(requestContext);
stageEntity.setHostRoleCommands(new ArrayList<HostRoleCommandEntity>());
stageEntity.setRoleSuccessCriterias(new ArrayList<RoleSuccessCriteriaEntity>());
- stageEntity.setClusterHostInfo(clusterHostInfo);
stageEntity.setCommandParamsStage(commandParamsStage);
stageEntity.setHostParamsStage(hostParamsStage);
stageEntity.setCommandExecutionType(commandExecutionType);
@@ -260,14 +255,6 @@ public class Stage {
return commandsToScheduleSet;
}
- public String getClusterHostInfo() {
- return clusterHostInfo;
- }
-
- public void setClusterHostInfo(String clusterHostInfo) {
- this.clusterHostInfo = clusterHostInfo;
- }
-
public String getCommandParamsStage() {
return commandParamsStage;
}
@@ -914,7 +901,6 @@ public class Stage {
builder.append("clusterName="+clusterName+"\n");
builder.append("logDir=" + logDir+"\n");
builder.append("requestContext="+requestContext+"\n");
- builder.append("clusterHostInfo="+clusterHostInfo+"\n");
builder.append("commandParamsStage="+commandParamsStage+"\n");
builder.append("hostParamsStage="+hostParamsStage+"\n");
builder.append("Success Factors:\n");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactory.java
index a88558c..0d1a326 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactory.java
@@ -29,7 +29,6 @@ public interface StageFactory {
@Assisted("clusterName") String clusterName,
@Assisted("clusterId") long clusterId,
@Assisted("requestContext") String requestContext,
- @Assisted("clusterHostInfo") String clusterHostInfo,
@Assisted("commandParamsStage") String commandParamsStage,
@Assisted("hostParamsStage") String hostParamsStage);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactoryImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactoryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactoryImpl.java
index 3cad82d..0827639 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactoryImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/StageFactoryImpl.java
@@ -43,7 +43,6 @@ public class StageFactoryImpl implements StageFactory {
* @param clusterName Cluster name
* @param clusterId Cluster ID
* @param requestContext Information about the context of the request
- * @param clusterHostInfo Information about the host
* @param commandParamsStage Information about the command parameters
* @param hostParamsStage Information about the host parameters for the stage
* @return An instance of a Stage with the provided params.
@@ -54,10 +53,9 @@ public class StageFactoryImpl implements StageFactory {
@Assisted("clusterName") String clusterName,
@Assisted("clusterId") long clusterId,
@Assisted("requestContext") String requestContext,
- @Assisted("clusterHostInfo") String clusterHostInfo,
@Assisted("commandParamsStage") String commandParamsStage,
@Assisted("hostParamsStage") String hostParamsStage) {
- return new Stage(requestId, logDir, clusterName, clusterId, requestContext, clusterHostInfo, commandParamsStage, hostParamsStage,
+ return new Stage(requestId, logDir, clusterName, clusterId, requestContext, commandParamsStage, hostParamsStage,
injector.getInstance(HostRoleCommandFactory.class),
injector.getInstance(ExecutionCommandWrapperFactory.class));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 8d091e8..6e75ab6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -75,10 +75,12 @@ import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.metadata.ActionMetadata;
import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
+import org.apache.ambari.server.orm.dao.RequestDAO;
import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
import org.apache.ambari.server.orm.entities.OperatingSystemEntity;
import org.apache.ambari.server.orm.entities.RepositoryEntity;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.orm.entities.RequestEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.CommandScriptDefinition;
@@ -174,6 +176,9 @@ public class AmbariCustomCommandExecutionHelper {
private ClusterVersionDAO clusterVersionDAO;
@Inject
+ private RequestDAO requestDAO;
+
+ @Inject
private HostRoleCommandDAO hostRoleCommandDAO;
private Map<String, Map<String, Map<String, String>>> configCredentialsForService = new HashMap<>();
@@ -1003,7 +1008,12 @@ public class AmbariCustomCommandExecutionHelper {
StageUtils.getClusterHostInfo(cluster));
// Reset cluster host info as it has changed
- stage.setClusterHostInfo(clusterHostInfoJson);
+ RequestEntity requestEntity = requestDAO.findByPK(stage.getRequestId());
+
+ if (requestEntity != null) {
+ requestEntity.setClusterHostInfo(clusterHostInfoJson);
+ requestDAO.merge(requestEntity);
+ }
Map<String, String> commandParams = new HashMap<>();
if (serviceName.equals(Service.Type.HBASE.name())) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 1730995..01f93b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1041,14 +1041,14 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
private Stage createNewStage(long id, Cluster cluster, long requestId,
- String requestContext, String clusterHostInfo,
+ String requestContext,
String commandParamsStage, String hostParamsStage) {
String logDir = BASE_LOG_DIR + File.pathSeparator + requestId;
Stage stage =
stageFactory.createNew(requestId, logDir,
null == cluster ? null : cluster.getClusterName(),
null == cluster ? -1L : cluster.getClusterId(),
- requestContext, clusterHostInfo, commandParamsStage,
+ requestContext, commandParamsStage,
hostParamsStage);
stage.setStageId(id);
return stage;
@@ -2630,8 +2630,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
customCommandExecutionHelper.createDefaultHostParams(cluster));
Stage stage = createNewStage(requestStages.getLastStageId(), cluster,
- requestStages.getId(), requestProperties.get(REQUEST_CONTEXT_PROPERTY),
- clusterHostInfoJson, "{}", hostParamsJson);
+ requestStages.getId(), requestProperties.get(REQUEST_CONTEXT_PROPERTY),"{}", hostParamsJson);
boolean skipFailure = false;
if (requestProperties.containsKey(Setting.SETTING_NAME_SKIP_FAILURE) && requestProperties.get(Setting.SETTING_NAME_SKIP_FAILURE).equalsIgnoreCase("true")) {
skipFailure = true;
@@ -2981,6 +2980,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
rg.setCommandExecutionType(CommandExecutionType.DEPENDENCY_ORDERED);
}
rg.build(stage);
+ requestStages.setClusterHostInfo(clusterHostInfoJson);
requestStages.addStages(rg.getStages());
if (!componentsToEnableKerberos.isEmpty()) {
@@ -3066,9 +3066,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
Map<String, Set<String>> clusterHostInfo = StageUtils.getClusterHostInfo(cluster);
String clusterHostInfoJson = StageUtils.getGson().toJson(clusterHostInfo);
Map<String, String> hostParamsCmd = customCommandExecutionHelper.createDefaultHostParams(cluster);
- Stage stage = createNewStage(0, cluster,
- 1, "",
- clusterHostInfoJson, "{}", "");
+ Stage stage = createNewStage(0, cluster,1, "","{}", "");
Map<String, Map<String, String>> configTags = configHelper.getEffectiveDesiredTags(cluster, scHost.getHostName());
@@ -4036,7 +4034,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
commandParamsForStage = gson.toJson(commandParamsStage);
Stage stage = createNewStage(requestStageContainer.getLastStageId(), cluster, requestId, requestContext,
- jsons.getClusterHostInfo(), commandParamsForStage, jsons.getHostParamsForStage());
+ commandParamsForStage, jsons.getHostParamsForStage());
if (actionRequest.isCommand()) {
customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
@@ -4057,6 +4055,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
List<Stage> stages = rg.getStages();
if (stages != null && !stages.isEmpty()) {
+ requestStageContainer.setClusterHostInfo(jsons.getClusterHostInfo());
requestStageContainer.addStages(stages);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index 4975e72..629636d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -2236,14 +2236,13 @@ public class KerberosHelperImpl implements KerberosHelper {
* @return a newly created Stage
*/
private Stage createNewStage(long id, Cluster cluster, long requestId,
- String requestContext, String clusterHostInfo,
- String commandParams, String hostParams) {
+ String requestContext, String commandParams, String hostParams) {
+
Stage stage = stageFactory.createNew(requestId,
BASE_LOG_DIR + File.pathSeparator + requestId,
cluster.getClusterName(),
cluster.getClusterId(),
requestContext,
- clusterHostInfo,
commandParams,
hostParams);
@@ -2271,14 +2270,14 @@ public class KerberosHelperImpl implements KerberosHelper {
* @param timeout the timeout for the task/action @return a newly created Stage
*/
private Stage createServerActionStage(long id, Cluster cluster, long requestId,
- String requestContext, String clusterHostInfo,
+ String requestContext,
String commandParams, String hostParams,
Class<? extends ServerAction> actionClass,
ServiceComponentHostServerActionEvent event,
Map<String, String> commandParameters, String commandDetail,
Integer timeout) throws AmbariException {
- Stage stage = createNewStage(id, cluster, requestId, requestContext, clusterHostInfo, commandParams, hostParams);
+ Stage stage = createNewStage(id, cluster, requestId, requestContext, commandParams, hostParams);
stage.addServerActionCommand(actionClass.getName(), null, Role.AMBARI_SERVER_ACTION,
RoleCommand.EXECUTE, cluster.getClusterName(), event, commandParameters, commandDetail,
ambariManagementController.findConfigurationTagsWithOverrides(cluster, null), timeout,
@@ -2770,7 +2769,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Preparing Operations",
- clusterHostInfoJson,
"{}",
hostParamsJson,
PrepareEnableKerberosServerAction.class,
@@ -2781,6 +2779,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2793,7 +2793,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Preparing Operations",
- clusterHostInfoJson,
"{}",
hostParamsJson,
PrepareKerberosIdentitiesServerAction.class,
@@ -2804,6 +2803,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2816,7 +2817,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Preparing Operations",
- clusterHostInfoJson,
"{}",
hostParamsJson,
PrepareDisableKerberosServerAction.class,
@@ -2827,6 +2827,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2839,7 +2841,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Create Principals",
- clusterHostInfoJson,
"{}",
hostParamsJson,
CreatePrincipalsServerAction.class,
@@ -2850,6 +2851,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2862,7 +2865,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Destroy Principals",
- clusterHostInfoJson,
"{}",
hostParamsJson,
DestroyPrincipalsServerAction.class,
@@ -2873,6 +2875,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2885,7 +2889,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Configure Ambari Identity",
- clusterHostInfoJson,
"{}",
hostParamsJson,
ConfigureAmbariIdentitiesServerAction.class,
@@ -2896,6 +2899,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2908,7 +2913,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Create Keytabs",
- clusterHostInfoJson,
"{}",
hostParamsJson,
CreateKeytabFilesServerAction.class,
@@ -2919,6 +2923,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -2934,7 +2940,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Distribute Keytabs",
- clusterHostInfoJson,
StageUtils.getGson().toJson(commandParameters),
hostParamsJson);
@@ -2959,6 +2964,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3000,12 +3007,13 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Disable security",
- clusterHostInfoJson,
StageUtils.getGson().toJson(commandParameters),
hostParamsJson);
addDisableSecurityCommandToAllServices(cluster, stage);
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3043,7 +3051,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Stopping ZooKeeper",
- clusterHostInfoJson,
StageUtils.getGson().toJson(commandParameters),
hostParamsJson);
for (ServiceComponent component : zookeeper.getServiceComponents().values()) {
@@ -3057,6 +3064,8 @@ public class KerberosHelperImpl implements KerberosHelper {
}
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3072,7 +3081,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Delete Keytabs",
- clusterHostInfoJson,
StageUtils.getGson().toJson(commandParameters),
hostParamsJson);
@@ -3100,6 +3108,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3112,7 +3122,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Update Configurations",
- clusterHostInfoJson,
"{}",
hostParamsJson,
UpdateKerberosConfigsServerAction.class,
@@ -3123,6 +3132,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3146,7 +3157,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Finalize Operations",
- clusterHostInfoJson,
"{}",
hostParamsJson,
FinalizeKerberosServerAction.class,
@@ -3156,6 +3166,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
@@ -3168,7 +3180,6 @@ public class KerberosHelperImpl implements KerberosHelper {
cluster,
requestStageContainer.getId(),
"Kerberization Clean Up",
- clusterHostInfoJson,
"{}",
hostParamsJson,
CleanupServerAction.class,
@@ -3179,6 +3190,8 @@ public class KerberosHelperImpl implements KerberosHelper {
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
requestStageContainer.addStages(roleGraph.getStages());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index f2fd9ac..621d71e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -546,7 +546,7 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
}
Stage stage = stageFactory.createNew(req.getId(), "/tmp/ambari", cluster.getClusterName(),
- cluster.getClusterId(), stageName, clusterHostInfoJson, "{}", hostParamsJson);
+ cluster.getClusterId(), stageName, "{}", hostParamsJson);
// if you have 1000 hosts (10 stages with 100 installs), we want to ensure
// that a single failure doesn't cause all other stages to abort; set the
@@ -591,6 +591,7 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
repoVersionEnt.getDisplayName()));
}
+ req.setClusterHostInfo(clusterHostInfoJson);
req.addStages(stages);
req.persist();
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
index 8f2d4e6..5fc3652 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
@@ -508,7 +508,6 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
cluster.getClusterName(),
cluster.getClusterId(),
caption,
- clusterHostInfoJson,
"{}",
StageUtils.getGson().toJson(hostLevelParams));
@@ -517,6 +516,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
stageId = 1L;
}
stage.setStageId(stageId);
+ req.setClusterHostInfo(clusterHostInfoJson);
req.addStages(Collections.singletonList(stage));
try {
@@ -556,7 +556,6 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
cluster.getClusterName(),
cluster.getClusterId(),
caption,
- clusterHostInfoJson,
StageUtils.getGson().toJson(commandParams),
StageUtils.getGson().toJson(hostLevelParams));
@@ -565,6 +564,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
stageId = 1L;
}
stage.setStageId(stageId);
+ req.setClusterHostInfo(clusterHostInfoJson);
req.addStages(Collections.singletonList(stage));
actionContext = new ActionExecutionContext(
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
index 94deb52..9cb994d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
@@ -103,6 +103,7 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider
public static final String REQUEST_SOURCE_SCHEDULE_HREF = "Requests/request_schedule/href";
protected static final String REQUEST_TYPE_ID = "Requests/type";
protected static final String REQUEST_INPUTS_ID = "Requests/inputs";
+ protected static final String REQUEST_CLUSTER_HOST_INFO_ID = "Requests/cluster_host_info";
protected static final String REQUEST_RESOURCE_FILTER_ID = "Requests/resource_filters";
protected static final String REQUEST_OPERATION_LEVEL_ID = "Requests/operation_level";
protected static final String REQUEST_CREATE_TIME_ID = "Requests/create_time";
@@ -158,7 +159,9 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider
REQUEST_QUEUED_TASK_CNT_ID,
REQUEST_PROGRESS_PERCENT_ID,
REQUEST_REMOVE_PENDING_HOST_REQUESTS_ID,
- REQUEST_PENDING_HOST_REQUEST_COUNT_ID);
+ REQUEST_PENDING_HOST_REQUEST_COUNT_ID,
+ REQUEST_CLUSTER_HOST_INFO_ID
+ );
// ----- Constructors ----------------------------------------------------
@@ -752,6 +755,10 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider
resource.setProperty(REQUEST_INPUTS_ID, value);
}
+ if (isPropertyRequested(REQUEST_CLUSTER_HOST_INFO_ID, requestedPropertyIds)) {
+ resource.setProperty(REQUEST_CLUSTER_HOST_INFO_ID, entity.getClusterHostInfo());
+ }
+
setResourceProperty(resource, REQUEST_RESOURCE_FILTER_ID,
org.apache.ambari.server.actionmanager.Request.filtersFromEntity(entity),
requestedPropertyIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java
index 49ba946..3d640b1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestStageContainer.java
@@ -65,6 +65,8 @@ public class RequestStageContainer {
private ExecuteActionRequest actionRequest = null;
+ private String clusterHostInfo = null;
+
/**
* Logger
*/
@@ -99,6 +101,7 @@ public class RequestStageContainer {
this.requestFactory = factory;
this.actionManager = manager;
this.actionRequest = actionRequest;
+ this.clusterHostInfo = "{}";
}
/**
@@ -110,6 +113,10 @@ public class RequestStageContainer {
return id;
}
+ public void setClusterHostInfo(String clusterHostInfo){
+ this.clusterHostInfo = clusterHostInfo;
+ }
+
/**
* Add stages to request.
*
@@ -202,8 +209,8 @@ public class RequestStageContainer {
public void persist() throws AmbariException {
if (!stages.isEmpty()) {
Request request = (null == actionRequest)
- ? requestFactory.createNewFromStages(stages)
- : requestFactory.createNewFromStages(stages, actionRequest);
+ ? requestFactory.createNewFromStages(stages, clusterHostInfo)
+ : requestFactory.createNewFromStages(stages, clusterHostInfo, actionRequest);
if (null != requestContext) {
request.setRequestContext(requestContext);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 3ed1d8a..5dcd799 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -47,6 +47,7 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PredicateHelper;
import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
+import org.apache.ambari.server.orm.dao.RequestDAO;
import org.apache.ambari.server.orm.dao.StageDAO;
import org.apache.ambari.server.orm.entities.StageEntity;
import org.apache.ambari.server.state.Cluster;
@@ -91,7 +92,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
public static final String STAGE_REQUEST_ID = "Stage/request_id";
public static final String STAGE_LOG_INFO = "Stage/log_info";
public static final String STAGE_CONTEXT = "Stage/context";
- public static final String STAGE_CLUSTER_HOST_INFO = "Stage/cluster_host_info";
public static final String STAGE_COMMAND_PARAMS = "Stage/command_params";
public static final String STAGE_HOST_PARAMS = "Stage/host_params";
public static final String STAGE_SKIPPABLE = "Stage/skippable";
@@ -119,7 +119,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
PROPERTY_IDS.add(STAGE_REQUEST_ID);
PROPERTY_IDS.add(STAGE_LOG_INFO);
PROPERTY_IDS.add(STAGE_CONTEXT);
- PROPERTY_IDS.add(STAGE_CLUSTER_HOST_INFO);
PROPERTY_IDS.add(STAGE_COMMAND_PARAMS);
PROPERTY_IDS.add(STAGE_HOST_PARAMS);
PROPERTY_IDS.add(STAGE_SKIPPABLE);
@@ -302,11 +301,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
setResourceProperty(resource, STAGE_CONTEXT, entity.getRequestContext(), requestedIds);
// this property is lazy loaded in JPA; don't use it unless requested
- if (isPropertyRequested(STAGE_CLUSTER_HOST_INFO, requestedIds)) {
- resource.setProperty(STAGE_CLUSTER_HOST_INFO, entity.getClusterHostInfo());
- }
-
- // this property is lazy loaded in JPA; don't use it unless requested
if (isPropertyRequested(STAGE_COMMAND_PARAMS, requestedIds)) {
String value = entity.getCommandParamsStage();
if (!StringUtils.isBlank(value)) {
@@ -384,11 +378,6 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
setResourceProperty(resource, STAGE_CONTEXT, entity.getRequestContext(), requestedIds);
// this property is lazy loaded in JPA; don't use it unless requested
- if (isPropertyRequested(STAGE_CLUSTER_HOST_INFO, requestedIds)) {
- resource.setProperty(STAGE_CLUSTER_HOST_INFO, entity.getClusterHostInfo());
- }
-
- // this property is lazy loaded in JPA; don't use it unless requested
if (isPropertyRequested(STAGE_COMMAND_PARAMS, requestedIds)) {
resource.setProperty(STAGE_COMMAND_PARAMS, entity.getCommandParamsStage());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 9d05cb5..7fced97 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1317,8 +1317,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
cluster, context.getEffectiveStackId());
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
- cluster.getClusterName(), cluster.getClusterId(), entity.getText(),
- jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(),
+ cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
jsons.getHostParamsForStage());
stage.setSkippable(skippable);
@@ -1400,8 +1399,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
cluster, context.getEffectiveStackId());
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
- cluster.getClusterName(), cluster.getClusterId(), entity.getText(),
- jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(),
+ cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
jsons.getHostParamsForStage());
stage.setSkippable(skippable);
@@ -1462,8 +1460,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
cluster, context.getEffectiveStackId());
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
- cluster.getClusterName(), cluster.getClusterId(), entity.getText(),
- jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(),
+ cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
jsons.getHostParamsForStage());
stage.setSkippable(skippable);
@@ -1593,8 +1590,8 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
cluster, context.getEffectiveStackId());
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
- cluster.getClusterName(), cluster.getClusterId(), stageText, jsons.getClusterHostInfo(),
- jsons.getCommandParamsForStage(), jsons.getHostParamsForStage());
+ cluster.getClusterName(), cluster.getClusterId(), stageText, jsons.getCommandParamsForStage(),
+ jsons.getHostParamsForStage());
stage.setSkippable(skippable);
stage.setAutoSkipFailureSupported(supportsAutoSkipOnFailure);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/hooks/users/UserHookService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/hooks/users/UserHookService.java b/ambari-server/src/main/java/org/apache/ambari/server/hooks/users/UserHookService.java
index 69463ab..149e2f0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/hooks/users/UserHookService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/hooks/users/UserHookService.java
@@ -139,7 +139,7 @@ public class UserHookService implements HookService {
String stageContextText = String.format(POST_USER_CREATION_REQUEST_CONTEXT, ctx.getUserGroups().size());
Stage stage = stageFactory.createNew(requestStageContainer.getId(), configuration.getServerTempDir() + File.pathSeparatorChar + requestStageContainer.getId(), clsData.getClusterName(),
- clsData.getClusterId(), stageContextText, "{}", "{}", "{}");
+ clsData.getClusterId(), stageContextText, "{}", "{}");
stage.setStageId(requestStageContainer.getLastStageId());
ServiceComponentHostServerActionEvent serverActionEvent = new ServiceComponentHostServerActionEvent("ambari-server-host", System.currentTimeMillis());
@@ -148,6 +148,7 @@ public class UserHookService implements HookService {
stage.addServerActionCommand(PostUserCreationHookServerAction.class.getName(), "ambari", Role.AMBARI_SERVER_ACTION,
RoleCommand.EXECUTE, clsData.getClusterName(), serverActionEvent, commandParams, stageContextText, null, null, false, false);
+ requestStageContainer.setClusterHostInfo("{}");
requestStageContainer.addStages(Collections.singletonList(stage));
requestStageContainer.persist();
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestEntity.java
index b1aad00..e46bb51 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestEntity.java
@@ -27,6 +27,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
@@ -60,6 +61,16 @@ public class RequestEntity {
@Basic
private String commandName;
+ /**
+ * On large clusters, this value can be in the 10,000's of kilobytes. During
+ * an upgrade, all stages are loaded in memory for every request, which can
+ * lead to an OOM. As a result, lazy load this since it's barely ever
+ * requested or used.
+ */
+ @Column(name = "cluster_host_info")
+ @Basic(fetch = FetchType.LAZY)
+ private byte[] clusterHostInfo;
+
@Column(name = "inputs")
@Lob
private byte[] inputs = new byte[0];
@@ -125,6 +136,14 @@ public class RequestEntity {
this.stages = stages;
}
+ public String getClusterHostInfo() {
+ return clusterHostInfo == null ? "{}" : new String(clusterHostInfo);
+ }
+
+ public void setClusterHostInfo(String clusterHostInfo) {
+ this.clusterHostInfo = clusterHostInfo.getBytes();
+ }
+
public Long getCreateTime() {
return createTime;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
index 42f3ff3..aeafda0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
@@ -91,16 +91,6 @@ public class StageEntity {
* lead to an OOM. As a result, lazy load this since it's barely ever
* requested or used.
*/
- @Column(name = "cluster_host_info")
- @Basic(fetch = FetchType.LAZY)
- private byte[] clusterHostInfo;
-
- /**
- * On large clusters, this value can be in the 10,000's of kilobytes. During
- * an upgrade, all stages are loaded in memory for every request, which can
- * lead to an OOM. As a result, lazy load this since it's barely ever
- * requested or used.
- */
@Column(name = "command_params")
@Basic(fetch = FetchType.LAZY)
private byte[] commandParamsStage;
@@ -156,14 +146,6 @@ public class StageEntity {
return defaultString(requestContext);
}
- public String getClusterHostInfo() {
- return clusterHostInfo == null ? new String() : new String(clusterHostInfo);
- }
-
- public void setClusterHostInfo(String clusterHostInfo) {
- this.clusterHostInfo = clusterHostInfo.getBytes();
- }
-
public String getCommandParamsStage() {
return commandParamsStage == null ? new String() : new String(commandParamsStage);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
index a445192..10214ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
@@ -40,7 +40,6 @@ public class StageEntity_ {
public static volatile SingularAttribute<StageEntity, String> logInfo;
public static volatile SingularAttribute<StageEntity, String> requestContext;
- public static volatile SingularAttribute<StageEntity, byte[]> clusterHostInfo;
public static volatile SingularAttribute<StageEntity, byte[]> commandParamsStage;
public static volatile SingularAttribute<StageEntity, byte[]> hostParamsStage;
@@ -73,9 +72,6 @@ public class StageEntity_ {
mapping.put(StageResourceProvider.STAGE_CONTEXT,
Collections.singletonList(requestContext));
- mapping.put(StageResourceProvider.STAGE_CLUSTER_HOST_INFO,
- Collections.singletonList(clusterHostInfo));
-
mapping.put(StageResourceProvider.STAGE_COMMAND_PARAMS,
Collections.singletonList(commandParamsStage));
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java
index 734807b..dced497 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java
@@ -283,7 +283,7 @@ public class RoleGraph {
Stage newStage = stageFactory.createNew(origStage.getRequestId(),
origStage.getLogDir(), origStage.getClusterName(),
origStage.getClusterId(),
- origStage.getRequestContext(), origStage.getClusterHostInfo(),
+ origStage.getRequestContext(),
origStage.getCommandParamsStage(), origStage.getHostParamsStage());
newStage.setSuccessFactors(origStage.getSuccessFactors());
newStage.setSkippable(origStage.isSkippable());
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog251.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog251.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog251.java
index 6f8f2a6..c4f198f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog251.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog251.java
@@ -24,6 +24,8 @@ import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
import com.google.inject.Inject;
import com.google.inject.Injector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The {@link UpgradeCatalog251} upgrades Ambari from 2.5.0 to 2.5.1.
@@ -33,6 +35,17 @@ public class UpgradeCatalog251 extends AbstractUpgradeCatalog {
static final String HOST_ROLE_COMMAND_TABLE = "host_role_command";
static final String HRC_IS_BACKGROUND_COLUMN = "is_background";
+ private static final String STAGE_TABLE = "stage";
+ private static final String REQUEST_TABLE = "request";
+ private static final String CLUSTER_HOST_INFO_COLUMN = "cluster_host_info";
+ private static final String REQUEST_ID_COLUMN = "request_id";
+
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog251.class);
+
/**
* Constructor.
*
@@ -65,6 +78,7 @@ public class UpgradeCatalog251 extends AbstractUpgradeCatalog {
@Override
protected void executeDDLUpdates() throws AmbariException, SQLException {
addBackgroundColumnToHostRoleCommand();
+ moveClusterHostColumnFromStageToRequest();
}
/**
@@ -91,4 +105,26 @@ public class UpgradeCatalog251 extends AbstractUpgradeCatalog {
dbAccessor.addColumn(HOST_ROLE_COMMAND_TABLE,
new DBColumnInfo(HRC_IS_BACKGROUND_COLUMN, Short.class, null, 0, false));
}
+
+ /**
+ * Moves the {@value #CLUSTER_HOST_INFO_COLUMN} column from {@value #STAGE_TABLE} table to the
+ * {@value #REQUEST_TABLE} table
+ *
+ *
+ * @throws SQLException
+ */
+ private void moveClusterHostColumnFromStageToRequest() throws SQLException {
+ if (dbAccessor.tableHasColumn(STAGE_TABLE, CLUSTER_HOST_INFO_COLUMN)){
+
+ dbAccessor.addColumn(REQUEST_TABLE, new DBColumnInfo(CLUSTER_HOST_INFO_COLUMN, byte[].class, null, null, true));
+
+ // Native query currently is best way to move data, in future move this functionality to dbAccessor
+ final String moveSQL = String.format("UPDATE %1$s AS a SET %3$s = b.%3$s FROM %2$s AS b WHERE a.%4$s = b.%4$s;",
+ REQUEST_TABLE, STAGE_TABLE, CLUSTER_HOST_INFO_COLUMN, REQUEST_ID_COLUMN);
+
+ dbAccessor.executeUpdate(moveSQL, false);
+ dbAccessor.alterColumn(REQUEST_TABLE, new DBColumnInfo(CLUSTER_HOST_INFO_COLUMN, byte[].class, null, null, false));
+ dbAccessor.dropColumn(STAGE_TABLE, CLUSTER_HOST_INFO_COLUMN);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
index 240bfc7..8ab5033 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
@@ -194,20 +194,20 @@ public class StageUtils {
return requestStageIds;
}
- public static Stage getATestStage(long requestId, long stageId, String clusterHostInfo, String commandParamsStage, String hostParamsStage) {
+ public static Stage getATestStage(long requestId, long stageId, String commandParamsStage, String hostParamsStage) {
String hostname;
try {
hostname = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
hostname = "host-dummy";
}
- return getATestStage(requestId, stageId, hostname, clusterHostInfo, commandParamsStage, hostParamsStage);
+ return getATestStage(requestId, stageId, hostname, commandParamsStage, hostParamsStage);
}
//For testing only
@Inject
- public static Stage getATestStage(long requestId, long stageId, String hostname, String clusterHostInfo, String commandParamsStage, String hostParamsStage) {
- Stage s = stageFactory.createNew(requestId, "/tmp", "cluster1", 1L, "context", clusterHostInfo, commandParamsStage, hostParamsStage);
+ public static Stage getATestStage(long requestId, long stageId, String hostname, String commandParamsStage, String hostParamsStage) {
+ Stage s = stageFactory.createNew(requestId, "/tmp", "cluster1", 1L, "context", commandParamsStage, hostParamsStage);
s.setStageId(stageId);
long now = System.currentTimeMillis();
s.addHostRoleExecutionCommand(hostname, Role.NAMENODE, RoleCommand.INSTALL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 43bf1de..9a7d283 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -346,6 +346,7 @@ CREATE TABLE request (
request_schedule_id BIGINT,
start_time BIGINT NOT NULL,
status VARCHAR(255),
+ cluster_host_info BLOB NOT NULL,
CONSTRAINT PK_request PRIMARY KEY (request_id),
CONSTRAINT FK_request_schedule_id FOREIGN KEY (request_schedule_id) REFERENCES requestschedule (schedule_id));
@@ -357,7 +358,6 @@ CREATE TABLE stage (
supports_auto_skip_failure SMALLINT DEFAULT 0 NOT NULL,
log_info VARCHAR(255) NOT NULL,
request_context VARCHAR(255),
- cluster_host_info BLOB NOT NULL,
command_params BLOB,
host_params BLOB,
command_execution_type VARCHAR(32) NOT NULL DEFAULT 'STAGE',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/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 6def989..d8bddda 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -357,6 +357,7 @@ CREATE TABLE request (
request_type VARCHAR(255),
start_time BIGINT NOT NULL,
status VARCHAR(255),
+ cluster_host_info LONGBLOB,
CONSTRAINT PK_request PRIMARY KEY (request_id),
CONSTRAINT FK_request_schedule_id FOREIGN KEY (request_schedule_id) REFERENCES requestschedule (schedule_id));
@@ -368,7 +369,6 @@ CREATE TABLE stage (
supports_auto_skip_failure SMALLINT DEFAULT 0 NOT NULL,
log_info VARCHAR(255) NOT NULL,
request_context VARCHAR(255),
- cluster_host_info LONGBLOB,
command_params LONGBLOB,
host_params LONGBLOB,
command_execution_type VARCHAR(32) NOT NULL DEFAULT 'STAGE',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/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 1a0ab87..e192782 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -337,6 +337,7 @@ CREATE TABLE request (
request_type VARCHAR(255),
start_time NUMBER(19) NOT NULL,
status VARCHAR(255),
+ cluster_host_info BLOB NOT NULL,
CONSTRAINT PK_request PRIMARY KEY (request_id),
CONSTRAINT FK_request_schedule_id FOREIGN KEY (request_schedule_id) REFERENCES requestschedule (schedule_id));
@@ -348,7 +349,6 @@ CREATE TABLE stage (
supports_auto_skip_failure NUMBER(1) DEFAULT 0 NOT NULL,
log_info VARCHAR2(255) NULL,
request_context VARCHAR2(255) NULL,
- cluster_host_info BLOB NOT NULL,
command_params BLOB,
host_params BLOB,
command_execution_type VARCHAR2(32) DEFAULT 'STAGE' NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/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 5c6668c..6dece67 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -346,6 +346,7 @@ CREATE TABLE request (
request_schedule_id BIGINT,
start_time BIGINT NOT NULL,
status VARCHAR(255),
+ cluster_host_info BYTEA NOT NULL,
CONSTRAINT PK_request PRIMARY KEY (request_id),
CONSTRAINT FK_request_schedule_id FOREIGN KEY (request_schedule_id) REFERENCES requestschedule (schedule_id));
@@ -357,7 +358,6 @@ CREATE TABLE stage (
supports_auto_skip_failure SMALLINT DEFAULT 0 NOT NULL,
log_info VARCHAR(255) NOT NULL,
request_context VARCHAR(255),
- cluster_host_info BYTEA NOT NULL,
command_params BYTEA,
host_params BYTEA,
command_execution_type VARCHAR(32) DEFAULT 'STAGE' NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 779d0e9..491a49c 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -137,6 +137,7 @@
"Requests/abort_reason",
"Requests/remove_pending_host_requests",
"Requests/pending_host_request_count",
+ "Requests/cluster_host_info",
"_"
],
"RequestSchedule" : [
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
index 893c3fb..c28ba5d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
@@ -149,7 +149,7 @@ public class ExecutionCommandWrapperTest {
private static void createTask(ActionDBAccessor db, long requestId, long stageId, String hostName, String clusterName) throws AmbariException {
- Stage s = stageFactory.createNew(requestId, "/var/log", clusterName, 1L, "execution command wrapper test", "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ Stage s = stageFactory.createNew(requestId, "/var/log", clusterName, 1L, "execution command wrapper test", "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addHostRoleExecutionCommand(hostName, Role.NAMENODE,
RoleCommand.START,
@@ -157,7 +157,7 @@ public class ExecutionCommandWrapperTest {
hostName, System.currentTimeMillis()), clusterName, "HDFS", false, false);
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "clusterHostInfo", clusters);
db.persistActions(request);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/StageTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/StageTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/StageTest.java
index 89627f7..214aee1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/StageTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/StageTest.java
@@ -66,7 +66,7 @@ public class StageTest {
@Test
public void testAddServerActionCommand_userName() throws Exception {
- final Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 978, "context", CLUSTER_HOST_INFO,
+ final Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 978, "context",
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
stage.addServerActionCommand(ConfigureAction.class.getName(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
index de3b013..88fc22d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
@@ -194,7 +194,7 @@ public class TestActionDBAccessorImpl {
List<Stage> stages = new ArrayList<Stage>();
stages.add(createStubStage(hostName, requestId, stageId));
stages.add(createStubStage(hostName, requestId, stageId + 1));
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
db.persistActions(request);
assertEquals(2, stages.size());
}
@@ -540,7 +540,7 @@ public class TestActionDBAccessorImpl {
@Test
public void testAbortRequest() throws AmbariException {
Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
- "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
clusters.addHost("host2");
@@ -577,7 +577,8 @@ public class TestActionDBAccessorImpl {
String hostName = cmd.getHostName();
cmd.setStatus(HostRoleStatus.COMPLETED);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
+ request.setClusterHostInfo("clusterHostInfo");
db.persistActions(request);
db.abortOperation(requestId);
@@ -621,7 +622,7 @@ public class TestActionDBAccessorImpl {
stages.add(stage);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
// persist entities
db.persistActions(request);
@@ -669,7 +670,7 @@ public class TestActionDBAccessorImpl {
@Test
public void testGet1000TasksFromOracleDB() throws Exception {
Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
- "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
for (int i = 1000; i < 2002; i++) {
String host = "host" + i;
@@ -682,7 +683,8 @@ public class TestActionDBAccessorImpl {
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
+ request.setClusterHostInfo("clusterHostInfo");
db.persistActions(request);
List<HostRoleCommandEntity> entities =
@@ -710,7 +712,7 @@ public class TestActionDBAccessorImpl {
Stage s = createStubStage(hostname, requestId, stageId);
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
db.persistActions(request);
}
@@ -724,7 +726,7 @@ public class TestActionDBAccessorImpl {
stages.add(stage);
}
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
db.persistActions(request);
}
@@ -734,7 +736,7 @@ public class TestActionDBAccessorImpl {
Stage s = createStubStage(hostname, requestId, stageId);
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
s.setHostRoleStatus(hostname, Role.HBASE_REGIONSERVER.name(), HostRoleStatus.COMPLETED);
s.setHostRoleStatus(hostname, Role.HBASE_MASTER.name(), HostRoleStatus.COMPLETED);
@@ -748,7 +750,7 @@ public class TestActionDBAccessorImpl {
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
s.setHostRoleStatus(hostname, Role.HBASE_REGIONSERVER.name(), HostRoleStatus.PENDING);
s.setHostRoleStatus(hostname, Role.HBASE_MASTER.name(), HostRoleStatus.COMPLETED);
@@ -757,7 +759,7 @@ public class TestActionDBAccessorImpl {
private Stage createStubStage(String hostname, long requestId, long stageId) {
Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
- "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addHostRoleExecutionCommand(hostname, Role.HBASE_MASTER,
RoleCommand.START,
@@ -775,7 +777,7 @@ public class TestActionDBAccessorImpl {
private void populateActionDBWithCustomAction(ActionDBAccessor db, String hostname,
long requestId, long stageId) throws AmbariException {
Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
- "", "commandParamsStage", "hostParamsStage");
+ "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addHostRoleExecutionCommand(hostname, Role.valueOf(actionName),
RoleCommand.ACTIONEXECUTE,
@@ -786,20 +788,22 @@ public class TestActionDBAccessorImpl {
final RequestResourceFilter resourceFilter = new RequestResourceFilter("HBASE", "HBASE_MASTER", null);
List<RequestResourceFilter> resourceFilters = new
ArrayList<RequestResourceFilter>() {{ add(resourceFilter); }};
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
+ request.setClusterHostInfo("");
db.persistActions(request);
}
private void populateActionDBWithServerAction(ActionDBAccessor db, String hostname,
long requestId, long stageId) throws AmbariException {
Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
- "", "commandParamsStage", "hostParamsStage");
+ "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addServerActionCommand(serverActionName, null, Role.AMBARI_SERVER_ACTION,
RoleCommand.ACTIONEXECUTE, clusterName, null, null, "command details", null, 300, false, false);
List<Stage> stages = new ArrayList<Stage>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "", clusters);
+ request.setClusterHostInfo("");
db.persistActions(request);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed42f68f/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
index fbd7c4e..410de80 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
@@ -220,7 +220,7 @@ public class TestActionManager {
}
private void populateActionDB(ActionDBAccessor db, String hostname) throws AmbariException {
- Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action manager test", "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action manager test", "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addHostRoleExecutionCommand(hostname, Role.HBASE_MASTER,
RoleCommand.START,
@@ -228,12 +228,12 @@ public class TestActionManager {
hostname, System.currentTimeMillis()), "cluster1", "HBASE", false, false);
List<Stage> stages = new ArrayList<>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "clusterHostInfo", clusters);
db.persistActions(request);
}
private void populateActionDBWithTwoCommands(ActionDBAccessor db, String hostname) throws AmbariException {
- Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action manager test", "clusterHostInfo", "commandParamsStage", "hostParamsStage");
+ Stage s = stageFactory.createNew(requestId, "/a/b", "cluster1", 1L, "action manager test", "commandParamsStage", "hostParamsStage");
s.setStageId(stageId);
s.addHostRoleExecutionCommand(hostname, Role.HBASE_MASTER,
RoleCommand.START,
@@ -245,7 +245,7 @@ public class TestActionManager {
hostname, System.currentTimeMillis()), "cluster1", "HBASE", false, false);
List<Stage> stages = new ArrayList<>();
stages.add(s);
- Request request = new Request(stages, clusters);
+ Request request = new Request(stages, "clusterHostInfo", clusters);
db.persistActions(request);
}