Browse Source

AMBARI-7220. Ambari NN HA wizard cannot detect checkpoint. (akovalenko)

Aleksandr Kovalenko 10 years ago
parent
commit
245cf1bae0

+ 18 - 11
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step4_controller.js

@@ -28,6 +28,8 @@ App.HighAvailabilityWizardStep4Controller = Em.Controller.extend({
 
   isNextEnabled: false,
 
+  isNameNodeStarted: true,
+
   pullCheckPointStatus: function () {
     var hostName = this.get('content.masterComponentHosts').findProperty('isCurNameNode', true).hostName;
     App.ajax.send({
@@ -41,18 +43,23 @@ App.HighAvailabilityWizardStep4Controller = Em.Controller.extend({
   },
 
   checkNnCheckPointStatus: function (data) {
-    var self = this;
-    var journalTransactionInfo =  $.parseJSON(data.metrics.dfs.namenode.JournalTransactionInfo);
-    var isInSafeMode = (data.metrics.dfs.namenode.Safemode != "");
-    journalTransactionInfo = parseInt(journalTransactionInfo.LastAppliedOrWrittenTxId) - parseInt(journalTransactionInfo.MostRecentCheckpointTxId);
-    if(journalTransactionInfo <= 1 && isInSafeMode){
-      this.set("isNextEnabled", true);
-      return;
-    }
+    if (data.HostRoles.desired_state === 'STARTED') {
+      this.set('isNameNodeStarted', true);
+      var self = this;
+      var journalTransactionInfo = $.parseJSON(data.metrics.dfs.namenode.JournalTransactionInfo);
+      var isInSafeMode = (data.metrics.dfs.namenode.Safemode != "");
+      journalTransactionInfo = parseInt(journalTransactionInfo.LastAppliedOrWrittenTxId) - parseInt(journalTransactionInfo.MostRecentCheckpointTxId);
+      if (journalTransactionInfo <= 1 && isInSafeMode) {
+        this.set("isNextEnabled", true);
+        return;
+      }
 
-    window.setTimeout(function () {
-      self.pullCheckPointStatus()
-    }, self.POLL_INTERVAL);
+      window.setTimeout(function () {
+        self.pullCheckPointStatus()
+      }, self.POLL_INTERVAL);
+    } else {
+      this.set('isNameNodeStarted', false);
+    }
   },
 
   done: function () {

+ 2 - 4
ambari-web/app/controllers/main/service/item.js

@@ -163,9 +163,9 @@ App.MainServiceItemController = Em.Controller.extend({
 
   startStopPopupPrimary: function (serviceHealth, query, runMmOperation) {
     var requestInfo = "";
-    var turnOnMM = "ON"
+    var turnOnMM = "ON";
     if (serviceHealth == "STARTED") {
-      turnOnMM = "OFF"
+      turnOnMM = "OFF";
       requestInfo = App.BackgroundOperationsController.CommandContexts.START_SERVICE.format(this.get('content.serviceName'));
     } else {
       requestInfo = App.BackgroundOperationsController.CommandContexts.STOP_SERVICE.format(this.get('content.serviceName'));
@@ -189,8 +189,6 @@ App.MainServiceItemController = Em.Controller.extend({
       'error': 'startStopPopupErrorCallback',
       'data': data
     });
-    this.set('isStopDisabled', true);
-    this.set('isStartDisabled', true);
   },
 
   /**

+ 1 - 0
ambari-web/app/messages.js

@@ -883,6 +883,7 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step2.header':'Select Hosts',
   'admin.highAvailability.wizard.step3.header':'Review',
   'admin.highAvailability.wizard.step4.header':'Create Checkpoint',
+  'admin.highAvailability.wizard.step4.error.nameNode':'NameNode is not started. Please quit wizard and start NameNode first.',
   'admin.highAvailability.wizard.step5.header':'Configure Components',
   'admin.highAvailability.wizard.step6.header':'Initialize JournalNodes',
   'admin.highAvailability.wizard.step7.header':'Start Components',

+ 5 - 0
ambari-web/app/templates/main/admin/highAvailability/nameNode/step4.hbs

@@ -17,6 +17,11 @@
 }}
 <div id="ha-step4">
   <h2>{{t admin.highAvailability.wizard.step4.bodyHeader}}</h2>
+  {{#unless controller.isNameNodeStarted}}
+    <div class="alert alert-error">
+      {{t admin.highAvailability.wizard.step4.error.nameNode}}
+    </div>
+  {{/unless}}
   <div class="alert alert-info">
     {{{view.step4BodyText}}}
   </div>