Browse Source

AMBARI-8707. Failed to move MySQL Server in move Hive Metastore DB. (Sizlard Nemethy via jaimin)

Jaimin Jetly 10 years ago
parent
commit
e0c421af49

+ 9 - 9
ambari-web/app/controllers/main/service/reassign/step6_controller.js

@@ -22,7 +22,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
 
   isReassign: true,
 
-  commands: ['putHostComponentsInMaintenanceMode', 'stopMysqlService', 'deleteHostComponents', 'startServices'],
+  commands: ['stopMysqlService', 'putHostComponentsInMaintenanceMode', 'deleteHostComponents', 'startServices'],
 
   clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
 
@@ -69,7 +69,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
 
   removeUnneededTasks: function () {
     if ( this.get('content.reassign.component_name') !== 'MYSQL_SERVER' ) {
-      this.removeTasks(['putHostComponentsInMaintenanceMode', 'stopServices']);
+      this.removeTasks(['putHostComponentsInMaintenanceMode', 'stopMysqlService']);
     }
   },
 
@@ -173,16 +173,16 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
    * make server call to stop services
    */
   stopMysqlService: function () {
-    var data = {
-      "ServiceInfo": {
-        "state": "INSTALLED"
-      }
-    };
+    var data = {};
+
     data.context = "Stop required services";
-    data.urlParams = "ServiceInfo/service_name.in(MYSQL_SERVER)";
+    data.hostName = this.get('content.reassignHosts.source');
+    data.serviceName = 'HIVE';
+    data.HostRoles = { "state": "INSTALLED" };
+    data.componentName = "MYSQL_SERVER";
 
     App.ajax.send({
-      name: 'common.services.update',
+      name: 'common.host.host_component.update',
       sender: this,
       data: data,
       success: 'startPolling',

+ 1 - 1
ambari-web/app/messages.js

@@ -1787,7 +1787,7 @@ Em.I18n.translations = {
     '<ol>' +
     '<li>On <b>{1}</b> using a terminal you can export your Metastore DB (MYSQL) using:' +
     '<div class="code-snippet">mysqldump db_name > backup-file.sql</div></li>' +
-    '<li>Copy the file to the target host <b>{2}</b> hosting the MySQL DB<li>' +
+    '<li>Copy the file to the target host <b>{2}</b> hosting the MySQL DB</li>' +
     '<li>Execute this SQL inside <b>mysql<b>' +
     '<div class="code-snippet">CREATE DATABASE db_name;</div></li>' +
     '<li>Import the database using' +

+ 28 - 0
ambari-web/test/controllers/main/service/reassign/step6_controller_test.js

@@ -204,4 +204,32 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
     });
   });
 
+  describe('#stopMysqlService()', function () {
+    it('stopMysqlService', function () {
+      controller.stopMysqlService();
+      expect(App.ajax.send.calledOnce).to.be.true;
+    });
+  });
+
+  describe('#putHostComponentsInMaintenanceMode()', function () {
+    beforeEach(function(){
+      sinon.stub(controller, 'onComponentsTasksSuccess', Em.K);
+      controller.set('content.reassignHosts.source', 'source');
+    });
+    afterEach(function(){
+      controller.onComponentsTasksSuccess.restore();
+    });
+    it('No host-components', function () {
+      controller.set('hostComponents', []);
+      controller.putHostComponentsInMaintenanceMode();
+      expect(App.ajax.send.called).to.be.false;
+      expect(controller.get('multiTaskCounter')).to.equal(0);
+    });
+    it('One host-components', function () {
+      controller.set('hostComponents', [{}]);
+      controller.putHostComponentsInMaintenanceMode();
+      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(controller.get('multiTaskCounter')).to.equal(0);
+    });
+  });
 });