Repository: ambari Updated Branches: refs/heads/trunk 6dc2c9558 -> 6a6f55d66
AMBARI-16191: HAWQ Configuration should be updated whenever Namenode is being moved (bhuvnesh2703) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6a6f55d6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6a6f55d6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6a6f55d6 Branch: refs/heads/trunk Commit: 6a6f55d66981ef421935d0e595bfc5f254560746 Parents: 6dc2c95 Author: Bhuvnesh Chaudhary <[email protected]> Authored: Mon May 2 09:35:30 2016 -0700 Committer: Bhuvnesh Chaudhary <[email protected]> Committed: Mon May 2 09:35:30 2016 -0700 ---------------------------------------------------------------------- .../main/service/reassign/step4_controller.js | 4 ++++ .../configs/move_namenode_config_initializer.js | 24 +++++++++++++++++-- .../service/reassign/step4_controller_test.js | 25 ++++++++++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6a6f55d6/ambari-web/app/controllers/main/service/reassign/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index a20aa82..736f467 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/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; http://git-wip-us.apache.org/repos/asf/ambari/blob/6a6f55d6/ambari-web/app/utils/configs/move_namenode_config_initializer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/configs/move_namenode_config_initializer.js b/ambari-web/app/utils/configs/move_namenode_config_initializer.js index 160848c..248b902 100644 --- a/ambari-web/app/utils/configs/move_namenode_config_initializer.js +++ b/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; } -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/6a6f55d6/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js index 460726b..329249c 100644 --- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js +++ b/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" + }); }); });
