AMBARI-14599: Update hawq configs to remove hawq_standby_address_host on single node clusters (bhuvnesh2703 via jaoki)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ff7e363f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff7e363f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff7e363f Branch: refs/heads/branch-dev-patch-upgrade Commit: ff7e363f240173c32f18d16614982ae56e4bb6ef Parents: 2503b60 Author: Jun Aoki <[email protected]> Authored: Wed Jan 13 16:15:28 2016 -0800 Committer: Jun Aoki <[email protected]> Committed: Wed Jan 13 16:15:28 2016 -0800 ---------------------------------------------------------------------- .../app/controllers/wizard/step7_controller.js | 37 ++++++++++++++------ .../test/controllers/wizard/step7_test.js | 35 ++++++++++++++++++ 2 files changed, 61 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ff7e363f/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 42b5b87..92abe21 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -690,21 +690,36 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E }); }, + /** + * Update hawq configuration depending on the state of the cluster + * @param {Array} configs + */ + updateHawqConfigs: function (configs) { + if (this.get('wizardController.name') == 'addServiceController') { + if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs); + if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs); + if (App.get('isKerberosEnabled')) this.addHawqConfigsOnKerberizedCluster(configs); + } + if (App.get('isSingleNode')) this.removeHawqStandbyHostAddressConfig(configs); + return configs + }, + + /** + * Remove hawq_standby_address_host config from HAWQ configs + * @param {Array} configs + */ + removeHawqStandbyHostAddressConfig: function(configs) { + var hawqStandbyAddressHostIndex = configs.indexOf(configs.findProperty('name', 'hawq_standby_address_host')); + if (hawqStandbyAddressHostIndex > -1) configs.removeAt(hawqStandbyAddressHostIndex) ; + return configs + }, + applyServicesConfigs: function (configs) { if (this.get('allSelectedServiceNames').contains('YARN')) { configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []); } - // If HAWQ service is being added, add NN-HA/RM-HA/Kerberos related parameters to hdfs-client/yarn-client if applicable - if (this.get('wizardController.name') == 'addServiceController' && !this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ')) { - if (App.get('isHaEnabled')) { - this.addHawqConfigsOnNnHa(configs); - } - if (App.get('isRMHaEnabled')) { - this.addHawqConfigsOnRMHa(configs); - } - if (App.get('isKerberosEnabled')) { - this.addHawqConfigsOnKerberizedCluster(configs); - } + if (!this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ')) { + this.updateHawqConfigs(configs); } if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') { this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []); http://git-wip-us.apache.org/repos/asf/ambari/blob/ff7e363f/ambari-web/test/controllers/wizard/step7_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js index 2d82cbc..d8c4552 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1165,6 +1165,41 @@ describe('App.InstallerStep7Controller', function () { } }); }); + + }); + + describe('#updateHawqConfigs', function() { + var testHawqSiteConfigs = [ + { + name: 'hawq_standby_address_host', + value: 'h2' + }, + { + name: 'hawq_master_address_host', + value: 'h1' + } + ]; + var oldHawqSiteLength = testHawqSiteConfigs.length; + it('hawq_standby_address_host should be removed on single node cluster', function() { + sinon.stub(App, 'get').withArgs('isSingleNode').returns(true); + var hawqSiteConfigs = testHawqSiteConfigs.slice(); + var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs); + expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength-1); + expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host')).to.be.eql(undefined); + expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_master_address_host').value).to.be.eql('h1'); + App.get.restore() + }); + + it('hawq_standby_address_host should not be removed on multi node clusters', function() { + sinon.stub(App, 'get').withArgs('isSingleNode').returns(false); + var hawqSiteConfigs = testHawqSiteConfigs.slice(); + var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs); + expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength); + expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host').value).to.be.eql('h2'); + expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_master_address_host').value).to.be.eql('h1'); + App.get.restore(); + }); + }); describe('#_updateIsEditableFlagForConfig', function () {
