Explorar el Código

AMBARI-18220. Namenode start failed on moving namenode on a HA cluster. (jamin)

Jaimin Jetly hace 9 años
padre
commit
2c3602182f

+ 8 - 1
ambari-web/app/controllers/main/service/reassign/step4_controller.js

@@ -968,9 +968,16 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     this.updateComponent('ZOOKEEPER_SERVER', components.mapProperty('hostName'), "ZOOKEEPER", "Start");
   },
 
+  /**
+   * Start the namenode that is not being moved (applicable only in NameNode HA environment)
+   * @private {startNameNode}
+   */
   startNameNode: function () {
     var components = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE');
-    this.updateComponent('NAMENODE', components.mapProperty('hostName').without(this.get('content.reassignHosts.source')), "HDFS", "Start");
+    var sourceHost =  this.get('content.reassignHosts.source');
+    var targetHost =  this.get('content.reassignHosts.target');
+    var hostname = components.mapProperty('hostName').without(sourceHost).without(targetHost);
+    this.updateComponent('NAMENODE', hostname, "HDFS", "Start");
   },
 
   /**

+ 1 - 1
ambari-web/app/views/main/service/reassign/step5_view.js

@@ -38,7 +38,7 @@ App.ReassignMasterWizardStep5View = Em.View.extend({
 
     if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
       ha = '_ha';
-      var nnStartedHost = this.get('controller.content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName').without(sourceHost);
+      var nnStartedHost = this.get('controller.content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName').without(sourceHost).without(targetHost);
     }
 
     if (this.get('controller.content.reassign.component_name') === 'APP_TIMELINE_SERVER') {

+ 14 - 7
ambari-web/test/controllers/main/service/reassign/step4_controller_test.js

@@ -932,17 +932,24 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
   describe('#startNameNode()', function () {
     beforeEach(function () {
       sinon.stub(controller, 'updateComponent', Em.K);
-      controller.set('content.masterComponentHosts', [{
-        component: 'NAMENODE',
-        hostName: 'host1'
-      }]);
+      controller.set('content.masterComponentHosts', [
+        {
+          component: 'NAMENODE',
+          hostName: 'host1'
+        },
+        {
+          component: 'NAMENODE',
+          hostName: 'host2'
+        }
+      ]);
     });
     afterEach(function () {
       controller.updateComponent.restore();
     });
 
     it('reassign host does not match current', function () {
-      controller.set('content.reassignHosts.source', 'host2');
+      controller.set('content.reassignHosts.source', 'host3');
+      controller.set('content.reassignHosts.target', 'host2');
       controller.startNameNode();
       expect(controller.updateComponent.getCall(0).args[0]).to.be.equal('NAMENODE');
       expect(controller.updateComponent.getCall(0).args[1][0]).to.be.equal('host1');
@@ -951,9 +958,9 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     });
 
     it('reassign host matches current', function () {
-      controller.set('content.reassignHosts.source', 'host1');
+      controller.set('content.reassignHosts.target', 'host2');
       controller.startNameNode();
-      expect(controller.updateComponent.calledWith('NAMENODE', [], 'HDFS', 'Start')).to.be.true;
+      expect(controller.updateComponent.calledWith('NAMENODE', ['host1'], 'HDFS', 'Start')).to.be.true;
     });
   });