You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/05/27 18:31:35 UTC
ambari git commit: AMBARI-11207. Delete cluster issue caused by
Issues with "Test DB Connection" in HiveServer2 Move Master Wizard patch
(alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 7790316da -> d6882d341
AMBARI-11207. Delete cluster issue caused by Issues with "Test DB Connection" in HiveServer2 Move Master Wizard patch (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6882d34
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6882d34
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6882d34
Branch: refs/heads/trunk
Commit: d6882d341d670b815532c4a2951f418618cb6e76
Parents: 7790316
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed May 27 18:52:29 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed May 27 19:31:29 2015 +0300
----------------------------------------------------------------------
.../0.12.0.2.0/package/files/addMysqlUser.sh | 2 +-
.../main/service/reassign/step4_controller.js | 66 +++++++++++++++--
ambari-web/app/messages.js | 1 +
.../service/reassign/step4_controller_test.js | 74 +++++++++++++-------
4 files changed, 112 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6882d34/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/addMysqlUser.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/addMysqlUser.sh b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/addMysqlUser.sh
index 4677ca1..36ed58f 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/addMysqlUser.sh
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/addMysqlUser.sh
@@ -34,4 +34,4 @@ echo "Adding user $mysqldbuser@% and removing users with empty name"
/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"GRANT ALL PRIVILEGES ON *.* TO '$mysqldbuser'@'%';\""
/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"DELETE FROM mysql.user WHERE user='';\""
/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"flush privileges;\""
-
+/var/lib/ambari-agent/ambari-sudo.sh service $mysqldservice stop
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6882d34/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 8682eaf..fe547c3 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -20,10 +20,37 @@ var App = require('app');
App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageController.extend({
- commands: ['stopRequiredServices', 'cleanMySqlServer', 'createHostComponents', 'putHostComponentsInMaintenanceMode', 'reconfigure', 'installHostComponents', 'startZooKeeperServers', 'startNameNode', 'deleteHostComponents', 'configureMySqlServer',
- 'startMySqlServer', 'startNewMySqlServer' , 'startRequiredServices'],
+ commands: [
+ 'stopRequiredServices',
+ 'cleanMySqlServer',
+ 'createHostComponents',
+ 'putHostComponentsInMaintenanceMode',
+ 'reconfigure',
+ 'installHostComponents',
+ 'startZooKeeperServers',
+ 'startNameNode',
+ 'deleteHostComponents',
+ 'configureMySqlServer',
+ 'startMySqlServer',
+ 'startNewMySqlServer',
+ 'startRequiredServices'
+ ],
+
// custom commands for Components with DB Configuration and Check
- commandsForDB: ['createHostComponents', 'installHostComponents', 'configureMySqlServer', 'startMySqlServer', 'testDBConnection', 'stopRequiredServices', 'cleanMySqlServer', 'putHostComponentsInMaintenanceMode', 'reconfigure', 'deleteHostComponents', 'configureMySqlServer', 'startRequiredServices'],
+ commandsForDB: [
+ 'createHostComponents',
+ 'installHostComponents',
+ 'configureMySqlServer',
+ 'restartMySqlServer',
+ 'testDBConnection',
+ 'stopRequiredServices',
+ 'cleanMySqlServer',
+ 'putHostComponentsInMaintenanceMode',
+ 'reconfigure',
+ 'deleteHostComponents',
+ 'configureMySqlServer',
+ 'startRequiredServices'
+ ],
clusterDeployState: 'REASSIGN_MASTER_INSTALLING',
@@ -308,7 +335,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
if(is_remote_db || db_type !== 'mysql') {
- this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'cleanMySqlServer', 'configureMySqlServer']);
+ this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'restartMySqlServer', 'cleanMySqlServer', 'configureMySqlServer']);
}
if (db_type === 'derby') {
@@ -317,7 +344,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
}
if ( this.get('content.reassign.component_name') !== 'MYSQL_SERVER' && !this.isComponentWithDB()) {
- this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'cleanMySqlServer', 'startNewMySqlServer', 'configureMySqlServer']);
+ this.removeTasks(['configureMySqlServer', 'startMySqlServer', 'restartMySqlServer', 'cleanMySqlServer', 'startNewMySqlServer', 'configureMySqlServer']);
}
if ( this.get('content.reassign.component_name') === 'MYSQL_SERVER' ) {
@@ -865,6 +892,35 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
});
},
+ restartMySqlServer: function() {
+ var context = "Restart MySql Server";
+
+ var resource_filters = {
+ component_name: "MYSQL_SERVER",
+ hosts: App.HostComponent.find().filterProperty('componentName', 'MYSQL_SERVER').get('firstObject.hostName'),
+ service_name: "HIVE"
+ };
+
+ var operation_level = {
+ level: "HOST_COMPONENT",
+ cluster_name: this.get('content.cluster.name'),
+ service_name: "HIVE",
+ hostcomponent_name: "MYSQL_SERVER"
+ };
+
+ App.ajax.send({
+ name: 'restart.hostComponents',
+ sender: this,
+ data: {
+ context: context,
+ resource_filters: [resource_filters],
+ operation_level: operation_level
+ },
+ success: 'startPolling',
+ error: 'onTaskError'
+ });
+ },
+
startNewMySqlServer: function() {
App.ajax.send({
name: 'common.host.host_component.update',
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6882d34/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8ba4c6f..afcea4d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1852,6 +1852,7 @@ Em.I18n.translations = {
'services.reassign.step4.tasks.testHiveMysqlConnection.title':'Test MYSQL Connection',
'services.reassign.step4.tasks.configureMySqlServer.title':'Configure MYSQL Server',
'services.reassign.step4.tasks.startMySqlServer.title':'Start MYSQL Server',
+ 'services.reassign.step4.tasks.restartMySqlServer.title':'Restart MYSQL Server',
'services.reassign.step4.tasks.testDBConnection.title':'Test DB Connection',
'services.reassign.step4.tasks.testDBConnection.tooltip':'Database Host: {0}\n' +
'Database Type: {1}\n' +
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6882d34/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 b23e5d6..8e4e0d9 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
@@ -123,26 +123,44 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
describe('#removeUnneededTasks()', function () {
var isHaEnabled = false;
+ var commands;
+ var commandsForDB;
beforeEach(function () {
sinon.stub(App, 'get', function () {
return isHaEnabled;
});
- controller.set('tasks', [
- {id: 1, command: 'stopRequiredServices'},
- {id: 2, command: 'cleanMySqlServer'},
- {id: 3, command: 'createHostComponents'},
- {id: 4, command: 'putHostComponentsInMaintenanceMode'},
- {id: 5, command: 'reconfigure'},
- {id: 6, command: 'installHostComponents'},
- {id: 7, command: 'startZooKeeperServers'},
- {id: 8, command: 'startNameNode'},
- {id: 9, command: 'deleteHostComponents'},
- {id: 10, command: 'configureMySqlServer'},
- {id: 11, command: 'startMySqlServer'},
- {id: 12, command: 'startRequiredServices'}
- ]);
+ commands = [
+ { id: 1, command: 'stopRequiredServices' },
+ { id: 2, command: 'cleanMySqlServer' },
+ { id: 3, command: 'createHostComponents' },
+ { id: 4, command: 'putHostComponentsInMaintenanceMode' },
+ { id: 5, command: 'reconfigure' },
+ { id: 6, command: 'installHostComponents' },
+ { id: 7, command: 'startZooKeeperServers' },
+ { id: 8, command: 'startNameNode' },
+ { id: 9, command: 'deleteHostComponents' },
+ { id: 10, command: 'configureMySqlServer' },
+ { id: 11, command: 'startMySqlServer' },
+ { id: 12, command: 'startNewMySqlServer' },
+ { id: 13, command: 'startRequiredServices' }
+ ];
+
+ commandsForDB = [
+ { id: 1, command: 'createHostComponents' },
+ { id: 2, command: 'installHostComponents' },
+ { id: 3, command: 'configureMySqlServer' },
+ { id: 4, command: 'restartMySqlServer' },
+ { id: 5, command: 'testDBConnection' },
+ { id: 6, command: 'stopRequiredServices' },
+ { id: 7, command: 'cleanMySqlServer' },
+ { id: 8, command: 'putHostComponentsInMaintenanceMode' },
+ { id: 9, command: 'reconfigure' },
+ { id: 10, command: 'deleteHostComponents' },
+ { id: 11, command: 'configureMySqlServer' },
+ { id: 12, command: 'startRequiredServices' }
+ ];
});
afterEach(function () {
@@ -150,24 +168,25 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
it('hasManualSteps is false', function () {
+ controller.set('tasks', commands);
controller.set('content.hasManualSteps', false);
controller.removeUnneededTasks();
- expect(controller.get('tasks').mapProperty('id')).to.eql([1,3,4,5,6,9,12]);
+ expect(controller.get('tasks').mapProperty('id')).to.eql([1,3,4,5,6,9,12,13]);
});
it('reassign component is not NameNode and HA disabled', function () {
+ controller.set('tasks', commands);
controller.set('content.hasManualSteps', true);
controller.set('content.reassign.component_name', 'COMP1');
isHaEnabled = false;
- console.log(controller.get('tasks').mapProperty('id'))
controller.removeUnneededTasks();
- console.log(controller.get('tasks').mapProperty('id'))
expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6]);
});
it('reassign component is not NameNode and HA enabled', function () {
+ controller.set('tasks', commands);
controller.set('content.hasManualSteps', true);
controller.set('content.reassign.component_name', 'COMP1');
isHaEnabled = true;
@@ -177,6 +196,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
it('reassign component is NameNode and HA disabled', function () {
+ controller.set('tasks', commands);
controller.set('content.hasManualSteps', true);
controller.set('content.reassign.component_name', 'NAMENODE');
isHaEnabled = false;
@@ -186,6 +206,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
it('reassign component is NameNode and HA enabled', function () {
+ controller.set('tasks', commands);
controller.set('content.hasManualSteps', true);
controller.set('content.reassign.component_name', 'NAMENODE');
isHaEnabled = true;
@@ -195,33 +216,36 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
it('reassign component is HiveServer and db type is mysql', function () {
+ controller.set('tasks', commandsForDB);
controller.set('content.hasManualSteps', false);
controller.set('content.databaseType', 'mysql');
controller.set('content.reassign.component_name', 'HIVE_SERVER');
isHaEnabled = false;
controller.removeUnneededTasks();
- expect(controller.get('tasks').mapProperty('id')).to.eql([1, 2, 3, 4, 5, 6, 9, 10, 11, 12]);
+ expect(controller.get('tasks').mapProperty('id')).to.eql([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
});
it('reassign component is HiveServer and db type is not mysql', function () {
+ controller.set('tasks', commandsForDB);
controller.set('content.hasManualSteps', false);
controller.set('content.databaseType', 'derby');
controller.set('content.reassign.component_name', 'HIVE_SERVER');
isHaEnabled = false;
controller.removeUnneededTasks();
- expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6, 9, 12]);
+ expect(controller.get('tasks').mapProperty('id')).to.eql([1, 2, 6, 8, 9, 10, 12]);
});
it('reassign component is Oozie Server and db type is derby', function () {
+ controller.set('tasks', commandsForDB);
controller.set('content.hasManualSteps', true);
controller.set('content.databaseType', 'derby');
controller.set('content.reassign.component_name', 'OOZIE_SERVER');
isHaEnabled = false;
controller.removeUnneededTasks();
- expect(controller.get('tasks').mapProperty('id')).to.eql([1,3,4,5,6]);
+ expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,6,8,9]);
});
it('reassign component is Oozie Server and db type is mysql', function () {
@@ -230,9 +254,9 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.set('content.reassign.component_name', 'OOZIE_SERVER');
isHaEnabled = false;
-
+ controller.set('tasks', commandsForDB);
controller.removeUnneededTasks();
- expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,3,4,5,6,9,10,11,12]);
+ expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,3,4,5,6,7,8,9,10,11,12]);
});
});
@@ -497,7 +521,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
beforeEach(function () {
sinon.stub(App.Service, 'find', function () {
return services;
- })
+ });
});
afterEach(function () {
App.Service.find.restore();
@@ -506,7 +530,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
testCases.forEach(function (test) {
it('get config of ' + test.componentName, function () {
expect(controller.getConfigUrlParams(test.componentName, data)).to.eql(test.result);
- })
+ });
});
it('get config of NAMENODE when HBASE installed', function () {
services = [
@@ -519,7 +543,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
"(type=core-site&tag=2)",
"(type=hbase-site&tag=3)"
]);
- })
+ });
});
describe('#onLoadConfigsTags()', function () {