Browse Source

AMBARI-16191: HAWQ Configuration should be updated whenever Namenode is being moved (bhuvnesh2703)

Bhuvnesh Chaudhary 9 năm trước cách đây
mục cha
commit
6a6f55d669

+ 4 - 0
ambari-web/app/controllers/main/service/reassign/step4_controller.js

@@ -568,6 +568,10 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
         if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
           urlParams.push('(type=accumulo-site&tag=' + data.Clusters.desired_configs['accumulo-site'].tag + ')');
         }
+        if (App.Service.find().someProperty('serviceName', 'HAWQ')) {
+          urlParams.push('(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')');
+          urlParams.push('(type=hdfs-client&tag=' + data.Clusters.desired_configs['hdfs-client'].tag + ')');
+        }
     }
 
     return urlParams;

+ 22 - 2
ambari-web/app/utils/configs/move_namenode_config_initializer.js

@@ -36,7 +36,8 @@ App.MoveNameNodeConfigInitializer = App.MoveComponentConfigInitializerClass.crea
   uniqueInitializers: {
     'instance.volumes': '_initInstanceVolumes',
     'instance.volumes.replacements': '_initInstanceVolumesReplacements',
-    'hbase.rootdir': '_initHbaseRootDir'
+    'hbase.rootdir': '_initHbaseRootDir',
+    'hawq_dfs_url': '_initHawqDfsUrl'
   },
 
   /**
@@ -97,6 +98,25 @@ App.MoveNameNodeConfigInitializer = App.MoveComponentConfigInitializerClass.crea
       Em.set(configProperty, 'value', value);
     }
     return configProperty;
+  },
+
+  /**
+   * Unique initializer for <code>hawq_dfs_url</code>-config (for HAWQ service)
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initHawqDfsUrl
+   */
+  _initHawqDfsUrl: function (configProperty, localDB, dependencies) {
+    if (!App.get('isHaEnabled') && localDB.installedServices.contains('HAWQ') && 'hawq-site' === configProperty.filename) {
+      var value = Em.get(configProperty, 'value');
+      value = value.replace(/(.*):/, dependencies.targetHostName + ':');
+      Em.set(configProperty, 'value', value);
+    }
+    return configProperty;
   }
 
-});
+});

+ 23 - 2
ambari-web/test/controllers/main/service/reassign/step4_controller_test.js

@@ -1438,7 +1438,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         return [
           {serviceName: 'HDFS'},
           {serviceName: 'ACCUMULO'},
-          {serviceName: 'HBASE'}
+          {serviceName: 'HBASE'},
+          {serviceName: 'HAWQ'}
         ];
       });
       controller.set('content.reassignHosts.source', 'host1');
@@ -1450,7 +1451,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       App.MoveNameNodeConfigInitializer.cleanup();
     });
 
-    it('HA isn\'t enabled and HBASE and ACCUMULO service', function () {
+    it('HA isn\'t enabled and HBASE, HAWQ and ACCUMULO service', function () {
       isHaEnabled = false;
       var configs = {
         'hbase-site': {
@@ -1459,6 +1460,9 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         'accumulo-site': {
           'instance.volumes': 'hdfs://localhost:8020/apps/accumulo/data',
           'instance.volumes.replacements': ''
+        },
+        'hawq-site': {
+          'hawq_dfs_url': 'localhost:8020/hawq/data'
         }
       };
 
@@ -1470,6 +1474,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       expect(configs['hbase-site']['hbase.rootdir']).to.equal('hdfs://host2:8020/apps/hbase/data');
       expect(configs['accumulo-site']['instance.volumes']).to.equal('hdfs://host2:8020/apps/accumulo/data');
       expect(configs['accumulo-site']['instance.volumes.replacements']).to.equal('hdfs://host1:8020/apps/accumulo/data hdfs://host2:8020/apps/accumulo/data');
+      expect(configs['hawq-site']['hawq_dfs_url']).to.equal('host2:8020/hawq/data');
     });
 
     it('HA enabled and namenode 1', function () {
@@ -1480,6 +1485,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
           'dfs.namenode.http-address.s.nn1': 'host1:50070',
           'dfs.namenode.https-address.s.nn1': 'host1:50470',
           'dfs.namenode.rpc-address.s.nn1': 'host1:8020'
+        },
+        'hdfs-client': {
+          'dfs.namenode.rpc-address.s.nn1': '',
+          'dfs.namenode.http-address.s.nn1': 'host1:50070'
         }
       };
 
@@ -1492,6 +1501,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         "dfs.namenode.https-address.s.nn1": "host2:50470",
         "dfs.namenode.rpc-address.s.nn1": "host2:8020"
       });
+      expect(configs['hdfs-client']).to.eql({
+        "dfs.namenode.http-address.s.nn1": "host2:50070",
+        "dfs.namenode.rpc-address.s.nn1": "host2:8020"
+      });
     });
 
     it('HA enabled and namenode 2', function () {
@@ -1503,6 +1516,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
           'dfs.namenode.http-address.s.nn2': 'host2:50070',
           'dfs.namenode.https-address.s.nn2': 'host2:50470',
           'dfs.namenode.rpc-address.s.nn2': 'host2:8020'
+        },
+        'hdfs-client': {
+          'dfs.namenode.rpc-address.s.nn2': '',
+          'dfs.namenode.http-address.s.nn2': 'host2:50070'
         }
       };
       controller.set('content.reassignHosts.source', 'host2');
@@ -1518,6 +1535,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         "dfs.namenode.https-address.s.nn2": "host3:50470",
         "dfs.namenode.rpc-address.s.nn2": "host3:8020"
       });
+      expect(configs['hdfs-client']).to.eql({
+        "dfs.namenode.http-address.s.nn2": "host3:50070",
+        "dfs.namenode.rpc-address.s.nn2": "host3:8020"
+      });
     });
 
   });