You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by od...@apache.org on 2015/12/17 19:55:00 UTC

ambari git commit: AMBARI-14225. NN HA wizard should update hawq_dfs_url with nameservice when ha is enabled by ambari(Bhuvnesh Chaudhary via odiachenko).

Repository: ambari
Updated Branches:
  refs/heads/trunk cc452ed8f -> 6b810e141


AMBARI-14225. NN HA wizard should update hawq_dfs_url with nameservice when ha is enabled by ambari(Bhuvnesh Chaudhary via odiachenko).


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6b810e14
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6b810e14
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6b810e14

Branch: refs/heads/trunk
Commit: 6b810e1415699571c0e34d419d033130de15a7d8
Parents: cc452ed
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Thu Dec 17 10:54:50 2015 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Thu Dec 17 10:54:54 2015 -0800

----------------------------------------------------------------------
 .../nameNode/rollback_controller.js             | 32 ++++++++++++++++++++
 .../nameNode/step3_controller.js                |  5 +++
 .../nameNode/step9_controller.js                | 21 ++++++++++++-
 ambari-web/app/data/HDP2/ha_properties.js       | 17 +++++++++--
 ambari-web/app/messages.js                      |  7 +++--
 .../utils/configs/nn_ha_config_initializer.js   | 25 ++++++++++++++-
 .../nameNode/step3_controller_test.js           | 15 ++++++++-
 7 files changed, 114 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
index 54ffff2..6f05e6c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
@@ -34,6 +34,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     'stopAllServices',
     'restoreHBaseConfigs',
     'restoreAccumuloConfigs',
+    'restoreHawqConfigs',
     'stopFailoverControllers',
     'deleteFailoverControllers',
     'stopStandbyNameNode',
@@ -67,6 +68,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       'startAllServices',
       'reconfigureHBase',
       'reconfigureAccumulo',
+      'reconfigureHawq',
       'startZKFC',
       'installZKFC',
       'startSecondNameNode',
@@ -98,6 +100,10 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     if (!App.Service.find().someProperty('serviceName', 'ACCUMULO') && accumuloTask) {
       this.get('tasks').splice(accumuloTask.get('id'), 1);
     }
+    var hawqTask = this.get('tasks').findProperty('command', 'restoreHawqConfigs');
+    if (!App.Service.find().someProperty('serviceName', 'HAWQ') && hawqTask) {
+      this.get('tasks').splice(hawqTask.get('id'), 1);
+    }
   },
 
   clearStep: function () {
@@ -237,6 +243,19 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       error: 'onTaskError'
     });
   },
+  restoreHawqConfigs: function(){
+    this.loadConfigTag("hawqSiteTag");
+    var hawqSiteTag = this.get("content.hawqSiteTag");
+    App.ajax.send({
+      name: 'admin.high_availability.load_hawq_configs',
+      sender: this,
+      data: {
+        hawqSiteTag: hawqSiteTag
+      },
+      success: 'onLoadHawqConfigs',
+      error: 'onTaskError'
+    });
+  },
 
   stopFailoverControllers: function(){
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
@@ -315,6 +334,19 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     });
   },
 
+  onLoadHawqConfigs: function (data) {
+    var hawqSiteProperties = data.items.findProperty('type', 'hawq-site').properties;
+    App.ajax.send({
+      name: 'admin.high_availability.save_configs',
+      sender: this,
+      data: {
+        siteName: 'hawq-site',
+        properties: hawqSiteProperties
+      },
+      success: 'onTaskCompleted',
+      error: 'onTaskError'
+    });
+  },
   onDeletedHDFSClient: function () {
     var deletedHdfsClients = this.get('deletedHdfsClients');
     var hostName = this.get("content.hdfsClientHostNames");

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
index b97f89e..b420687 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
@@ -96,6 +96,11 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
       urlParams.push('(type=ams-hbase-site&tag=' + amsHbaseSiteTag + ')');
       this.set("amsHbaseSiteTag", {name : "amsHbaseSiteTag", value : amsHbaseSiteTag});
     }
