[ambari] branch trunk updated: [AMBARI-23057] Upgrade fails because of Stale alert definitions (ap… (#2884)

2019-04-03 Thread swagle
This is an automated email from the ASF dual-hosted git repository.

swagle pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 604c82e  [AMBARI-23057] Upgrade fails because of Stale alert 
definitions (ap… (#2884)
604c82e is described below

commit 604c82e3cd49e71643a870dd9ca77576cc2268c9
Author: amarnathreddy pappu 
AuthorDate: Wed Apr 3 10:51:08 2019 -0700

[AMBARI-23057] Upgrade fails because of Stale alert definitions (ap… (#2884)
---
 .../checks/DatabaseConsistencyCheckHelper.java | 105 -
 .../checks/DatabaseConsistencyCheckHelperTest.java |  49 ++
 2 files changed, 153 insertions(+), 1 deletion(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 7f52b66..3d8b4e9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -48,6 +48,7 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.ExecutionCommandDAO;
 import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
@@ -55,6 +56,7 @@ import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.dao.StageDAO;
+import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
 import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
@@ -91,6 +93,7 @@ public class DatabaseConsistencyCheckHelper {
   private static Injector injector;
 
   private static MetainfoDAO metainfoDAO;
+  private static AlertDefinitionDAO alertDefinitionDAO;
   private static Connection connection;
   private static AmbariMetaInfo ambariMetaInfo;
   private static DBAccessor dbAccessor;
@@ -158,6 +161,7 @@ public class DatabaseConsistencyCheckHelper {
 closeConnection();
 connection = null;
 metainfoDAO = null;
+alertDefinitionDAO = null;
 ambariMetaInfo = null;
 dbAccessor = null;
   }
@@ -189,6 +193,7 @@ public class DatabaseConsistencyCheckHelper {
 fixConfigGroupHostMappings();
 fixConfigGroupsForDeletedServices();
 fixConfigsSelectedMoreThanOnce();
+fixAlertsForDeletedServices();
   }
   checkSchemaName();
   checkMySQLEngine();
@@ -201,6 +206,7 @@ public class DatabaseConsistencyCheckHelper {
   checkConfigGroupsHasServiceName();
   checkConfigGroupHostMapping(true);
   checkConfigGroupsForDeletedServices(true);
+  checkForStalealertdefs();
   LOG.info("*** Check database completed 
***");
   return checkResult;
 }
@@ -216,7 +222,9 @@ public class DatabaseConsistencyCheckHelper {
 if (metainfoDAO == null) {
   metainfoDAO = injector.getInstance(MetainfoDAO.class);
 }
-
+if (alertDefinitionDAO == null) {
+  alertDefinitionDAO = injector.getInstance(AlertDefinitionDAO.class);
+}
 MetainfoEntity schemaVersionEntity = 
metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY);
 String schemaVersion = null;
 
@@ -807,6 +815,52 @@ public class DatabaseConsistencyCheckHelper {
   }
 
   /**
+   * This method checks for stale alert definitions..
+   * */
+  static Map  checkForStalealertdefs () {
+Configuration conf = injector.getInstance(Configuration.class);
+Map alertInfo = new HashMap<>();
+LOG.info("Checking to ensure there is no stale alert definitions");
+
+ensureConnection();
+
+String STALE_ALERT_DEFINITIONS = "select definition_name, service_name 
from alert_definition where service_name not in " +
+"(select service_name from clusterservices) and service_name not 
in ('AMBARI')";
+
+ResultSet rs = null;
+Statement statement;
+
+try {
+  statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, 
ResultSet.CONCUR_UPDATABLE);
+  rs = statement.executeQuery(STALE_ALERT_DEFINITIONS);
+  if (rs != null) {
+while (rs.next()) {
+  
alertInfo.put(rs.getString("definition_name"),rs.getString("service_name"));
+}
+if (!alertInfo.isEmpty()){
+  String alertInfoStr = "";
+  for 

[ambari] branch trunk updated: [AMBARI-25202] recoverHost operation fails if public hostname is different from actual hostname (apappu)

2019-04-03 Thread ishanbha
This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 1b3fa75  [AMBARI-25202] recoverHost operation fails if public hostname 
is different from actual hostname (apappu)
1b3fa75 is described below

commit 1b3fa75130c8a85a652ca69c5df4a850f0ca65b4
Author: AMARNATH REDDY 
AuthorDate: Tue Mar 19 13:26:50 2019 -0700

[AMBARI-25202] recoverHost operation fails if public hostname is different 
from actual hostname (apappu)
---
 ambari-web/app/controllers/main/host/details.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ambari-web/app/controllers/main/host/details.js 
b/ambari-web/app/controllers/main/host/details.js
index 46d9229..45cd669 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -3107,7 +3107,7 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
   
   recoverHost: function() {
 var components = this.get('content.hostComponents');
-var hostName = this.get('content.publicHostName');
+var hostName = this.get('content.hostName');
 var self = this;
 var batches = [
   {



[ambari] branch branch-2.7 updated: AMBARI-25167 HDFS Summary Dashboard does not show "TOTAL FILES + DIRECTORIES" properly In Ambari 2.7 (asnaik) (#2841)

2019-04-03 Thread asnaik
This is an automated email from the ASF dual-hosted git repository.

asnaik pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 1fd139a  AMBARI-25167 HDFS Summary Dashboard does not show "TOTAL 
FILES + DIRECTORIES" properly In Ambari 2.7 (asnaik) (#2841)
1fd139a is described below

commit 1fd139aae2b9cbbf8bceb2a56accd2f7567d487f
Author: Akhil S Naik 
AuthorDate: Wed Apr 3 22:24:35 2019 +0530

AMBARI-25167 HDFS Summary Dashboard does not show "TOTAL FILES + 
DIRECTORIES" properly In Ambari 2.7 (asnaik) (#2841)
---
 ambari-web/app/mappers/service_metrics_mapper.js   | 2 +-
 ambari-web/app/views/main/service/info/summary/hdfs/widgets.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ambari-web/app/mappers/service_metrics_mapper.js 
b/ambari-web/app/mappers/service_metrics_mapper.js
index f2c1a02..0d23ce2 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -81,7 +81,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
 dfs_corrupt_blocks_values: 'metrics.dfs.FSNamesystem.CorruptBlocks',
 dfs_missing_blocks_values: 'metrics.dfs.FSNamesystem.MissingBlocks',
 dfs_under_replicated_blocks_values: 
'metrics.dfs.FSNamesystem.UnderReplicatedBlocks',
-dfs_total_files_values: 'metrics.dfs.namenode.TotalFiles',
+dfs_total_files_values: 'metrics.dfs.FSNamesystem.FilesTotal',
 work_status_values: 'HostRoles.state',
 upgrade_status_values: 'metrics.dfs.namenode.UpgradeFinalized',
 safe_mode_status_values: 'metrics.dfs.namenode.Safemode',
diff --git a/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js 
b/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
index e6b4e53..ba92326 100644
--- a/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
+++ b/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
@@ -77,7 +77,7 @@ App.HDFSSummaryWidgetsView = 
Em.View.extend(App.NameNodeWidgetMixin, App.HDFSSum
 
   dfsTotalFilesValue: Em.computed.getByKey('model.dfsTotalFilesValues', 
'hostName'),
 
-  dfsTotalFiles: Em.computed.formatUnavailable('model.dfsTotalFilesValue'),
+  dfsTotalFiles: Em.computed.formatUnavailable('dfsTotalFilesValue'),
 
   healthStatus: Em.computed.getByKey('model.healthStatusValues', 'hostName'),
 



[ambari] branch branch-2.7 updated: [AMBARI-23057] Upgrade fails because of Stale alert definitions (apappu) (#2885)

2019-04-03 Thread swagle
This is an automated email from the ASF dual-hosted git repository.

swagle pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new ef51fd9  [AMBARI-23057] Upgrade fails because of Stale alert 
definitions (apappu) (#2885)
ef51fd9 is described below

commit ef51fd9e8ec8f7bb90687ff7abb04d233504e191
Author: amarnathreddy pappu 
AuthorDate: Wed Apr 3 10:47:25 2019 -0700

[AMBARI-23057] Upgrade fails because of Stale alert definitions (apappu) 
(#2885)
---
 .../checks/DatabaseConsistencyCheckHelper.java | 108 -
 .../checks/DatabaseConsistencyCheckHelperTest.java |  49 ++
 2 files changed, 155 insertions(+), 2 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 375bcd9..e2e8b0b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -48,6 +48,7 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.ExecutionCommandDAO;
 import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
@@ -55,6 +56,7 @@ import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.dao.StageDAO;
+import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
 import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
@@ -93,6 +95,7 @@ public class DatabaseConsistencyCheckHelper {
   private static Injector injector;
 
   private static MetainfoDAO metainfoDAO;
+  private static AlertDefinitionDAO alertDefinitionDAO;
   private static Connection connection;
   private static AmbariMetaInfo ambariMetaInfo;
   private static DBAccessor dbAccessor;
@@ -160,6 +163,7 @@ public class DatabaseConsistencyCheckHelper {
 closeConnection();
 connection = null;
 metainfoDAO = null;
+alertDefinitionDAO = null;
 ambariMetaInfo = null;
 dbAccessor = null;
   }
@@ -191,6 +195,7 @@ public class DatabaseConsistencyCheckHelper {
 fixConfigGroupHostMappings();
 fixConfigGroupsForDeletedServices();
 fixConfigsSelectedMoreThanOnce();
+fixAlertsForDeletedServices();
   }
   checkSchemaName();
   checkMySQLEngine();
@@ -203,6 +208,7 @@ public class DatabaseConsistencyCheckHelper {
   checkConfigGroupsHasServiceName();
   checkConfigGroupHostMapping(true);
   checkConfigGroupsForDeletedServices(true);
+  checkForStalealertdefs();
   LOG.info("*** Check database completed 
***");
   return checkResult;
 }
@@ -218,7 +224,9 @@ public class DatabaseConsistencyCheckHelper {
 if (metainfoDAO == null) {
   metainfoDAO = injector.getInstance(MetainfoDAO.class);
 }
-
+if (alertDefinitionDAO == null) {
+  alertDefinitionDAO = injector.getInstance(AlertDefinitionDAO.class);
+}
 MetainfoEntity schemaVersionEntity = 
metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY);
 String schemaVersion = null;
 
@@ -810,7 +818,54 @@ public class DatabaseConsistencyCheckHelper {
 }
   }
 
-  /**
+
+   /**
+   * This method checks for stale alert definitions..
+   * */
+  static Map  checkForStalealertdefs () {
+Configuration conf = injector.getInstance(Configuration.class);
+Map alertInfo = new HashMap<>();
+LOG.info("Checking to ensure there is no stale alert definitions");
+
+ensureConnection();
+
+String STALE_ALERT_DEFINITIONS = "select definition_name, service_name 
from alert_definition where service_name not in " +
+"(select service_name from clusterservices) and service_name not 
in ('AMBARI')";
+
+ResultSet rs = null;
+Statement statement;
+
+try {
+  statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, 
ResultSet.CONCUR_UPDATABLE);
+  rs = statement.executeQuery(STALE_ALERT_DEFINITIONS);
+  if (rs != null) {
+while (rs.next()) {
+  
alertInfo.put(rs.getString("definition_name"),rs.getString("service_name"));
+}
+if (!alertInfo.isEmpty()){
+  

[ambari] branch branch-2.7 updated: AMBARI-25034 Ambari is not updating core-site : ha.zookeeper.quorumonce a zookeeper server is added or removed (asnaik) (#2910)

2019-04-03 Thread asnaik
This is an automated email from the ASF dual-hosted git repository.

asnaik pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new c94263b  AMBARI-25034 Ambari is not updating core-site : 
ha.zookeeper.quorumonce a zookeeper server is added or removed (asnaik) (#2910)
c94263b is described below

commit c94263bedd2f3c53547632f3cc2989847aecb841
Author: Akhil S Naik 
AuthorDate: Thu Apr 4 09:33:57 2019 +0530

AMBARI-25034 Ambari is not updating core-site : ha.zookeeper.quorumonce a 
zookeeper server is added or removed (asnaik) (#2910)
---
 ambari-web/app/controllers/main/host/details.js | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/ambari-web/app/controllers/main/host/details.js 
b/ambari-web/app/controllers/main/host/details.js
index 5f99ceb..4682dc4b 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1735,10 +1735,15 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
   constructZookeeperConfigUrlParams: function (data) {
 var urlParams = [];
 var services = App.Service.find();
+var zooKeeperRelatedServices = 
this.get('zooKeeperRelatedServices').slice(0);
 if (App.get('isHaEnabled')) {
-  urlParams.push('(type=core-site=' + 
data.Clusters.desired_configs['core-site'].tag + ')');
+  zooKeeperRelatedServices.push({
+serviceName: 'HDFS',
+typesToLoad: ['core-site'],
+typesToSave: ['core-site']
+  });
 }
-this.get('zooKeeperRelatedServices').forEach(function (service) {
+zooKeeperRelatedServices.forEach(function (service) {
   if (services.someProperty('serviceName', service.serviceName)) {
 service.typesToLoad.forEach(function (type) {
   if (data.Clusters.desired_configs[type]) {
@@ -1767,7 +1772,15 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
 this.updateZkConfigs(configs);
 var groups = [];
 var installedServiceNames = App.Service.find().mapProperty('serviceName');
-this.get('zooKeeperRelatedServices').forEach(function (service) {
+var zooKeeperRelatedServices = 
this.get('zooKeeperRelatedServices').slice(0);
+if (App.get('isHaEnabled')) {
+  zooKeeperRelatedServices.push({
+serviceName: 'HDFS',
+typesToLoad: ['core-site'],
+typesToSave: ['core-site']
+  });
+}
+zooKeeperRelatedServices.forEach(function (service) {
   if (installedServiceNames.contains(service.serviceName)) {
 var group = {
   properties: {},



[ambari] branch branch-2.7 updated: AMBARI-25069 - Ambari wrties Empty baseurl values written to Repo Files when using a local repository causing stack installation failure (#2837)

2019-04-03 Thread asnaik
This is an automated email from the ASF dual-hosted git repository.

asnaik pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 73ab2bc  AMBARI-25069 - Ambari wrties Empty baseurl values written to 
Repo Files when using a local repository causing stack installation failure 
(#2837)
73ab2bc is described below

commit 73ab2bc3dda7b691867a9cf6e18693157e8a241b
Author: Akhil S Naik 
AuthorDate: Thu Apr 4 08:15:09 2019 +0530

AMBARI-25069 - Ambari wrties Empty baseurl values written to Repo Files 
when using a local repository causing stack installation failure (#2837)

* AMBARI-25069 - Ambari wrties Empty baseurl values written to Repo Files 
when using a local repository causing stack installation failure

* AMBARI-25069 - Ambari wrties Empty baseurl values written to Repo Files 
when using a local repository causing stack installation failure (asnaik)
---
 ambari-web/app/controllers/wizard/step1_controller.js | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ambari-web/app/controllers/wizard/step1_controller.js 
b/ambari-web/app/controllers/wizard/step1_controller.js
index d731a43..9d5db2a 100644
--- a/ambari-web/app/controllers/wizard/step1_controller.js
+++ b/ambari-web/app/controllers/wizard/step1_controller.js
@@ -194,11 +194,13 @@ App.WizardStep1Controller = Em.Controller.extend({
   onNetworkIssuesExist: function() {
 if (this.get('networkIssuesExist')) {
   this.get('content.stacks').forEach(function (stack) {
-stack.setProperties({
-  usePublicRepo: false,
-  useLocalRepo: true
-});
-stack.cleanReposBaseUrls();
+   if(stack.get('useLocalRepo') !== true){
+  stack.setProperties({
+usePublicRepo: false,
+useLocalRepo: true
+  });
+  stack.cleanReposBaseUrls();
+}
   });
 }
   }.observes('networkIssuesExist'),