You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/03/28 23:33:29 UTC

ambari git commit: AMBARI-15601: HA Namenode Move failed on Delete disabled NameNode+ZKFC stage (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk ea894ef80 -> be444cc14


AMBARI-15601: HA Namenode Move failed on Delete disabled NameNode+ZKFC stage (akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/be444cc1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/be444cc1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/be444cc1

Branch: refs/heads/trunk
Commit: be444cc145edd6f58d5e43c28fbfef3bffb06e98
Parents: ea894ef
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Mar 28 19:47:27 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Mar 29 00:32:10 2016 +0300

----------------------------------------------------------------------
 .../highAvailability/progress_controller.js     |  1 -
 .../main/service/reassign/step6_controller.js   | 28 ++++++++++++++++----
 .../main/service/reassign_controller.js         | 14 +++++++++-
 ambari-web/app/messages.js                      |  1 +
 .../wizard/wizardProgressPageController.js      | 26 ++++++++++++++++++
 ambari-web/app/routes/reassign_master_routes.js | 11 ++++++++
 .../service/reassign/step6_controller_test.js   | 15 +++--------
 7 files changed, 78 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 52d7ca5..5e22b41 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var installedComponents = [];
 
 App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardController.extend(App.wizardProgressPageControllerMixin, {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/controllers/main/service/reassign/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step6_controller.js b/ambari-web/app/controllers/main/service/reassign/step6_controller.js
index 9512208..5eb8051 100644
--- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step6_controller.js
@@ -22,7 +22,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
 
   name: "reassignMasterWizardStep6Controller",
 
-  commands: ['stopMysqlService', 'putHostComponentsInMaintenanceMode', 'deleteHostComponents', 'startAllServices'],
+  commands: ['stopMysqlService', 'putHostComponentsInMaintenanceMode', 'stopHostComponentsInMaintenanceMode', 'deleteHostComponents', 'startAllServices'],
 
   clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
 
@@ -72,6 +72,9 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
     if ( this.get('content.reassign.component_name') !== 'MYSQL_SERVER' ) {
       this.removeTasks(['putHostComponentsInMaintenanceMode', 'stopMysqlService']);
     }
+    if (!this.get('content.reassignComponentsInMM.length')) {
+      this.removeTasks(['stopHostComponentsInMaintenanceMode']);
+    }
   },
 
   /**
@@ -101,8 +104,8 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
   }.observes('tasks.@each.showRollback'),
 
   onComponentsTasksSuccess: function () {
-    this.set('multiTaskCounter', this.get('multiTaskCounter') + 1);
-    if (this.get('multiTaskCounter') >= this.get('hostComponents').length) {
+    this.decrementProperty('multiTaskCounter');
+    if (this.get('multiTaskCounter') <= 0) {
       this.onTaskCompleted();
     }
   },
@@ -112,9 +115,9 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
   },
 
   deleteHostComponents: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.source');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       App.ajax.send({
         name: 'common.delete.host_component',
@@ -138,9 +141,9 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
   },
 
   putHostComponentsInMaintenanceMode: function () {
-    this.set('multiTaskCounter', 0);
     var hostComponents = this.get('hostComponents');
     var hostName = this.get('content.reassignHosts.source');
+    this.set('multiTaskCounter', hostComponents.length);
     for (var i = 0; i < hostComponents.length; i++) {
       App.ajax.send({
         name: 'common.host.host_component.passive',
@@ -156,6 +159,21 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
     }
   },
 
+  stopHostComponentsInMaintenanceMode: function () {
+    var hostComponentsInMM = this.get('content.reassignComponentsInMM');
+    var hostName = this.get('content.reassignHosts.source');
+    var serviceName = this.get('content.reassign.service_id');
+    hostComponentsInMM = hostComponentsInMM.map(function(componentName){
+      return {
+        hostName: hostName,
+        serviceName: serviceName,
+        componentName: componentName
+      };
+    });
+    this.set('multiTaskCounter', hostComponentsInMM.length);
+    this.updateComponentsState(hostComponentsInMM, 'INSTALLED');
+  },
+
   /**
    * make server call to stop services
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/controllers/main/service/reassign_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js
index 3c1d5e0..9dcf778 100644
--- a/ambari-web/app/controllers/main/service/reassign_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign_controller.js
@@ -64,7 +64,8 @@ App.ReassignMasterController = App.WizardController.extend({
     hasManualSteps: false,
     hasCheckDBStep: false,
     componentsWithCheckDBStep: ['HIVE_METASTORE', 'HIVE_SERVER', 'OOZIE_SERVER'],
-    componentsWithoutSecurityConfigs: ['MYSQL_SERVER']
+    componentsWithoutSecurityConfigs: ['MYSQL_SERVER'],
+    reassignComponentsInMM: []
   }),
 
   /**
@@ -245,6 +246,16 @@ App.ReassignMasterController = App.WizardController.extend({
     }
   },
 
+  loadReassignComponentsInMM: function () {
+    var reassignComponentsInMM = this.getDBProperty('reassignComponentsInMM');
+    this.set('content.reassignComponentsInMM', reassignComponentsInMM);
+  },
+
+  saveReassignComponentsInMM: function (reassignComponentsInMM) {
+    this.setDBProperty('reassignComponentsInMM', reassignComponentsInMM);
+    this.set('content.reassignComponentsInMM', reassignComponentsInMM);
+  },
+
   /**
    * Load data for all steps until <code>current step</code>
    */
@@ -253,6 +264,7 @@ App.ReassignMasterController = App.WizardController.extend({
     switch (step) {
       case '7':
       case '6':
+        this.loadReassignComponentsInMM();
       case '5':
         this.loadSecureConfigs();
         this.loadComponentDir();

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index ea06bf3..5343bf1 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2165,6 +2165,7 @@ Em.I18n.translations = {
   'services.reassign.step6.tasks.deleteHostComponents.title': 'Delete disabled {0}',
   'services.reassign.step6.tasks.startAllServices.title': 'Start All Services',
   'services.reassign.step6.tasks.stopMysqlService.title': 'Stop Mysql Server',
+  'services.reassign.step6.tasks.stopHostComponentsInMaintenanceMode.title': 'Stop {0}',
   'services.reassign.step6.status.success': 'Successfully moved <b>{0}</b> from <b>{1}</b> host to <b>{2}</b> host.',
   'services.reassign.step6.status.failed': 'Failed to move <b>{0}</b> from <b>{1}</b> host to <b>{2}</b> host.',
   'services.reassign.step6.status.info': 'Reassigning {0}. \nPlease wait for all tasks to be completed.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index ee2bc0a..7e97459 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -609,6 +609,32 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, {
     });
   },
 
+  /**
+   * Update state for array of components of different services and on different hosts
+   *
+   * @param {Array} components - array of components object with fields serviceName, hostName and componentName
+   * @param {String} state - new state to update
+   */
+  updateComponentsState: function (components, state) {
+    components.forEach(function (component) {
+      App.ajax.send({
+        name: 'common.host.host_component.update',
+        sender: this,
+        data: {
+          hostName: component.hostName,
+          serviceName: component.serviceName,
+          componentName: component.componentName,
+          HostRoles: {
+            state: state
+          },
+          taskNum: components.length
+        },
+        success: 'startPolling',
+        error: 'onTaskError'
+      });
+    }, this)
+  },
+
   startPolling: function (data) {
     if (data) {
       this.get('currentRequestIds').push(data.Requests.id);

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index 8a86733..794573e 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -274,6 +274,17 @@ module.exports = App.WizardRoute.extend({
     },
     next: function (router) {
       App.showConfirmationPopup(function () {
+        var hostComponentsInMM = [];
+        var controller = router.get('reassignMasterController');
+        var sourceHostComponents = App.HostComponent.find().filterProperty('hostName', controller.get('content.reassignHosts.source'));
+        var reassignComponents = controller.get('content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled') ? ['NAMENODE', 'ZKFC'] : [controller.get('content.reassign.component_name')];
+        reassignComponents.forEach(function(hostComponent){
+          var componentToReassign = sourceHostComponents.findProperty('componentName', hostComponent);
+          if (componentToReassign && !componentToReassign.get('isActive') && componentToReassign.get('workStatus') === 'STARTED') {
+            hostComponentsInMM.push(hostComponent);
+          }
+        });
+        controller.saveReassignComponentsInMM(hostComponentsInMM);
         router.transitionTo('step6');
       }, Em.I18n.t('services.reassign.step5.confirmPopup.body'));
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/be444cc1/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
index 5591347..89e2325 100644
--- a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
@@ -77,24 +77,17 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
       controller.onTaskCompleted.restore();
     });
 
-    it('No host-components', function () {
-      controller.set('multiTaskCounter', 0);
-      controller.set('hostComponents', []);
-      controller.onComponentsTasksSuccess();
-      expect(controller.get('multiTaskCounter')).to.equal(1);
-      expect(controller.onTaskCompleted.calledOnce).to.be.true;
-    });
     it('One host-component', function () {
-      controller.set('multiTaskCounter', 0);
+      controller.set('multiTaskCounter', 1);
       controller.set('hostComponents', [
         {}
       ]);
       controller.onComponentsTasksSuccess();
-      expect(controller.get('multiTaskCounter')).to.equal(1);
+      expect(controller.get('multiTaskCounter')).to.equal(0);
       expect(controller.onTaskCompleted.calledOnce).to.be.true;
     });
     it('two host-components', function () {
-      controller.set('multiTaskCounter', 0);
+      controller.set('multiTaskCounter', 2);
       controller.set('hostComponents', [
         {},
         {}
@@ -225,7 +218,7 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
       controller.putHostComponentsInMaintenanceMode();
       var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
       expect(args).exists;
-      expect(controller.get('multiTaskCounter')).to.equal(0);
+      expect(controller.get('multiTaskCounter')).to.equal(1);
     });
   });