+    if (App.Service.find().someProperty('serviceName', 'HAWQ')) {
+      var hawqSiteTag = data.Clusters.desired_configs['hawq-site'].tag;
+      urlParams.push('(type=hawq-site&tag=' + hawqSiteTag + ')');
+      this.set("hawqSiteTag", {name : "hawqSiteTag", value : hawqSiteTag});
+    }
     App.ajax.send({
       name: 'admin.get.all_configurations',
       sender: this,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
index 580977a..4b661ca 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
@@ -22,10 +22,11 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
 
   name:"highAvailabilityWizardStep9Controller",
 
-  commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'reconfigureAccumulo', 'deleteSNameNode', 'startAllServices'],
+  commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'reconfigureAccumulo', 'reconfigureHawq', 'deleteSNameNode', 'startAllServices'],
 
   hbaseSiteTag: "",
   accumuloSiteTag: "",
+  hawqSiteTag: "",
 
   initializeTasks: function () {
     this._super();
@@ -36,6 +37,10 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
     }
     if (!App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
       this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureAccumulo').get('id') - numSpliced, 1);
+      numSpliced++ ;
+    }
+    if (!App.Service.find().someProperty('serviceName', 'HAWQ')) {
+      this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHawq').get('id') - numSpliced, 1);
     }
   },
 
@@ -82,6 +87,20 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
     });
   },
 
+  reconfigureHawq: function () {
+    var data = this.get('content.serviceConfigProperties');
+    var configData = this.reconfigureSites(['hawq-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
+    App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      success: 'saveConfigTag',
+      error: 'onTaskError'
+    });
+  },
+
   saveConfigTag: function () {
     App.clusterStatus.setClusterStatus({
       clusterName: this.get('content.cluster.name'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/data/HDP2/ha_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/ha_properties.js b/ambari-web/app/data/HDP2/ha_properties.js
index 627018a..8b2960d 100644
--- a/ambari-web/app/data/HDP2/ha_properties.js
+++ b/ambari-web/app/data/HDP2/ha_properties.js
@@ -25,9 +25,10 @@ module.exports =
       App.ServiceConfigCategory.create({ name: 'HDFS', displayName: 'HDFS'}),
       App.ServiceConfigCategory.create({ name: 'HBASE', displayName: 'HBase'}),
       App.ServiceConfigCategory.create({ name: 'ACCUMULO', displayName: 'Accumulo'}),
-      App.ServiceConfigCategory.create({ name: 'AMBARI_METRICS', displayName: 'Ambari Metrics'})
+      App.ServiceConfigCategory.create({ name: 'AMBARI_METRICS', displayName: 'Ambari Metrics'}),
+      App.ServiceConfigCategory.create({ name: 'HAWQ', displayName: 'HAWQ'})
     ],
-    sites: ['core-site', 'hdfs-site', 'hbase-site', 'accumulo-site', 'ams-hbase-site'],
+    sites: ['core-site', 'hdfs-site', 'hbase-site', 'accumulo-site', 'ams-hbase-site', 'hawq-site'],
     configs: [
     /**********************************************HDFS***************************************/
       {
@@ -250,6 +251,18 @@ module.exports =
         "isVisible": false,
         "filename": "ams-hbase-site",
         "serviceName": 'MISC'
+      },
+    /**********************************************HAWQ***************************************/
+      {
+        "name": "hawq_dfs_url",
+        "displayName": "hawq_dfs_url",
+        "description": "URL for Accessing HDFS",
+        "isReconfigurable": false,
+        "recommendedValue": "haCluster/hawq_default",
+        "value": "haCluster/hawq_default",
+        "category": "HAWQ",
+        "filename": "hawq-site",
+        "serviceName": 'MISC'
       }
     ]
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 4ce2592..82b3b4a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1212,8 +1212,9 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step9.task2.title':'Start Failover Controllers',
   'admin.highAvailability.wizard.step9.task3.title':'Reconfigure HBase',
   'admin.highAvailability.wizard.step9.task4.title':'Reconfigure Accumulo',
-  'admin.highAvailability.wizard.step9.task5.title':'Delete Secondary NameNode',
-  'admin.highAvailability.wizard.step9.task6.title':'Start All Services',
+  'admin.highAvailability.wizard.step9.task5.title':'Reconfigure Hawq',
+  'admin.highAvailability.wizard.step9.task6.title':'Delete Secondary NameNode',
+  'admin.highAvailability.wizard.step9.task7.title':'Start All Services',
   'admin.highAvailability.wizard.step9.notice.completed':'NameNode HA has been enabled successfully.',
 
   'admin.highAvailability.wizard.step3.curNameNode': '<b>Current NameNode:</b> ',
@@ -2815,4 +2816,4 @@ Em.I18n.translations = {
   'utils.ajax.defaultErrorPopupBody.statusCode': '{0} status code',
 
   'wizard.inProgress': '{0} in Progress'
-};
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/app/utils/configs/nn_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/nn_ha_config_initializer.js b/ambari-web/app/utils/configs/nn_ha_config_initializer.js
index 9e18c0b..80eca42 100644
--- a/ambari-web/app/utils/configs/nn_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/nn_ha_config_initializer.js
@@ -120,6 +120,7 @@ App.NnHaConfigInitializer = App.HaConfigInitializerClass.create({
 
   uniqueInitializers: {
     'hbase.rootdir': '_initHbaseRootDir',
+    'hawq_dfs_url': '_initHawqDfsUrl',
     'instance.volumes': '_initInstanceVolumes',
     'instance.volumes.replacements': '_initInstanceVolumesReplacements',
     'dfs.journalnode.edits.dir': '_initDfsJnEditsDir'
@@ -283,6 +284,28 @@ App.NnHaConfigInitializer = App.HaConfigInitializerClass.create({
   },
 
   /**
+   * Unique initializer for <code>hawq_dfs_url</code> (Hawq service)
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {nnHaConfigDependencies} dependencies
+   * @param {object} initializer
+   * @method _initHawqDfsUrl
+   * @return {object}
+   * @private
+   */
+  _initHawqDfsUrl: function (configProperty, localDB, dependencies, initializer) {
+    if (localDB.installedServices.contains('HAWQ')) {
+      var value = dependencies.serverConfigs.findProperty('type', 'hawq-site').properties['hawq_dfs_url'].replace(/(^.*:[0-9]+)(?=\/)/, dependencies.namespaceId);
+      Em.setProperties(configProperty, {
+        value: value,
+        recommendedValue: value
+      });
+    }
+    return configProperty;
+  },
+
+  /**
    * Unique initializer for <code>instance.volumes</code>
    *
    * @param {configProperty} configProperty
@@ -352,4 +375,4 @@ App.NnHaConfigInitializer = App.HaConfigInitializerClass.create({
     return configProperty;
   }
 
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b810e14/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
index 75f4e53..7fbb4ca 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
@@ -56,6 +56,12 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
         properties: {
           'instance.volumes': 'hdfs://localhost:8020/apps/accumulo/data'
         }
+      },
+      {
+        type: 'hawq-site',
+        properties: {
+          'hawq_dfs_url': 'localhost:8020/hawq_default'
+        }
       }
     ]
   };
@@ -215,7 +221,7 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
       var get = sinon.stub(App, 'get');
       get.withArgs('isHadoopWindowsStack').returns(true);
       sinon.stub(App.Service, 'find', function () {
-        return [{serviceName: 'HDFS'}, {serviceName: 'HBASE'}, {serviceName: 'AMBARI_METRICS'}, {serviceName: 'ACCUMULO'}]
+        return [{serviceName: 'HDFS'}, {serviceName: 'HBASE'}, {serviceName: 'AMBARI_METRICS'}, {serviceName: 'ACCUMULO'}, {serviceName: 'HAWQ'}]
       });
     });
 
@@ -310,6 +316,13 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
           name: 'dfs.journalnode.edits.dir'
         },
         value: '/hadoop/hdfs/journalnode123'
+      },
+      {
+        config: {
+          name: 'hawq_dfs_url',
+          filename: 'hawq-site'
+        },
+        value: nameServiceId + '/hawq_default'
       }
     ]).forEach(function (test) {
       it(test.config.name, function () {