Manya0407 commented on code in PR #6656:
URL: https://github.com/apache/hive/pull/6656#discussion_r4357281634
##########
llap-server/src/java/org/apache/hadoop/hive/llap/cli/status/LlapStatusServiceDriver.java:
##########
@@ -488,6 +532,99 @@ private ExitCode
populateAppStatusFromLlapRegistry(AppStatusBuilder appStatusBui
return ExitCode.SUCCESS;
}
+ static boolean isLlapDaemonWebResponsive(String statusUrl) {
+ if (StringUtils.isBlank(statusUrl)) {
+ return false;
+ }
+ HttpURLConnection conn = null;
+ try {
+ conn = (HttpURLConnection) new URL(statusUrl).openConnection();
+ conn.setRequestMethod("GET");
+ conn.setConnectTimeout(FIXED_REGISTRY_STATUS_CHECK_TIMEOUT_MS);
+ conn.setReadTimeout(FIXED_REGISTRY_STATUS_CHECK_TIMEOUT_MS);
+ int responseCode = conn.getResponseCode();
+ return responseCode >= HttpURLConnection.HTTP_OK
+ && responseCode < HttpURLConnection.HTTP_MULT_CHOICE;
+ } catch (IOException e) {
+ LOG.debug("LLAP daemon status check failed for {}: {}", statusUrl,
e.toString());
+ return false;
+ } finally {
+ if (conn != null) {
+ conn.disconnect();
+ }
+ }
+ }
+
+ static LlapInstance createLlapInstanceFromRegistry(LlapServiceInstance
serviceInstance) {
+ String containerId = serviceInstance.getProperties().get(
+ HiveConf.ConfVars.LLAP_DAEMON_CONTAINER_ID.varname);
+ if (StringUtils.isBlank(containerId)) {
+ containerId = serviceInstance.getWorkerIdentity();
+ }
+ LlapInstance llapInstance = new LlapInstance(serviceInstance.getHost(),
containerId);
+ llapInstance.setMgmtPort(serviceInstance.getManagementPort());
+ llapInstance.setRpcPort(serviceInstance.getRpcPort());
+ llapInstance.setShufflePort(serviceInstance.getShufflePort());
+ llapInstance.setWebUrl(serviceInstance.getServicesAddress());
+ llapInstance.setStatusUrl(serviceInstance.getServicesAddress() +
"/status");
+ return llapInstance;
+ }
+
+ static void updateStateFromInstanceCounts(AppStatusBuilder appStatusBuilder,
int liveInstances) {
+ Integer desiredInstances = appStatusBuilder.getDesiredInstances();
+ if (desiredInstances != null && liveInstances >= desiredInstances) {
+ appStatusBuilder.setState(State.RUNNING_ALL);
+ } else if (liveInstances > 0) {
+ appStatusBuilder.setState(State.RUNNING_PARTIAL);
+ } else {
+ appStatusBuilder.setState(State.LAUNCHING);
+ }
+ }
+
+ /**
+ * Configures {@link #llapRegistryConf} for {@link LlapRegistryService}.
Preserves a comma-separated
+ * host list for {@code LlapFixedRegistryImpl}; uses {@code @appName} for ZK
registry otherwise.
+ */
+ static void configureLlapRegistryHosts(Configuration conf, Configuration
llapRegistryConf, String appName) {
+ String configuredHosts = HiveConf.getTrimmedVar(conf,
HiveConf.ConfVars.LLAP_DAEMON_SERVICE_HOSTS);
+ if (configuredHosts != null && !configuredHosts.startsWith("@")) {
+
llapRegistryConf.set(HiveConf.ConfVars.LLAP_DAEMON_SERVICE_HOSTS.varname,
configuredHosts);
+ } else {
+
llapRegistryConf.set(HiveConf.ConfVars.LLAP_DAEMON_SERVICE_HOSTS.varname, "@" +
appName);
+ }
+ }
Review Comment:
For fixed registry, hive.llap.daemon.service.hosts is the actual source of
daemon addresses, so we preserve the configured host list. In that mode, -n is
effectively just the app/display name. For dynamic/ZK registry, -n still
controls the registry namespace by setting @appName, which matches the previous
behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]