This is an automated email from the ASF dual-hosted git repository.
akovalenko pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new aca66a0 AMBARI-24676. Issues w.r.t Manage Journal Nodes (Particularly
deletion) in HA enabled cluster (akovalenko)
aca66a0 is described below
commit aca66a0175881e0a4739c8a52ed0e6e015e3376b
Author: Aleksandr Kovalenko <[email protected]>
AuthorDate: Mon Sep 24 02:53:33 2018 +0300
AMBARI-24676. Issues w.r.t Manage Journal Nodes (Particularly deletion) in
HA enabled cluster (akovalenko)
---
.../journalNode/step2_controller.js | 60 ++++++++++++++++++----
.../journalNode/step2_controller_test.js | 37 ++++++++++---
2 files changed, 81 insertions(+), 16 deletions(-)
diff --git
a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step2_controller.js
b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step2_controller.js
index 108c97a..32fd198 100644
---
a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step2_controller.js
+++
b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step2_controller.js
@@ -35,7 +35,15 @@ App.ManageJournalNodeWizardStep2Controller =
Em.Controller.extend({
selectedService: null,
stepConfigs: [],
serverConfigData: {},
- moveJNConfig: $.extend(true, {},
require('data/configs/wizards/move_journal_node_properties').moveJNConfig),
+ moveJNConfig: {
+ serviceName: 'MISC',
+ displayName: 'MISC',
+ configCategories: [
+ App.ServiceConfigCategory.create({name: 'HDFS', displayName: 'HDFS'})
+ ],
+ sites: ['hdfs-site'],
+ configs: []
+ },
once: false,
isLoaded: false,
versionLoaded: true,
@@ -83,8 +91,8 @@ App.ManageJournalNodeWizardStep2Controller =
Em.Controller.extend({
onLoadConfigs: function (data) {
this.set('serverConfigData', data);
this.set('content.nameServiceId',
data.items[0].properties['dfs.nameservices']);
- this.tweakServiceConfigs(this.get('moveJNConfig.configs'));
- this.renderServiceConfigs(this.get('moveJNConfig'));
+ this.tweakServiceConfigs();
+ this.renderServiceConfigs();
this.set('isLoaded', true);
},
@@ -113,19 +121,51 @@ App.ManageJournalNodeWizardStep2Controller =
Em.Controller.extend({
return localDB;
},
- tweakServiceConfigs: function (configs) {
+ tweakServiceConfigs: function () {
var localDB = this._prepareLocalDB();
var dependencies = this._prepareDependencies();
+ if (App.get('hasNameNodeFederation')) {
+ this.setNameSpaceConfigs();
+ } else {
+ this.get('moveJNConfig').configs.pushObject({
+ "name": "dfs.namenode.shared.edits.dir",
+ "displayName": "dfs.namenode.shared.edits.dir",
+ "description": " The URI which identifies the group of JNs where the
NameNodes will write/read edits.",
+ "isReconfigurable": false,
+ "recommendedValue":
"qjournal://node1.example.com:8485;node2.example.com:8485;node3.example.com:8485/mycluster",
+ "value":
"qjournal://node1.example.com:8485;node2.example.com:8485;node3.example.com:8485/mycluster",
+ "category": "HDFS",
+ "filename": "hdfs-site",
+ "serviceName": 'MISC'
+ });
+ this.get('moveJNConfig.configs').forEach(function (config) {
+ App.NnHaConfigInitializer.initialValue(config, localDB, dependencies);
+ config.isOverridable = false;
+ });
+ }
+ },
- configs.forEach(function (config) {
- App.NnHaConfigInitializer.initialValue(config, localDB, dependencies);
- config.isOverridable = false;
+ setNameSpaceConfigs: function () {
+ const namespaces = this.get('content.nameServiceId').split(',');
+ const namespaceConfigValue =
this.get('content.masterComponentHosts').filterProperty('component',
'JOURNALNODE').map(function (node) {
+ return node.hostName + ':8485'
+ }).join(';');
+ namespaces.forEach((namespace) => {
+ this.get('moveJNConfig.configs').pushObject({
+ "name": "dfs.namenode.shared.edits.dir." + namespace,
+ "displayName": "dfs.namenode.shared.edits.dir." + namespace,
+ "isReconfigurable": false,
+ "recommendedValue": "qjournal://" + namespaceConfigValue + '/' +
namespace,
+ "value": "qjournal://" + namespaceConfigValue + '/' + namespace,
+ "category": "HDFS",
+ "filename": "hdfs-site",
+ "serviceName": 'MISC'
+ });
});
-
- return configs;
},
- renderServiceConfigs: function (_serviceConfig) {
+ renderServiceConfigs: function () {
+ var _serviceConfig = this.get('moveJNConfig');
var serviceConfig = App.ServiceConfig.create({
serviceName: _serviceConfig.serviceName,
displayName: _serviceConfig.displayName,
diff --git
a/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step2_controller_test.js
b/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step2_controller_test.js
index 17230bb..d7e2f0c 100644
---
a/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step2_controller_test.js
+++
b/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step2_controller_test.js
@@ -200,23 +200,48 @@ describe('App.ManageJournalNodeWizardStep2Controller',
function () {
sinon.stub(controller, '_prepareLocalDB').returns({});
sinon.stub(controller, '_prepareDependencies').returns({});
sinon.stub(App.NnHaConfigInitializer, 'initialValue');
+ sinon.stub(controller, 'setNameSpaceConfigs').returns({});
});
afterEach(function() {
+ controller.set('moveJNConfig.configs', []);
+ controller.set('content', {});
controller._prepareLocalDB.restore();
controller._prepareDependencies.restore();
+ controller.setNameSpaceConfigs.restore();
App.NnHaConfigInitializer.initialValue.restore();
+ App.get.restore();
});
- it('App.NnHaConfigInitializer.initialValue should be called', function() {
- controller.tweakServiceConfigs([{}]);
+ it('should push an object to array of configs and call
App.NnHaConfigInitializer', function() {
+ sinon.stub(App, 'get').withArgs('hasNameNodeFederation').returns(false);
+ controller.tweakServiceConfigs();
+ expect(controller.get('moveJNConfig.configs')[0]['name']
==='dfs.namenode.shared.edits.dir').to.be.eql(true);
+ expect(controller.get('moveJNConfig.configs').length).to.be.eql(1);
expect(App.NnHaConfigInitializer.initialValue.calledOnce).to.be.true;
});
- it('should return array of configs', function() {
- expect(controller.tweakServiceConfigs([{}])).to.be.eql([{
- isOverridable: false
- }]);
+ it('should call setNameSpaceConfigs', function() {
+ sinon.stub(App, 'get').withArgs('hasNameNodeFederation').returns(true);
+ controller.set('content', Em.Object.create({nameServiceId: 'b,c'}));
+ controller.tweakServiceConfigs();
+ expect(controller.setNameSpaceConfigs.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#setNameSpaceConfigs', function() {
+ it('set moveJNConfig.configs', function() {
+ controller.set('moveJNConfig.configs', []);
+ controller.set('content', Em.Object.create({
+ nameServiceId: 'b,c',
+ masterComponentHosts: [
+ {component: 'JOURNALNODE', hostName: 'c7403.ambari.apache.org'},
+ {component: 'JOURNALNODE', hostName: 'c7402.ambari.apache.org'},
+ {component: 'JOURNALNODE', hostName: 'c7401.ambari.apache.org'},
+ ]
+ }));
+
controller.setNameSpaceConfigs(controller.get('content.nameServiceId').split(','));
+ expect(controller.get('moveJNConfig.configs').length).to.be.eql(2);
});
});