You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/22 17:25:33 UTC
[3/3] ambari git commit: Revert "Merge with trunk"
Revert "Merge with trunk"
This reverts commit dea22be16c172ed0ca7a6e66ac29bda04027ca2f.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4d3839c7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4d3839c7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4d3839c7
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4d3839c7f9ce921e92de82bc66440167cb6173a9
Parents: dea22be
Author: Nate Cole <nc...@hortonworks.com>
Authored: Mon Feb 22 11:24:56 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Mon Feb 22 11:24:56 2016 -0500
----------------------------------------------------------------------
.../python/resource_management/core/logger.py | 2 +-
.../timeline/AbstractTimelineMetricsSink.java | 53 +-----
.../ApplicationHistoryServer.java | 6 +-
.../loadsimulator/net/RestMetricsSender.java | 4 +-
.../ApplicationHistoryStoreTestUtils.java | 2 +-
.../TestApplicationHistoryClientService.java | 6 +-
.../TestFileSystemApplicationHistoryStore.java | 12 +-
.../TestMemoryApplicationHistoryStore.java | 12 +-
.../webapp/TestAHSWebServices.java | 2 +-
.../server/configuration/Configuration.java | 89 ---------
.../server/controller/ControllerModule.java | 16 --
.../controller/ServiceComponentRequest.java | 35 +---
.../controller/ServiceComponentResponse.java | 22 +--
.../internal/ComponentResourceProvider.java | 38 ----
.../server/orm/dao/HostRoleCommandDAO.java | 166 +++-------------
.../orm/entities/HostRoleCommandEntity.java | 7 +-
.../ServiceComponentDesiredStateEntity.java | 11 --
.../serveraction/ServerActionExecutor.java | 13 +-
.../ambari/server/state/ServiceComponent.java | 14 --
.../server/state/ServiceComponentImpl.java | 80 +-------
.../server/state/cluster/ClusterImpl.java | 36 ++--
.../services/AlertNoticeDispatchService.java | 17 +-
.../server/upgrade/UpgradeCatalog222.java | 5 -
.../server/upgrade/UpgradeCatalog240.java | 14 --
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 2 -
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 3 -
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 3 -
.../resources/Ambari-DDL-Postgres-CREATE.sql | 5 -
.../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 3 -
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 3 -
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 5 +-
.../src/main/resources/alert-templates.xml | 20 +-
.../0.8.1.2.2/configuration/kafka-broker.xml | 1 +
.../src/main/resources/properties.json | 1 -
.../main/resources/scripts/Ambaripreupload.py | 41 ++--
.../stacks/HDP/2.0.6/services/stack_advisor.py | 5 +-
.../stacks/HDP/2.2/services/stack_advisor.py | 17 +-
.../stacks/HDP/2.3/services/stack_advisor.py | 32 ++--
.../stacks/HDP/2.4/services/HIVE/metainfo.xml | 41 +---
.../actionmanager/TestActionScheduler.java | 24 +--
.../ambari/server/agent/AgentResourceTest.java | 2 -
.../server/configuration/ConfigurationTest.java | 95 ----------
.../AmbariManagementControllerTest.java | 3 -
.../server/controller/KerberosHelperTest.java | 2 -
.../internal/ComponentResourceProviderTest.java | 37 ++--
.../ambari/server/stack/StackManagerTest.java | 35 ++--
.../ambari/server/state/ConfigHelperTest.java | 2 -
.../server/upgrade/UpgradeCatalog222Test.java | 55 +-----
.../server/upgrade/UpgradeCatalog240Test.java | 12 --
.../ambari/server/utils/StageUtilsTest.java | 2 -
.../stacks/2.0.6/common/test_stack_advisor.py | 12 +-
.../stacks/2.2/common/test_stack_advisor.py | 14 +-
.../stacks/2.3/common/test_stack_advisor.py | 46 -----
ambari-web/app/assets/test/tests.js | 1 -
.../hawq/addStandby/step3_controller.js | 2 +-
.../app/mappers/components_state_mapper.js | 5 -
ambari-web/app/messages.js | 5 -
.../app/models/alerts/alert_definition.js | 4 +-
ambari-web/app/views.js | 1 -
.../configs/widgets/list_config_widget_view.js | 11 +-
ambari-web/app/views/main/dashboard/widgets.js | 19 +-
.../main/dashboard/widgets/hawqsegment_live.js | 190 -------------------
.../dashboard/widgets/hawqsegment_live_test.js | 69 -------
63 files changed, 222 insertions(+), 1270 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-common/src/main/python/resource_management/core/logger.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/logger.py b/ambari-common/src/main/python/resource_management/core/logger.py
index 5bbd35b..fd05b02 100644
--- a/ambari-common/src/main/python/resource_management/core/logger.py
+++ b/ambari-common/src/main/python/resource_management/core/logger.py
@@ -173,4 +173,4 @@ class Logger:
if arguments_str:
arguments_str = arguments_str[:-2]
- return unicode("{0} {{{1}}}", 'UTF-8').format(name, arguments_str)
\ No newline at end of file
+ return unicode("{0} {{{1}}}").format(name, arguments_str)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
index b2810b7..2854898 100644
--- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
+++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
@@ -28,12 +28,9 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -75,19 +72,17 @@ public abstract class AbstractTimelineMetricsSink {
protected void emitMetrics(TimelineMetrics metrics) {
String connectUrl = getCollectorUri();
int timeout = getTimeoutSeconds() * 1000;
- HttpURLConnection connection = null;
try {
if (connectUrl == null) {
throw new IOException("Unknown URL. " +
"Unable to connect to metrics collector.");
}
String jsonData = mapper.writeValueAsString(metrics);
- connection = connectUrl.startsWith("https") ?
+ HttpURLConnection connection = connectUrl.startsWith("https") ?
getSSLConnection(connectUrl) : getConnection(connectUrl);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
- connection.setRequestProperty("Connection", "Keep-Alive");
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
connection.setDoOutput(true);
@@ -108,52 +103,14 @@ public abstract class AbstractTimelineMetricsSink {
LOG.debug("Metrics posted to Collector " + connectUrl);
}
}
- cleanupInputStream(connection.getInputStream());
- } catch (IOException ioe) {
- StringBuilder errorMessage =
- new StringBuilder("Unable to connect to collector, " + connectUrl + "\n");
- try {
- if ((connection != null)) {
- errorMessage.append(cleanupInputStream(connection.getErrorStream()));
- }
- } catch (IOException e) {
- //NOP
- }
+ } catch (IOException e) {
if (LOG.isDebugEnabled()) {
- LOG.debug(errorMessage, ioe);
+ LOG.debug("Unable to connect to collector, " + connectUrl, e);
} else {
- LOG.info(errorMessage);
- }
- throw new UnableToConnectException(ioe).setConnectUrl(connectUrl);
- }
- }
-
- /**
- * Cleans up and closes an input stream
- * see http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html
- * @param is the InputStream to clean up
- * @return string read from the InputStream
- * @throws IOException
- */
- private String cleanupInputStream(InputStream is) throws IOException {
- StringBuilder sb = new StringBuilder();
- if (is != null) {
- try (
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr)
- ) {
- // read the response body
- String line;
- while ((line = br.readLine()) != null) {
- if (LOG.isDebugEnabled()) {
- sb.append(line);
- }
- }
- } finally {
- is.close();
+ LOG.info("Unable to connect to collector, " + connectUrl);
}
+ throw new UnableToConnectException(e).setConnectUrl(connectUrl);
}
- return sb.toString();
}
// Get a connection
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
index 1ca9c33..62a8cc3 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
@@ -55,8 +55,8 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
public class ApplicationHistoryServer extends CompositeService {
public static final int SHUTDOWN_HOOK_PRIORITY = 30;
- private static final Log LOG =
- LogFactory.getLog(ApplicationHistoryServer.class);
+ private static final Log LOG = LogFactory
+ .getLog(ApplicationHistoryServer.class);
ApplicationHistoryClientService ahsClientService;
ApplicationHistoryManager historyManager;
@@ -172,8 +172,6 @@ public class ApplicationHistoryServer extends CompositeService {
LOG.info("Instantiating AHSWebApp at " + bindAddress);
try {
Configuration conf = metricConfiguration.getMetricsConf();
- conf.set("hadoop.http.max.threads", String.valueOf(metricConfiguration
- .getTimelineMetricsServiceHandlerThreadCount()));
HttpConfig.Policy policy = HttpConfig.Policy.valueOf(
conf.get(TimelineMetricConfiguration.TIMELINE_SERVICE_HTTP_POLICY,
HttpConfig.Policy.HTTP_ONLY.name()));
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/RestMetricsSender.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/RestMetricsSender.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/RestMetricsSender.java
index 32af851..0a9a513 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/RestMetricsSender.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/RestMetricsSender.java
@@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.ProtocolException;
-import java.util.concurrent.TimeUnit;
/**
* Implements MetricsSender and provides a way of pushing metrics to application metrics history service using REST
@@ -66,8 +65,7 @@ public class RestMetricsSender implements MetricsSender {
responseString = svc.send(payload);
timer.stop();
- LOG.info("http response time: " + timer.elapsed(TimeUnit.MILLISECONDS)
- + " ms");
+ LOG.info("http response time: " + timer.elapsedMillis() + " ms");
if (responseString.length() > 0) {
LOG.debug("POST response from server: " + responseString);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryStoreTestUtils.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryStoreTestUtils.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryStoreTestUtils.java
index ec9b49d..c41b8a7 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryStoreTestUtils.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryStoreTestUtils.java
@@ -58,7 +58,7 @@ public class ApplicationHistoryStoreTestUtils {
ApplicationAttemptId appAttemptId) throws IOException {
store.applicationAttemptStarted(ApplicationAttemptStartData.newInstance(
appAttemptId, appAttemptId.toString(), 0,
- ContainerId.newContainerId(appAttemptId, 1)));
+ ContainerId.newInstance(appAttemptId, 1)));
}
protected void writeApplicationAttemptFinishData(
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
index f93ac5e..2fdedb2 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
@@ -168,7 +168,7 @@ public class TestApplicationHistoryClientService extends
writeApplicationStartData(appId);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
writeContainerStartData(containerId);
writeContainerFinishData(containerId);
writeApplicationFinishData(appId);
@@ -189,8 +189,8 @@ public class TestApplicationHistoryClientService extends
writeApplicationStartData(appId);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
- ContainerId containerId1 = ContainerId.newContainerId(appAttemptId, 2);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
+ ContainerId containerId1 = ContainerId.newInstance(appAttemptId, 2);
writeContainerStartData(containerId);
writeContainerFinishData(containerId);
writeContainerStartData(containerId1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
index 543c25b..bc16d36 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
@@ -94,7 +94,7 @@ public class TestFileSystemApplicationHistoryStore extends
}
// write container history data
for (int k = 1; k <= num; ++k) {
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, k);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
writeContainerStartData(containerId);
if (missingContainer && k == num) {
continue;
@@ -144,7 +144,7 @@ public class TestFileSystemApplicationHistoryStore extends
// read container history data
Assert.assertEquals(num, store.getContainers(appAttemptId).size());
for (int k = 1; k <= num; ++k) {
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, k);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
ContainerHistoryData containerData = store.getContainer(containerId);
Assert.assertNotNull(containerData);
Assert.assertEquals(Priority.newInstance(containerId.getId()),
@@ -159,7 +159,7 @@ public class TestFileSystemApplicationHistoryStore extends
ContainerHistoryData masterContainer =
store.getAMContainer(appAttemptId);
Assert.assertNotNull(masterContainer);
- Assert.assertEquals(ContainerId.newContainerId(appAttemptId, 1),
+ Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
masterContainer.getContainerId());
}
}
@@ -186,7 +186,7 @@ public class TestFileSystemApplicationHistoryStore extends
Assert.assertTrue(e.getMessage().contains("is not opened"));
}
// write container history data
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
try {
writeContainerStartData(containerId);
Assert.fail();
@@ -209,8 +209,8 @@ public class TestFileSystemApplicationHistoryStore extends
writeApplicationStartData(appId);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
- for (int i = 1; i <= 1000; ++i) {
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, i);
+ for (int i = 1; i <= 100000; ++i) {
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, i);
writeContainerStartData(containerId);
writeContainerFinishData(containerId);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
index b4da01a..fc5c096 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
@@ -137,7 +137,7 @@ public class TestMemoryApplicationHistoryStore extends
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
try {
writeContainerFinishData(containerId);
Assert.fail();
@@ -149,14 +149,14 @@ public class TestMemoryApplicationHistoryStore extends
writeApplicationAttemptStartData(appAttemptId);
int numContainers = 5;
for (int i = 1; i <= numContainers; ++i) {
- containerId = ContainerId.newContainerId(appAttemptId, i);
+ containerId = ContainerId.newInstance(appAttemptId, i);
writeContainerStartData(containerId);
writeContainerFinishData(containerId);
}
Assert
.assertEquals(numContainers, store.getContainers(appAttemptId).size());
for (int i = 1; i <= numContainers; ++i) {
- containerId = ContainerId.newContainerId(appAttemptId, i);
+ containerId = ContainerId.newInstance(appAttemptId, i);
ContainerHistoryData data = store.getContainer(containerId);
Assert.assertNotNull(data);
Assert.assertEquals(Priority.newInstance(containerId.getId()),
@@ -165,11 +165,11 @@ public class TestMemoryApplicationHistoryStore extends
}
ContainerHistoryData masterContainer = store.getAMContainer(appAttemptId);
Assert.assertNotNull(masterContainer);
- Assert.assertEquals(ContainerId.newContainerId(appAttemptId, 1),
+ Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
masterContainer.getContainerId());
writeApplicationAttemptFinishData(appAttemptId);
// Write again
- containerId = ContainerId.newContainerId(appAttemptId, 1);
+ containerId = ContainerId.newInstance(appAttemptId, 1);
try {
writeContainerStartData(containerId);
Assert.fail();
@@ -195,7 +195,7 @@ public class TestMemoryApplicationHistoryStore extends
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
for (int i = 1; i <= numContainers; ++i) {
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, i);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, i);
writeContainerStartData(containerId);
writeContainerFinishData(containerId);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
index 44b3f65..e78dfcc 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
@@ -269,7 +269,7 @@ public class TestAHSWebServices extends JerseyTest {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
+ ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
WebResource r = resource();
ClientResponse response =
r.path("ws").path("v1").path("applicationhistory").path("apps")
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 221b83d..eee4b61 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -184,9 +184,6 @@ public class Configuration {
public static final String LDAP_REFERRAL_KEY = "authentication.ldap.referral";
public static final String LDAP_PAGINATION_ENABLED_KEY = "authentication.ldap.pagination.enabled";
public static final String SERVER_EC_CACHE_SIZE = "server.ecCacheSize";
- public static final String SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED = "server.hrcStatusSummary.cache.enabled";
- public static final String SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE = "server.hrcStatusSummary.cache.size";
- public static final String SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION = "server.hrcStatusSummary.cache.expiryDuration";
public static final String SERVER_STALE_CONFIG_CACHE_ENABLED_KEY = "server.cache.isStale.enabled";
public static final String SERVER_PERSISTENCE_TYPE_KEY = "server.persistence.type";
public static final String SERVER_JDBC_USER_NAME_KEY = "server.jdbc.user.name";
@@ -281,9 +278,6 @@ public class Configuration {
public static final String TEMPORARY_KEYSTORE_ACTIVELY_PURGE = "security.temporary.keystore.actibely.purge";
public static final boolean TEMPORARY_KEYSTORE_ACTIVELY_PURGE_DEFAULT = true;
- // Alerts notifications properties
- public static final String AMBARI_DISPLAY_URL = "ambari.display.url";
-
/**
* Key for repo validation suffixes.
*/
@@ -370,11 +364,6 @@ public class Configuration {
public static final String CUSTOM_ACTION_DEFINITION_KEY = "custom.action.definitions";
public static final String SHARED_RESOURCES_DIR_KEY = "shared.resources.dir";
-
- protected static final boolean SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED_DEFAULT = true;
- protected static final long SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE_DEFAULT = 10000L;
- protected static final long SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_DEFAULT = 30; //minutes
-
private static final String CUSTOM_ACTION_DEFINITION_DEF_VALUE = "/var/lib/ambari-server/resources/custom_action_definitions";
private static final long SERVER_EC_CACHE_SIZE_DEFAULT = 10000L;
@@ -1785,75 +1774,6 @@ public class Configuration {
}
/**
- * Caching of host role command status summary can be enabled/disabled
- * through the {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED} config property.
- * This method returns the value of {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED}
- * config property. If this config property is not defined than returns the default defined by {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED_DEFAULT}.
- * @return true if caching is to be enabled otherwise false.
- */
- public boolean getHostRoleCommandStatusSummaryCacheEnabled() {
- String stringValue = properties.getProperty(SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED);
- boolean value = SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED_DEFAULT;
- if (stringValue != null) {
- try {
- value = Boolean.valueOf(stringValue);
- }
- catch (NumberFormatException ignored) {
- }
-
- }
-
- return value;
- }
-
- /**
- * In order to avoid the cache storing host role command status summary objects exhaust
- * memory we set a max record number allowed for the cache. This limit can be configured
- * through {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE} config property. The method returns
- * the value of this config property. If this config property is not defined than
- * the default value specified by {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE_DEFAULT} is returned.
- * @return the upper limit for the number of cached host role command summaries.
- */
- public long getHostRoleCommandStatusSummaryCacheSize() {
- String stringValue = properties.getProperty(SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE);
- long value = SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE_DEFAULT;
- if (stringValue != null) {
- try {
- value = Long.valueOf(stringValue);
- }
- catch (NumberFormatException ignored) {
- }
-
- }
-
- return value;
- }
-
- /**
- * As a safety measure the cache storing host role command status summaries should auto expire after a while.
- * The expiry duration is specified through the {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION} config property
- * expressed in minutes. The method returns the value of this config property. If this config property is not defined than
- * the default value specified by {@link #SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_DEFAULT}
- * @return the cache expiry duration in minutes
- */
- public long getHostRoleCommandStatusSummaryCacheExpiryDuration() {
- String stringValue = properties.getProperty(SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION);
- long value = SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_DEFAULT;
- if (stringValue != null) {
- try {
- value = Long.valueOf(stringValue);
- }
- catch (NumberFormatException ignored) {
- }
-
- }
-
- return value;
- }
-
-
-
- /**
* @return whether staleConfig's flag is cached.
*/
public boolean isStaleConfigCacheEnabled() {
@@ -2581,15 +2501,6 @@ public class Configuration {
}
/**
- * Get the ambari display URL
- * @return
- */
- public String getAmbariDisplayUrl() {
- return properties.getProperty(AMBARI_DISPLAY_URL, null);
- }
-
-
- /**
* @return number of retry attempts for api and blueprint operations
*/
public int getOperationsRetryAttempts() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index daca64d..76ff6db 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@ -65,7 +65,6 @@ import org.apache.ambari.server.notifications.NotificationDispatcher;
import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.DBAccessorImpl;
import org.apache.ambari.server.orm.PersistenceType;
-import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.scheduler.ExecutionScheduler;
import org.apache.ambari.server.scheduler.ExecutionSchedulerImpl;
import org.apache.ambari.server.security.AmbariEntryPoint;
@@ -339,21 +338,6 @@ public class ControllerModule extends AbstractModule {
bindConstant().annotatedWith(Names.named("executionCommandCacheSize")).
to(configuration.getExecutionCommandsCacheSize());
-
- // Host role commands status summary max cache enable/disable
- bindConstant().annotatedWith(Names.named(HostRoleCommandDAO.HRC_STATUS_SUMMARY_CACHE_ENABLED)).
- to(configuration.getHostRoleCommandStatusSummaryCacheEnabled());
-
- // Host role commands status summary max cache size
- bindConstant().annotatedWith(Names.named(HostRoleCommandDAO.HRC_STATUS_SUMMARY_CACHE_SIZE)).
- to(configuration.getHostRoleCommandStatusSummaryCacheSize());
- // Host role command status summary cache expiry duration in minutes
- bindConstant().annotatedWith(Names.named(HostRoleCommandDAO.HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_MINUTES)).
- to(configuration.getHostRoleCommandStatusSummaryCacheExpiryDuration());
-
-
-
-
bind(AmbariManagementController.class).to(
AmbariManagementControllerImpl.class);
bind(AbstractRootServiceResponseFactory.class).to(RootServiceResponseFactory.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
index ba0b84f..78b9897 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
@@ -31,28 +31,21 @@ public class ServiceComponentRequest {
private String componentCategory;
- private String recoveryEnabled; // CREATE/UPDATE
-
public ServiceComponentRequest(String clusterName, String serviceName,
String componentName, String desiredState) {
- this(clusterName, serviceName, componentName, desiredState, null, null);
- }
-
- public ServiceComponentRequest(String clusterName, String serviceName,
- String componentName, String desiredState,
- String recoveryEnabled) {
- this(clusterName, serviceName, componentName, desiredState, recoveryEnabled, null);
+ this.clusterName = clusterName;
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.desiredState = desiredState;
}
public ServiceComponentRequest(String clusterName,
String serviceName, String componentName,
- String desiredState, String recoveryEnabled,
- String componentCategory) {
+ String desiredState, String componentCategory) {
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
this.desiredState = desiredState;
- this.recoveryEnabled = recoveryEnabled;
this.componentCategory = componentCategory;
}
@@ -112,20 +105,6 @@ public class ServiceComponentRequest {
this.clusterName = clusterName;
}
- /**
- * @return recoveryEnabled
- */
- public String getRecoveryEnabled() {
- return recoveryEnabled;
- }
-
- /**
- * @param recoveryEnabled the recoveryEnabled value to set.
- */
- public void setRecoveryEnabled(String recoveryEnabled) {
- this.recoveryEnabled = recoveryEnabled;
- }
-
public String getComponentCategory() {
return componentCategory;
}
@@ -136,7 +115,7 @@ public class ServiceComponentRequest {
@Override
public String toString() {
- return String.format("[clusterName=%s, serviceName=%s, componentName=%s, desiredState=%s, recoveryEnabled=%s, componentCategory=%s]",
- clusterName, serviceName, clusterName, desiredState, recoveryEnabled, componentCategory);
+ return String.format("[clusterName=%s, serviceName=%s, componentName=%s, desiredState=%s, componentCategory=%s]",
+ clusterName, serviceName, clusterName, desiredState, componentCategory);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
index 381b114..f7dd301 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
@@ -41,8 +41,6 @@ public class ServiceComponentResponse {
private int installedCount;
- private boolean recoveryEnabled;
-
public ServiceComponentResponse(Long clusterId, String clusterName,
String serviceName,
String componentName,
@@ -50,8 +48,7 @@ public class ServiceComponentResponse {
String desiredState,
int totalCount,
int startedCount,
- int installedCount,
- boolean recoveryEnabled) {
+ int installedCount) {
super();
this.clusterId = clusterId;
this.clusterName = clusterName;
@@ -62,7 +59,6 @@ public class ServiceComponentResponse {
this.totalCount = totalCount;
this.startedCount = startedCount;
this.installedCount = installedCount;
- this.recoveryEnabled = recoveryEnabled;
}
/**
@@ -215,22 +211,6 @@ public class ServiceComponentResponse {
this.totalCount = totalCount;
}
- /**
- * Get a true or false value indicating if the service component is auto start enabled
- * @return true or false
- */
- public boolean isRecoveryEnabled() {
- return recoveryEnabled;
- }
-
- /**
- * Set a true or false value indicating whether the service component is auto start enabled
- * @param recoveryEnabled
- */
- public void setRecoveryEnabled(boolean recoveryEnabled) {
- this.recoveryEnabled = recoveryEnabled;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index b339adf..3ad6e64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -84,7 +84,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
protected static final String COMPONENT_TOTAL_COUNT_PROPERTY_ID = "ServiceComponentInfo/total_count";
protected static final String COMPONENT_STARTED_COUNT_PROPERTY_ID = "ServiceComponentInfo/started_count";
protected static final String COMPONENT_INSTALLED_COUNT_PROPERTY_ID = "ServiceComponentInfo/installed_count";
- protected static final String COMPONENT_RECOVERY_ENABLED_ID = "ServiceComponentInfo/recovery_enabled";
private static final String TRUE = "true";
@@ -179,7 +178,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
setResourceProperty(resource, COMPONENT_TOTAL_COUNT_PROPERTY_ID, response.getTotalCount(), requestedIds);
setResourceProperty(resource, COMPONENT_STARTED_COUNT_PROPERTY_ID, response.getStartedCount(), requestedIds);
setResourceProperty(resource, COMPONENT_INSTALLED_COUNT_PROPERTY_ID, response.getInstalledCount(), requestedIds);
- setResourceProperty(resource, COMPONENT_RECOVERY_ENABLED_ID, String.valueOf(response.isRecoveryEnabled()), requestedIds);
resources.add(resource);
}
@@ -253,7 +251,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
(String) properties.get(COMPONENT_SERVICE_NAME_PROPERTY_ID),
(String) properties.get(COMPONENT_COMPONENT_NAME_PROPERTY_ID),
(String) properties.get(COMPONENT_STATE_PROPERTY_ID),
- (String) properties.get(COMPONENT_RECOVERY_ENABLED_ID),
(String) properties.get(COMPONENT_CATEGORY_PROPERTY_ID));
}
@@ -466,9 +463,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
Map<String, Map<String, Set<String>>> componentNames = new HashMap<>();
Set<State> seenNewStates = new HashSet<>();
- Collection<ServiceComponent> recoveryEnabledComponents = new ArrayList<>();
- Collection<ServiceComponent> recoveryDisabledComponents = new ArrayList<>();
-
// Determine operation level
Resource.Type reqOpLvl;
if (requestProperties.containsKey(RequestOperationLevel.OPERATION_LEVEL_ID)) {
@@ -519,20 +513,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
continue;
}
- // Gather the components affected by the change in
- // auto start state
- if (!StringUtils.isEmpty(request.getRecoveryEnabled())) {
- boolean newRecoveryEnabled = Boolean.parseBoolean(request.getRecoveryEnabled());
- boolean oldRecoveryEnabled = sc.isRecoveryEnabled();
- if (newRecoveryEnabled != oldRecoveryEnabled) {
- if (newRecoveryEnabled) {
- recoveryEnabledComponents.add(sc);
- } else {
- recoveryDisabledComponents.add(sc);
- }
- }
- }
-
if (newState == null) {
debug("Nothing to do for new updateServiceComponent request, request ={}, newDesiredState=null" + request);
continue;
@@ -559,11 +539,9 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterId=" + cluster.getClusterId()
+ ", serviceName=" + sc.getServiceName()
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", currentDesiredState=" + oldScState
+ ", newDesiredState=" + newState);
}
-
if (!changedComps.containsKey(newState)) {
changedComps.put(newState, new ArrayList<ServiceComponent>());
}
@@ -571,7 +549,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", currentDesiredState=" + oldScState
+ ", newDesiredState=" + newState);
@@ -585,7 +562,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
@@ -598,7 +574,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
@@ -612,7 +587,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", hostname=" + sch.getHostName());
continue;
@@ -626,7 +600,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterId=" + cluster.getClusterId()
+ ", serviceName=" + sch.getServiceName()
+ ", componentName=" + sch.getServiceComponentName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
@@ -642,7 +615,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
- + ", recoveryEnabled=" + sc.isRecoveryEnabled()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
@@ -656,16 +628,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
// TODO additional validation?
- // Validations completed. Update the affected service components now.
-
- for (ServiceComponent sc : recoveryEnabledComponents) {
- sc.setRecoveryEnabled(true);
- }
-
- for (ServiceComponent sc : recoveryDisabledComponents) {
- sc.setRecoveryEnabled(false);
- }
-
Cluster cluster = clusters.getCluster(clusterNames.iterator().next());
return getManagementController().createAndPersistStages(cluster, requestProperties, null, null, changedComps, changedScHosts,
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index deca9b1..4fd03e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -18,6 +18,9 @@
package org.apache.ambari.server.orm.dao;
+import static org.apache.ambari.server.orm.DBAccessor.DbType.ORACLE;
+import static org.apache.ambari.server.orm.dao.DaoUtils.ORACLE_LIST_LIMIT;
+
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,7 +28,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
@@ -47,27 +49,16 @@ import org.apache.ambari.server.orm.entities.HostEntity;
import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
import org.apache.ambari.server.orm.entities.HostRoleCommandEntity_;
import org.apache.ambari.server.orm.entities.StageEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.google.inject.name.Named;
import com.google.inject.persist.Transactional;
-import static org.apache.ambari.server.orm.DBAccessor.DbType.ORACLE;
-import static org.apache.ambari.server.orm.dao.DaoUtils.ORACLE_LIST_LIMIT;
-
@Singleton
public class HostRoleCommandDAO {
- private static final Logger LOG = LoggerFactory.getLogger(HostRoleCommandDAO.class);
-
private static final String SUMMARY_DTO = String.format(
"SELECT NEW %s(" +
"MAX(hrc.stage.skippable), " +
@@ -101,122 +92,12 @@ public class HostRoleCommandDAO {
*/
private static final String COMPLETED_REQUESTS_SQL = "SELECT DISTINCT task.requestId FROM HostRoleCommandEntity task WHERE task.requestId NOT IN (SELECT task.requestId FROM HostRoleCommandEntity task WHERE task.status IN :notCompletedStatuses) ORDER BY task.requestId {0}";
- /**
- * A cache that holds {@link HostRoleCommandStatusSummaryDTO} grouped by stage id for requests by request id.
- * The JPQL computing the host role command status summary for a request is rather expensive
- * thus this cache helps reducing the load on the database
- */
- private final LoadingCache<Long, Map<Long, HostRoleCommandStatusSummaryDTO>> hrcStatusSummaryCache;
-
- /**
- * Specifies whether caching for {@link HostRoleCommandStatusSummaryDTO} grouped by stage id for requests
- * is enabled.
- */
- private final boolean hostRoleCommandStatusSummaryCacheEnabled;
-
-
@Inject
Provider<EntityManager> entityManagerProvider;
@Inject
DaoUtils daoUtils;
- public final static String HRC_STATUS_SUMMARY_CACHE_SIZE = "hostRoleCommandStatusSummaryCacheSize";
- public final static String HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_MINUTES = "hostRoleCommandStatusCacheExpiryDurationMins";
- public final static String HRC_STATUS_SUMMARY_CACHE_ENABLED = "hostRoleCommandStatusSummaryCacheEnabled";
-
- /**
- * Invalidates the host role command status summary cache entry that corresponds to the given request.
- * @param requestId the key of the cache entry to be invalidated.
- */
- protected void invalidateHostRoleCommandStatusSummaryCache(Long requestId) {
- if (!hostRoleCommandStatusSummaryCacheEnabled )
- return;
-
- LOG.debug("Invalidating host role command status summary cache for request {} !", requestId);
- hrcStatusSummaryCache.invalidate(requestId);
-
- }
-
- /**
- * Invalidates those entries in host role command status cache which are dependent on the passed {@link org.apache.ambari.server.orm.entities.HostRoleCommandEntity}
- * entity.
- * @param hostRoleCommandEntity
- */
- protected void invalidateHostRoleCommandStatusCache(HostRoleCommandEntity hostRoleCommandEntity) {
- if ( !hostRoleCommandStatusSummaryCacheEnabled )
- return;
-
- if (hostRoleCommandEntity != null) {
- Long requestId = hostRoleCommandEntity.getRequestId();
- if (requestId == null) {
- StageEntity stageEntity = hostRoleCommandEntity.getStage();
- if (stageEntity != null)
- requestId = stageEntity.getRequestId();
- }
-
- if (requestId != null)
- invalidateHostRoleCommandStatusSummaryCache(requestId.longValue());
- }
-
- }
-
- /**
- * Loads the counts of tasks for a request and groups them by stage id.
- * This allows for very efficient loading when there are a huge number of stages
- * and tasks to iterate (for example, during a Stack Upgrade).
- * @param requestId the request id
- * @return the map of stage-to-summary objects
- */
- @RequiresSession
- protected Map<Long, HostRoleCommandStatusSummaryDTO> loadAggregateCounts(Long requestId) {
-
- TypedQuery<HostRoleCommandStatusSummaryDTO> query = entityManagerProvider.get().createQuery(
- SUMMARY_DTO, HostRoleCommandStatusSummaryDTO.class);
-
- query.setParameter("requestId", requestId);
- query.setParameter("aborted", HostRoleStatus.ABORTED);
- query.setParameter("completed", HostRoleStatus.COMPLETED);
- query.setParameter("failed", HostRoleStatus.FAILED);
- query.setParameter("holding", HostRoleStatus.HOLDING);
- query.setParameter("holding_failed", HostRoleStatus.HOLDING_FAILED);
- query.setParameter("holding_timedout", HostRoleStatus.HOLDING_TIMEDOUT);
- query.setParameter("in_progress", HostRoleStatus.IN_PROGRESS);
- query.setParameter("pending", HostRoleStatus.PENDING);
- query.setParameter("queued", HostRoleStatus.QUEUED);
- query.setParameter("timedout", HostRoleStatus.TIMEDOUT);
- query.setParameter("skipped_failed", HostRoleStatus.SKIPPED_FAILED);
-
- Map<Long, HostRoleCommandStatusSummaryDTO> map = new HashMap<Long, HostRoleCommandStatusSummaryDTO>();
-
- for (HostRoleCommandStatusSummaryDTO dto : daoUtils.selectList(query)) {
- map.put(dto.getStageId(), dto);
- }
-
- return map;
- }
-
- @Inject
- public HostRoleCommandDAO(@Named(HRC_STATUS_SUMMARY_CACHE_ENABLED) boolean hostRoleCommandStatusSummaryCacheEnabled, @Named(HRC_STATUS_SUMMARY_CACHE_SIZE) long hostRoleCommandStatusSummaryCacheLimit, @Named(HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_MINUTES) long hostRoleCommandStatusSummaryCacheExpiryDurationMins) {
- this.hostRoleCommandStatusSummaryCacheEnabled = hostRoleCommandStatusSummaryCacheEnabled;
-
- LOG.info("Host role command status summary cache {} !", hostRoleCommandStatusSummaryCacheEnabled ? "enabled" : "disabled");
-
-
- hrcStatusSummaryCache = CacheBuilder.newBuilder()
- .maximumSize(hostRoleCommandStatusSummaryCacheLimit)
- .expireAfterAccess(hostRoleCommandStatusSummaryCacheExpiryDurationMins, TimeUnit.MINUTES)
- .build(new CacheLoader<Long, Map<Long, HostRoleCommandStatusSummaryDTO>>() {
- @Override
- public Map<Long, HostRoleCommandStatusSummaryDTO> load(Long requestId) throws Exception {
- LOG.debug("Cache miss for host role command status summary object for request {}, fetching from JPA", requestId);
- Map<Long, HostRoleCommandStatusSummaryDTO> hrcCommandStatusByStageId = loadAggregateCounts(requestId);
-
- return hrcCommandStatusByStageId;
- }
- });
- }
-
@RequiresSession
public HostRoleCommandEntity findByPK(long taskId) {
return entityManagerProvider.get().find(HostRoleCommandEntity.class, taskId);
@@ -544,16 +425,11 @@ public class HostRoleCommandDAO {
@Transactional
public void create(HostRoleCommandEntity stageEntity) {
entityManagerProvider.get().persist(stageEntity);
-
- invalidateHostRoleCommandStatusCache(stageEntity);
}
@Transactional
public HostRoleCommandEntity merge(HostRoleCommandEntity stageEntity) {
HostRoleCommandEntity entity = entityManagerProvider.get().merge(stageEntity);
-
- invalidateHostRoleCommandStatusCache(entity);
-
return entity;
}
@@ -570,8 +446,6 @@ public class HostRoleCommandDAO {
List<HostRoleCommandEntity> managedList = new ArrayList<HostRoleCommandEntity>(entities.size());
for (HostRoleCommandEntity entity : entities) {
managedList.add(entityManagerProvider.get().merge(entity));
-
- invalidateHostRoleCommandStatusCache(entity);
}
return managedList;
}
@@ -579,8 +453,6 @@ public class HostRoleCommandDAO {
@Transactional
public void remove(HostRoleCommandEntity stageEntity) {
entityManagerProvider.get().remove(merge(stageEntity));
-
- invalidateHostRoleCommandStatusCache(stageEntity);
}
@Transactional
@@ -591,16 +463,38 @@ public class HostRoleCommandDAO {
/**
* Finds the counts of tasks for a request and groups them by stage id.
+ * This allows for very efficient loading when there are a huge number of stages
+ * and tasks to iterate (for example, during a Stack Upgrade).
* @param requestId the request id
* @return the map of stage-to-summary objects
*/
+ @RequiresSession
public Map<Long, HostRoleCommandStatusSummaryDTO> findAggregateCounts(Long requestId) {
- if (hostRoleCommandStatusSummaryCacheEnabled)
- return hrcStatusSummaryCache.getUnchecked(requestId);
- else
- return loadAggregateCounts(requestId); // if caching not enabled fall back to fetching through JPA
- }
+ TypedQuery<HostRoleCommandStatusSummaryDTO> query = entityManagerProvider.get().createQuery(
+ SUMMARY_DTO, HostRoleCommandStatusSummaryDTO.class);
+
+ query.setParameter("requestId", requestId);
+ query.setParameter("aborted", HostRoleStatus.ABORTED);
+ query.setParameter("completed", HostRoleStatus.COMPLETED);
+ query.setParameter("failed", HostRoleStatus.FAILED);
+ query.setParameter("holding", HostRoleStatus.HOLDING);
+ query.setParameter("holding_failed", HostRoleStatus.HOLDING_FAILED);
+ query.setParameter("holding_timedout", HostRoleStatus.HOLDING_TIMEDOUT);
+ query.setParameter("in_progress", HostRoleStatus.IN_PROGRESS);
+ query.setParameter("pending", HostRoleStatus.PENDING);
+ query.setParameter("queued", HostRoleStatus.QUEUED);
+ query.setParameter("timedout", HostRoleStatus.TIMEDOUT);
+ query.setParameter("skipped_failed", HostRoleStatus.SKIPPED_FAILED);
+
+ Map<Long, HostRoleCommandStatusSummaryDTO> map = new HashMap<Long, HostRoleCommandStatusSummaryDTO>();
+
+ for (HostRoleCommandStatusSummaryDTO dto : daoUtils.selectList(query)) {
+ map.put(dto.getStageId(), dto);
+ }
+
+ return map;
+ }
/**
* Updates the {@link HostRoleCommandEntity#isFailureAutoSkipped()} flag for
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
index 1674175..af71c40 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
@@ -32,7 +32,6 @@ import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.Lob;
@@ -49,11 +48,7 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
import org.apache.commons.lang.ArrayUtils;
@Entity
-@Table(name = "host_role_command"
- , indexes = {
- @Index(name = "idx_hrc_request_id", columnList = "request_id")
- , @Index(name = "idx_hrc_status_role", columnList = "status, role")
- })
+@Table(name = "host_role_command")
@TableGenerator(name = "host_role_command_id_generator",
table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_value"
, pkColumnValue = "host_role_command_id_seq"
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
index 519e4e6..65cc107 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
@@ -81,9 +81,6 @@ public class ServiceComponentDesiredStateEntity {
@Enumerated(EnumType.STRING)
private State desiredState = State.INIT;
- @Column(name = "recovery_enabled", nullable = false, insertable = true, updatable = true)
- private Integer recoveryEnabled = 0;
-
/**
* Unidirectional one-to-one association to {@link StackEntity}
*/
@@ -183,14 +180,6 @@ public class ServiceComponentDesiredStateEntity {
return serviceComponentHistory;
}
- public boolean isRecoveryEnabled() {
- return recoveryEnabled != 0;
- }
-
- public void setRecoveryEnabled(boolean recoveryEnabled) {
- this.recoveryEnabled = (recoveryEnabled == false) ? 0 : 1;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
index f93cf43..20cf5bb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
@@ -392,8 +392,17 @@ public class ServerActionExecutor {
* @throws InterruptedException
*/
public void doWork() throws InterruptedException {
- List<HostRoleCommand> tasks = db.getTasksByRoleAndStatus(Role.AMBARI_SERVER_ACTION.name(),
- HostRoleStatus.QUEUED);
+ List<HostRoleCommand> tasks = db.getTasksByHostRoleAndStatus(serverHostName,
+ Role.AMBARI_SERVER_ACTION.toString(), HostRoleStatus.QUEUED);
+
+ if (null == tasks || tasks.isEmpty()) {
+ // !!! if the server is not a part of the cluster,
+ // !!! just look for anything designated AMBARI_SERVER_ACTION.
+ // !!! do we even need to worry about servername in the first place? We're
+ // !!! _on_ the ambari server!
+ tasks = db.getTasksByRoleAndStatus(Role.AMBARI_SERVER_ACTION.name(),
+ HostRoleStatus.QUEUED);
+ }
if ((tasks != null) && !tasks.isEmpty()) {
for (HostRoleCommand task : tasks) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
index dcb7cf6..7803045 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
@@ -28,20 +28,6 @@ public interface ServiceComponent {
String getName();
- /**
- * Get a true or false value specifying
- * if auto start was enabled for this component.
- * @return true or false
- */
- boolean isRecoveryEnabled();
-
- /**
- * Set a true or false value specifying if this
- * component is to be enabled for auto start or not.
- * @param recoveryEnabled - true or false
- */
- void setRecoveryEnabled(boolean recoveryEnabled);
-
String getServiceName();
long getClusterId();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index defe808..4afc857 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -95,7 +95,6 @@ public class ServiceComponentImpl implements ServiceComponent {
desiredStateEntity.setDesiredState(State.INIT);
desiredStateEntity.setServiceName(service.getName());
desiredStateEntity.setClusterId(service.getClusterId());
- desiredStateEntity.setRecoveryEnabled(false);
setDesiredStackVersion(service.getDesiredStackVersion());
@@ -182,55 +181,6 @@ public class ServiceComponentImpl implements ServiceComponent {
return componentName;
}
- /**
- * Get the recoveryEnabled value.
- *
- * @return true or false
- */
- @Override
- public boolean isRecoveryEnabled() {
- ServiceComponentDesiredStateEntity desiredStateEntity = getDesiredStateEntity();
- if (desiredStateEntity != null) {
- return desiredStateEntity.isRecoveryEnabled();
- } else {
- LOG.warn("Trying to fetch a member from an entity object that may " +
- "have been previously deleted, serviceName = " + service.getName() + ", " +
- "componentName = " + componentName);
- }
- return false;
- }
-
- /**
- * Set the recoveryEnabled field in the entity object.
- *
- * @param recoveryEnabled - true or false
- */
- @Override
- public void setRecoveryEnabled(boolean recoveryEnabled) {
- readWriteLock.writeLock().lock();
- try {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Setting RecoveryEnabled of Component" + ", clusterName="
- + service.getCluster().getClusterName() + ", clusterId="
- + service.getCluster().getClusterId() + ", serviceName="
- + service.getName() + ", componentName=" + getName()
- + ", oldRecoveryEnabled=" + isRecoveryEnabled() + ", newRecoveryEnabled="
- + recoveryEnabled);
- }
- ServiceComponentDesiredStateEntity desiredStateEntity = getDesiredStateEntity();
- if (desiredStateEntity != null) {
- desiredStateEntity.setRecoveryEnabled(recoveryEnabled);
- saveIfPersisted(desiredStateEntity);
- } else {
- LOG.warn("Setting a member on an entity object that may have been " +
- "previously deleted, serviceName = " + service.getName());
- }
-
- } finally {
- readWriteLock.writeLock().unlock();
- }
- }
-
@Override
public String getServiceName() {
return service.getName();
@@ -297,8 +247,7 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterId=" + service.getCluster().getClusterId()
+ ", serviceName=" + service.getName()
+ ", serviceComponentName=" + getName()
- + ", hostname=" + hostComponent.getHostName()
- + ", recoveryEnabled=" + isRecoveryEnabled());
+ + ", hostname=" + hostComponent.getHostName());
}
if (hostComponents.containsKey(hostComponent.getHostName())) {
throw new AmbariException("Cannot add duplicate ServiceComponentHost"
@@ -306,8 +255,7 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterId=" + service.getCluster().getClusterId()
+ ", serviceName=" + service.getName()
+ ", serviceComponentName=" + getName()
- + ", hostname=" + hostComponent.getHostName()
- + ", recoveryEnabled=" + isRecoveryEnabled());
+ + ", hostname=" + hostComponent.getHostName());
}
// FIXME need a better approach of caching components by host
ClusterImpl clusterImpl = (ClusterImpl) service.getCluster();
@@ -335,7 +283,6 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterId=" + service.getCluster().getClusterId()
+ ", serviceName=" + service.getName()
+ ", serviceComponentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + hostName);
}
if (hostComponents.containsKey(hostName)) {
@@ -344,7 +291,6 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterId=" + service.getCluster().getClusterId()
+ ", serviceName=" + service.getName()
+ ", serviceComponentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + hostName);
}
ServiceComponentHost hostComponent = serviceComponentHostFactory.createNew(this, hostName);
@@ -408,11 +354,11 @@ public class ServiceComponentImpl implements ServiceComponent {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Setting DesiredState of Service" + ", clusterName="
- + service.getCluster().getClusterName() + ", clusterId="
- + service.getCluster().getClusterId() + ", serviceName="
- + service.getName() + ", serviceComponentName=" + getName()
- + ", oldDesiredState=" + getDesiredState() + ", newDesiredState="
- + state);
+ + service.getCluster().getClusterName() + ", clusterId="
+ + service.getCluster().getClusterId() + ", serviceName="
+ + service.getName() + ", serviceComponentName=" + getName()
+ + ", oldDesiredState=" + getDesiredState() + ", newDesiredState="
+ + state);
}
ServiceComponentDesiredStateEntity desiredStateEntity = getDesiredStateEntity();
if (desiredStateEntity != null) {
@@ -482,8 +428,7 @@ public class ServiceComponentImpl implements ServiceComponent {
ServiceComponentResponse r = new ServiceComponentResponse(getClusterId(),
cluster.getClusterName(), service.getName(), getName(),
getDesiredStackVersion().getStackId(), getDesiredState().toString(),
- getTotalCount(), getStartedCount(), getInstalledCount(),
- isRecoveryEnabled());
+ getTotalCount(), getStartedCount(), getInstalledCount());
return r;
} finally {
readWriteLock.readLock().unlock();
@@ -495,13 +440,11 @@ public class ServiceComponentImpl implements ServiceComponent {
return service.getCluster().getClusterName();
}
-
@Override
public void debugDump(StringBuilder sb) {
readWriteLock.readLock().lock();
try {
sb.append("ServiceComponent={ serviceComponentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", clusterName=" + service.getCluster().getClusterName()
+ ", clusterId=" + service.getCluster().getClusterId()
+ ", serviceName=" + service.getName() + ", desiredStackVersion="
@@ -649,7 +592,6 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterName=" + getClusterName()
+ ", serviceName=" + getServiceName()
+ ", componentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + sch.getHostName());
return false;
}
@@ -673,8 +615,7 @@ public class ServiceComponentImpl implements ServiceComponent {
LOG.info("Deleting all servicecomponenthosts for component"
+ ", clusterName=" + getClusterName()
+ ", serviceName=" + getServiceName()
- + ", componentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled());
+ + ", componentName=" + getName());
for (ServiceComponentHost sch : hostComponents.values()) {
if (!sch.canBeRemoved()) {
throw new AmbariException("Found non removable hostcomponent "
@@ -683,7 +624,6 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterName=" + getClusterName()
+ ", serviceName=" + getServiceName()
+ ", componentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + sch.getHostName());
}
}
@@ -712,14 +652,12 @@ public class ServiceComponentImpl implements ServiceComponent {
+ ", clusterName=" + getClusterName()
+ ", serviceName=" + getServiceName()
+ ", componentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + sch.getHostName());
if (!sch.canBeRemoved()) {
throw new AmbariException("Could not delete hostcomponent from cluster"
+ ", clusterName=" + getClusterName()
+ ", serviceName=" + getServiceName()
+ ", componentName=" + getName()
- + ", recoveryEnabled=" + isRecoveryEnabled()
+ ", hostname=" + sch.getHostName());
}
sch.delete();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 07addfc..8230fe3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -2474,31 +2474,13 @@ public class ClusterImpl implements Cluster {
clusterGlobalLock.readLock().lock();
try {
List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<ServiceConfigVersionResponse>();
+ Set<Long> activeIds = getActiveServiceConfigVersionIds();
- List<ServiceConfigEntity> serviceConfigs = serviceConfigDAO.getServiceConfigs(getClusterId());
- Map<String, ServiceConfigVersionResponse> activeServiceConfigResponses = new HashMap<>();
-
- for (ServiceConfigEntity serviceConfigEntity : serviceConfigs) {
+ for (ServiceConfigEntity serviceConfigEntity : serviceConfigDAO.getServiceConfigs(getClusterId())) {
ServiceConfigVersionResponse serviceConfigVersionResponse = convertToServiceConfigVersionResponse(serviceConfigEntity);
- ServiceConfigVersionResponse activeServiceConfigResponse = activeServiceConfigResponses.get(serviceConfigVersionResponse.getServiceName());
- if (activeServiceConfigResponse == null) {
- activeServiceConfigResponse = serviceConfigVersionResponse;
- activeServiceConfigResponses.put(serviceConfigVersionResponse.getServiceName(), serviceConfigVersionResponse);
- }
-
serviceConfigVersionResponse.setConfigurations(new ArrayList<ConfigurationResponse>());
-
- if (serviceConfigEntity.getGroupId() == null) {
- if (serviceConfigVersionResponse.getCreateTime() > activeServiceConfigResponse.getCreateTime())
- activeServiceConfigResponses.put(serviceConfigVersionResponse.getServiceName(), serviceConfigVersionResponse);
- }
- else if (clusterConfigGroups != null && clusterConfigGroups.containsKey(serviceConfigEntity.getGroupId())){
- if (serviceConfigVersionResponse.getVersion() > activeServiceConfigResponse.getVersion())
- activeServiceConfigResponses.put(serviceConfigVersionResponse.getServiceName(), serviceConfigVersionResponse);
- }
-
- serviceConfigVersionResponse.setIsCurrent(false);
+ serviceConfigVersionResponse.setIsCurrent(activeIds.contains(serviceConfigEntity.getServiceConfigId()));
List<ClusterConfigEntity> clusterConfigEntities = serviceConfigEntity.getClusterConfigEntities();
for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
@@ -2514,10 +2496,6 @@ public class ClusterImpl implements Cluster {
serviceConfigVersionResponses.add(serviceConfigVersionResponse);
}
- for (ServiceConfigVersionResponse serviceConfigVersionResponse: activeServiceConfigResponses.values()) {
- serviceConfigVersionResponse.setIsCurrent(true);
- }
-
return serviceConfigVersionResponses;
} finally {
clusterGlobalLock.readLock().unlock();
@@ -2536,6 +2514,14 @@ public class ClusterImpl implements Cluster {
return responses;
}
+ private Set<Long> getActiveServiceConfigVersionIds() {
+ Set<Long> idSet = new HashSet<Long>();
+ for (ServiceConfigEntity entity : getActiveServiceConfigVersionEntities()) {
+ idSet.add(entity.getServiceConfigId());
+ }
+ return idSet;
+ }
+
private List<ServiceConfigEntity> getActiveServiceConfigVersionEntities() {
List<ServiceConfigEntity> activeServiceConfigVersions = new ArrayList<ServiceConfigEntity>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java
index 0b84568..a27bc1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java
@@ -451,7 +451,7 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
String targetType = target.getNotificationType();
// build the velocity objects for template rendering
- AmbariInfo ambari = new AmbariInfo(m_metaInfo.get(), m_configuration);
+ AmbariInfo ambari = new AmbariInfo(m_metaInfo.get());
AlertSummaryInfo summary = new AlertSummaryInfo(histories);
DispatchInfo dispatch = new DispatchInfo(target);
@@ -516,7 +516,7 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
String targetType = target.getNotificationType();
// build the velocity objects for template rendering
- AmbariInfo ambari = new AmbariInfo(m_metaInfo.get(), m_configuration);
+ AmbariInfo ambari = new AmbariInfo(m_metaInfo.get());
AlertInfo alert = new AlertInfo(history);
DispatchInfo dispatch = new DispatchInfo(target);
@@ -558,10 +558,6 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
bodyWriter.write(alert.getAlertName());
bodyWriter.write(" ");
bodyWriter.write(alert.getAlertText());
- if (alert.hasHostName()) {
- bodyWriter.write(" ");
- bodyWriter.append(alert.getHostName());
- }
bodyWriter.write("\n");
}
}
@@ -1046,8 +1042,7 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
*
* @param metaInfo
*/
- protected AmbariInfo(AmbariMetaInfo metaInfo, Configuration m_configuration) {
- m_url = m_configuration.getAmbariDisplayUrl();
+ protected AmbariInfo(AmbariMetaInfo metaInfo) {
m_version = metaInfo.getServerVersion();
}
@@ -1058,10 +1053,6 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
return m_hostName;
}
- public boolean hasUrl() {
- return m_url != null;
- }
-
/**
* @return the url
*/
@@ -1202,4 +1193,4 @@ public class AlertNoticeDispatchService extends AbstractScheduledService {
return m_body;
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
index 0aa1e7a..88b3151 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
@@ -115,7 +115,6 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
updateAlerts();
updateStormConfigs();
updateAMSConfigs();
- updateHostRoleCommands();
}
protected void updateStormConfigs() throws AmbariException {
@@ -154,10 +153,6 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
}
- protected void updateHostRoleCommands() throws SQLException{
- dbAccessor.createIndex("idx_hrc_status", "host_role_command", "status", "role");
- }
-
protected void updateAMSConfigs() throws AmbariException {
AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
Clusters clusters = ambariManagementController.getClusters();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index 4e99c89..09f31e4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
import org.apache.ambari.server.orm.dao.DaoUtils;
@@ -90,8 +89,6 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
private static final String ID = "id";
private static final String SETTING_TABLE = "setting";
- protected static final String SERVICE_COMPONENT_DESIRED_STATE_TABLE = "servicecomponentdesiredstate";
- protected static final String RECOVERY_ENABLED_COL = "recovery_enabled";
// ----- Constructors ------------------------------------------------------
@@ -130,7 +127,6 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
@Override
protected void executeDDLUpdates() throws AmbariException, SQLException {
updateAdminPermissionTable();
- updateServiceComponentDesiredStateTable();
createSettingTable();
updateRepoVersionTableDDL();
updateServiceComponentDesiredStateTableDDL();
@@ -566,14 +562,4 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
addSequence("servicecomponent_history_id_seq", 0L, false);
}
- /**
- * Alter servicecomponentdesiredstate table to add recovery_enabled column.
- * @throws SQLException
- */
- private void updateServiceComponentDesiredStateTable() throws SQLException {
- // ALTER TABLE servicecomponentdesiredstate ADD COLUMN
- // recovery_enabled SMALLINT DEFAULT 0 NOT NULL
- dbAccessor.addColumn(SERVICE_COMPONENT_DESIRED_STATE_TABLE,
- new DBAccessor.DBColumnInfo(RECOVERY_ENABLED_COL, Short.class, null, 0, false));
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/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 73cf84e..2db745b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -177,10 +177,8 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
- recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
- PRIMARY KEY (component_name, cluster_id, service_name)
);
CREATE TABLE servicedesiredstate (
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/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 9353ac2..b892bc8 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -178,10 +178,8 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(100) NOT NULL,
- recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
- PRIMARY KEY (component_name, cluster_id, service_name)
);
CREATE TABLE servicedesiredstate (
@@ -685,7 +683,6 @@ CREATE TABLE setting (
-- tasks indices --
CREATE INDEX idx_stage_request_id ON stage (request_id);
CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
-CREATE INDEX idx_hrc_status_role ON host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
-- altering tables by creating unique constraints----------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/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 5f39b44..026efea 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -168,10 +168,8 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id NUMBER(19) NOT NULL,
desired_state VARCHAR2(255) NOT NULL,
service_name VARCHAR2(255) NOT NULL,
- recovery_enabled SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
- PRIMARY KEY (component_name, cluster_id, service_name)
);
CREATE TABLE servicedesiredstate (
@@ -674,7 +672,6 @@ CREATE TABLE setting (
-- tasks indices --
CREATE INDEX idx_stage_request_id ON stage (request_id);
CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
-CREATE INDEX idx_hrc_status_role ON host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
--------altering tables by creating unique constraints----------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3839c7/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 4a8fa2a..fb9889d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -177,10 +177,8 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
- recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
- PRIMARY KEY (component_name, cluster_id, service_name)
);
CREATE TABLE servicedesiredstate (
@@ -678,11 +676,8 @@ CREATE TABLE setting (
-- tasks indices --
CREATE INDEX idx_stage_request_id ON stage (request_id);
CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
-CREATE INDEX idx_hrc_status_role ON host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
-
-
--------altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag);