Repository: ambari Updated Branches: refs/heads/branch-2.2 0780149ec -> 97b754139
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/97b75413 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/97b75413 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/97b75413 Branch: refs/heads/branch-2.2 Commit: 97b754139847f8ee0ac6f71fb3f4ffb7f98d34c9 Parents: 0780149 Author: Bhuvnesh Chaudhary <[email protected]> Authored: Mon May 2 09:37:19 2016 -0700 Committer: Bhuvnesh Chaudhary <[email protected]> Committed: Mon May 2 09:37:19 2016 -0700 ---------------------------------------------------------------------- .../main/service/reassign/step4_controller.js | 15 ++++++++ .../service/reassign/step4_controller_test.js | 40 +++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/97b75413/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 840bda3..b98f24b 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -528,6 +528,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 + ')'); + } break; case 'SECONDARY_NAMENODE': urlParams.push('(type=hdfs-site&tag=' + data.Clusters.desired_configs['hdfs-site'].tag + ')'); @@ -684,6 +688,17 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro if (!App.get('isHaEnabled') && App.Service.find('HBASE').get('isLoaded')) { configs['hbase-site']['hbase.rootdir'] = configs['hbase-site']['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + targetHostName + ':8020'); } + if (App.Service.find('HAWQ').get('isLoaded')) { + if (!App.get('isHaEnabled')) { + configs['hawq-site']['hawq_dfs_url'] = configs['hawq-site']['hawq_dfs_url'].replace(/(.*):/, targetHostName + ':'); + } + else if (App.get('isHaEnabled')) { + var nameServices = configs['hdfs-site']['dfs.nameservices']; + var suffix = (configs['hdfs-client']['dfs.namenode.http-address.' + nameServices + '.nn1'] === sourceHostName + ':50070') ? '.nn1' : '.nn2'; + configs['hdfs-client']['dfs.namenode.http-address.' + nameServices + suffix] = targetHostName + ':50070'; + configs['hdfs-client']['dfs.namenode.rpc-address.' + nameServices + suffix] = targetHostName + ':8020'; + } + } if (!App.get('isHaEnabled') && App.Service.find('ACCUMULO').get('isLoaded')) { // Update the Namenode's hostname in instance.volumes configs['accumulo-site']['instance.volumes'] = configs['accumulo-site']['instance.volumes'].replace(/\/\/[^\/]*/, '//' + targetHostName + ':8020'); http://git-wip-us.apache.org/repos/asf/ambari/blob/97b75413/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 1e137ee..835eb8b 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 @@ -525,7 +525,9 @@ describe('App.ReassignMasterWizardStep4Controller', function () { 'oozie-env': {tag: 2}, 'webhcat-site': {tag: 7}, 'yarn-env': {tag: 8}, - 'accumulo-site': {tag: 9} + 'accumulo-site': {tag: 9}, + 'hawq-site': {tag: 10}, + 'hdfs-client': {tag: 11}, } } }; @@ -572,6 +574,20 @@ describe('App.ReassignMasterWizardStep4Controller', function () { ]); }); + it('get config of NAMENODE when HAWQ installed', function () { + services = [ + { + serviceName: 'HAWQ' + } + ]; + expect(controller.getConfigUrlParams('NAMENODE', data)).to.eql([ + "(type=hdfs-site&tag=1)", + "(type=core-site&tag=2)", + "(type=hawq-site&tag=10)", + "(type=hdfs-client&tag=11)" + ]); + }); + }); describe('#onLoadConfigsTags()', function () { @@ -750,7 +766,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { controller.setSpecificNamenodeConfigs(configs, 'host1'); expect(configs).to.eql({}); }); - it('HA isn\'t enabled and HBASE and ACCUMULO service', function () { + it('HA isn\'t enabled and HBASE, HAWQ, ACCUMULO service exists', function () { isHaEnabled = false; service = Em.Object.create({ isLoaded: true @@ -761,11 +777,15 @@ describe('App.ReassignMasterWizardStep4Controller', function () { }, 'accumulo-site': { 'instance.volumes': 'hdfs://localhost:8020/apps/accumulo/data' + }, + 'hawq-site': { + 'hawq_dfs_url': 'localhost:8020/hawq/hawq_default' } }; controller.setSpecificNamenodeConfigs(configs, 'host1'); expect(configs['hbase-site']['hbase.rootdir']).to.equal('hdfs://host1:8020/apps/hbase/data'); expect(configs['accumulo-site']['instance.volumes']).to.equal('hdfs://host1:8020/apps/accumulo/data'); + expect(configs['hawq-site']['hawq_dfs_url']).to.equal('host1:8020/hawq/hawq_default'); }); it('HA enabled and namenode 1', function () { isHaEnabled = true; @@ -775,6 +795,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () { 'dfs.namenode.http-address.s.nn1': 'host1:50070', 'dfs.namenode.https-address.s.nn1': '', 'dfs.namenode.rpc-address.s.nn1': '' + }, + 'hdfs-client': { + 'dfs.namenode.rpc-address.s.nn1': '', + 'dfs.namenode.http-address.s.nn1': 'host1:50070' } }; controller.setSpecificNamenodeConfigs(configs, 'host2'); @@ -784,6 +808,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 () { isHaEnabled = true; @@ -793,6 +821,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () { 'dfs.namenode.http-address.s.nn2': 'host2:50070', 'dfs.namenode.https-address.s.nn2': '', 'dfs.namenode.rpc-address.s.nn2': '' + }, + 'hdfs-client': { + 'dfs.namenode.rpc-address.s.nn2': '', + 'dfs.namenode.http-address.s.nn2': 'host2:50070' } }; controller.setSpecificNamenodeConfigs(configs, 'host1'); @@ -802,6 +834,10 @@ describe('App.ReassignMasterWizardStep4Controller', function () { "dfs.namenode.https-address.s.nn2": "host1:50470", "dfs.namenode.rpc-address.s.nn2": "host1:8020" }); + expect(configs['hdfs-client']).to.eql({ + "dfs.namenode.http-address.s.nn2": "host1:50070", + "dfs.namenode.rpc-address.s.nn2": "host1:8020" + }); }); });
