Revert "HIVE-15827: LLAP: status tool breaks out of watch mode when live instances is 0 (Prasanth Jayachandran reviewed by Sergey Shelukhin)"
This reverts commit 70bd0ce86e64a5ec02e824650a4cd1fe5c68ccba. Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2134bfc3 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2134bfc3 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2134bfc3 Branch: refs/heads/hive-14535 Commit: 2134bfc3c526c44451af7bba9b52731567e4d997 Parents: 70bd0ce Author: Prasanth Jayachandran <[email protected]> Authored: Mon Feb 6 17:51:57 2017 -0800 Committer: Prasanth Jayachandran <[email protected]> Committed: Mon Feb 6 17:51:57 2017 -0800 ---------------------------------------------------------------------- .../hive/llap/cli/LlapStatusServiceDriver.java | 37 ++------------------ 1 file changed, 3 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/2134bfc3/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapStatusServiceDriver.java ---------------------------------------------------------------------- diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapStatusServiceDriver.java b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapStatusServiceDriver.java index ab4173c..39d542b 100644 --- a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapStatusServiceDriver.java +++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapStatusServiceDriver.java @@ -251,9 +251,6 @@ public class LlapStatusServiceDriver { if (ret != ExitCode.SUCCESS) { return ret.getInt(); - } else if (EnumSet.of(State.APP_NOT_FOUND, State.COMPLETE, State.LAUNCHING) - .contains(appStatusBuilder.getState())) { - return ExitCode.SUCCESS.getInt(); } else { try { ret = populateAppStatusFromLlapRegistry(appStatusBuilder); @@ -438,15 +435,6 @@ public class LlapStatusServiceDriver { int liveContainers = llapStats.get(StatusKeys.STATISTICS_CONTAINERS_LIVE); appStatusBuilder.setDesiredInstances(desiredContainers); appStatusBuilder.setLiveInstances(liveContainers); - if (liveContainers == 0) { - appStatusBuilder.setState(State.LAUNCHING); - } else { - if (desiredContainers >= liveContainers) { - appStatusBuilder.setState(State.RUNNING_ALL); - } else { - appStatusBuilder.setState(State.RUNNING_PARTIAL); - } - } } else { throw new LlapStatusCliException(ExitCode.SLIDER_CLIENT_ERROR_OTHER, "Failed to get statistics for LLAP"); // Error since LLAP should always exist. @@ -508,7 +496,7 @@ public class LlapStatusServiceDriver { Collection<ServiceInstance> serviceInstances; try { serviceInstances = llapRegistry.getInstances().getAll(); - } catch (Exception e) { + } catch (IOException e) { throw new LlapStatusCliException(ExitCode.LLAP_REGISTRY_ERROR, "Failed to get instances from llap registry", e); } @@ -552,11 +540,7 @@ public class LlapStatusServiceDriver { LOG.warn("Found more entries in LLAP registry, as compared to desired entries"); } } else { - if (validatedInstances.size() > 0) { - appStatusBuilder.setState(State.RUNNING_PARTIAL); - } else { - appStatusBuilder.setState(State.LAUNCHING); - } + appStatusBuilder.setState(State.RUNNING_PARTIAL); } // At this point, everything that can be consumed from AppStatusBuilder has been consumed. @@ -590,8 +574,6 @@ public class LlapStatusServiceDriver { private Long appStartTime; private Long appFinishTime; - private boolean runningThresholdAchieved = false; - private final List<LlapInstance> llapInstances = new LinkedList<>(); private transient Map<String, LlapInstance> containerToInstanceMap = new HashMap<>(); @@ -642,11 +624,6 @@ public class LlapStatusServiceDriver { return this; } - public AppStatusBuilder setRunningThresholdAchieved(boolean thresholdAchieved) { - this.runningThresholdAchieved = thresholdAchieved; - return this; - } - public LlapInstance removeAndgetLlapInstanceForContainer(String containerIdString) { return containerToInstanceMap.remove(containerIdString); } @@ -705,10 +682,6 @@ public class LlapStatusServiceDriver { return llapInstances; } - public boolean isRunningThresholdAchieved() { - return runningThresholdAchieved; - } - @JsonIgnore public AmInfo maybeCreateAndGetAmInfo() { if (amInfo == null) { @@ -1020,7 +993,7 @@ public class LlapStatusServiceDriver { // we have reached RUNNING state, now check if running nodes threshold is met final int liveInstances = statusServiceDriver.appStatusBuilder.getLiveInstances(); final int desiredInstances = statusServiceDriver.appStatusBuilder.getDesiredInstances(); - if (desiredInstances > 0) { + if (liveInstances > 0 && desiredInstances > 0) { final float ratio = (float) liveInstances / (float) desiredInstances; if (ratio < runningNodesThreshold) { LOG.warn("Waiting until running nodes threshold is reached. Current: {} Desired: {}." + @@ -1032,11 +1005,7 @@ public class LlapStatusServiceDriver { continue; } else { desiredStateAttained = true; - statusServiceDriver.appStatusBuilder.setRunningThresholdAchieved(true); } - } else { - numAttempts--; - continue; } } }
