You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/04/17 16:57:16 UTC

ambari git commit: AMBARI-10568. Rolling Restart: batch size is fixed and cannot be changed. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 51b2c338b -> 77e77010c


AMBARI-10568. Rolling Restart: batch size is fixed and cannot be changed. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 77e77010c8b142d6228a8cb4f8cf9e137f115abf
Parents: 51b2c33
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Apr 17 17:09:43 2015 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Apr 17 17:29:16 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 .../templates/common/rolling_restart_view.hbs   | 11 ++++++++-
 .../app/views/common/rolling_restart_view.js    | 25 ++++++++++++++++----
 .../views/common/rolling_restart_view_test.js   | 12 ++++++++++
 4 files changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/77e77010/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 86a1b4b..28238ed 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2478,6 +2478,7 @@ Em.I18n.translations = {
   'rollingrestart.dialog.err.invalid.batchsize': 'Invalid restart batch size: {0}',
   'rollingrestart.dialog.err.invalid.waitTime': 'Invalid wait time between batches: {0}',
   'rollingrestart.dialog.err.invalid.toleratesize': 'Invalid failure toleration count: {0}',
+  'rollingrestart.dialog.warn.datanode.batch.size': 'Restarting more than one DataNode at a time is not recommended. Doing so can lead to data unavailability and/or possible loss of data being actively written to HFDS.',
   'rollingrestart.dialog.msg.serviceNotInMM':'Note: This will trigger alerts. To suppress alerts, turn on Maintenance Mode for {0} prior to triggering a rolling restart',
   'rollingrestart.dialog.msg.staleConfigsOnly': 'Only restart {0}s with stale configs',
   'rollingrestart.rest.context': 'Rolling Restart of {0}s - batch {1} of {2}',

http://git-wip-us.apache.org/repos/asf/ambari/blob/77e77010/ambari-web/app/templates/common/rolling_restart_view.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/rolling_restart_view.hbs b/ambari-web/app/templates/common/rolling_restart_view.hbs
index d443376..93efdb5 100644
--- a/ambari-web/app/templates/common/rolling_restart_view.hbs
+++ b/ambari-web/app/templates/common/rolling_restart_view.hbs
@@ -71,7 +71,7 @@
     <div class="spinner"></div>
   {{/if}}
   {{#if view.errors}}
-    <div class="alert alert-warn">
+    <div class="alert alert-error">
       <ul>
       {{#each error in view.errors}}
         <li>{{error}}</li>
@@ -79,4 +79,13 @@
       </ul>
     </div>
   {{/if}}
+  {{#if view.warnings}}
+    <div class="alert alert-warn">
+      <ul>
+      {{#each warning in view.warnings}}
+        <li>{{warning}}</li>
+      {{/each}}
+      </ul>
+    </div>
+  {{/if}}
 </div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/77e77010/ambari-web/app/views/common/rolling_restart_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/rolling_restart_view.js b/ambari-web/app/views/common/rolling_restart_view.js
index 652e94f..d84f9c6 100644
--- a/ambari-web/app/views/common/rolling_restart_view.js
+++ b/ambari-web/app/views/common/rolling_restart_view.js
@@ -92,13 +92,18 @@ App.RollingRestartView = Em.View.extend({
    */
   errors : [],
   /**
+   * List of warnings in batch-request properties, do not disable submit button
+   * @type {Array}
+   */
+  warnings : [],
+  /**
    * Set initial values for batch-request properties
    */
   initialize : function() {
     if (this.get('batchSize') == -1 && this.get('interBatchWaitTimeSeconds') == -1 && this.get('tolerateSize') == -1) {
       var restartCount = this.get('restartHostComponents.length');
       var batchSize = 1;
-      if (restartCount > 10) {
+      if (restartCount > 10 && this.get('hostComponentName') !== 'DATANODE') {
         batchSize = Math.ceil(restartCount / 10);
       }
       var tolerateCount = batchSize;
@@ -115,16 +120,27 @@ App.RollingRestartView = Em.View.extend({
    */
   validate : function() {
     var displayName = this.get('hostComponentDisplayName');
+    var componentName = this.get('hostComponentName');
     var totalCount = this.get('restartHostComponents.length');
     var bs = this.get('batchSize');
     var ts = this.get('tolerateSize');
     var wait = this.get('interBatchWaitTimeSeconds');
     var errors = [];
+    var warnings = [];
+    var bsError, tsError, waitError;
     if (totalCount < 1) {
       errors.push(Em.I18n.t('rollingrestart.dialog.msg.noRestartHosts').format(displayName));
     } else {
-      var bsError = numberUtils.validateInteger(bs, 1, totalCount);
-      var tsError = numberUtils.validateInteger(ts, 0, totalCount);
+      if (componentName === 'DATANODE') {
+        // specific case for DataNodes batch size is more than 1
+        if (bs > 1) {
+          warnings.push(Em.I18n.t('rollingrestart.dialog.warn.datanode.batch.size'));
+        }
+        bsError = numberUtils.validateInteger(bs, 1, NaN);
+      } else {
+        bsError = numberUtils.validateInteger(bs, 1, totalCount);
+      }
+      tsError = numberUtils.validateInteger(ts, 0, totalCount);
       if (bsError != null) {
         errors.push(Em.I18n.t('rollingrestart.dialog.err.invalid.batchsize').format(bsError));
       }
@@ -132,11 +148,12 @@ App.RollingRestartView = Em.View.extend({
         errors.push(Em.I18n.t('rollingrestart.dialog.err.invalid.toleratesize').format(tsError));
       }
     }
-    var waitError = numberUtils.validateInteger(wait, 0, NaN);
+    waitError = numberUtils.validateInteger(wait, 0, NaN);
     if (waitError != null) {
       errors.push(Em.I18n.t('rollingrestart.dialog.err.invalid.waitTime').format(waitError));
     }
     this.set('errors', errors);
+    this.set('warnings', warnings);
   }.observes('batchSize', 'interBatchWaitTimeSeconds', 'tolerateSize', 'restartHostComponents', 'hostComponentDisplayName'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/77e77010/ambari-web/test/views/common/rolling_restart_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/rolling_restart_view_test.js b/ambari-web/test/views/common/rolling_restart_view_test.js
index bd139b1..694f876 100644
--- a/ambari-web/test/views/common/rolling_restart_view_test.js
+++ b/ambari-web/test/views/common/rolling_restart_view_test.js
@@ -35,6 +35,7 @@ describe('App.RollingRestartView', function () {
         }
       },
       {
+        hostComponentName: 'NOT_DATANODE',
         restartHostComponents: new Array(10),
         result: {
           batchSize: 1,
@@ -42,6 +43,7 @@ describe('App.RollingRestartView', function () {
         }
       },
       {
+        hostComponentName: 'NOT_DATANODE',
         restartHostComponents: new Array(11),
         result: {
           batchSize: 2,
@@ -49,11 +51,20 @@ describe('App.RollingRestartView', function () {
         }
       },
       {
+        hostComponentName: 'NOT_DATANODE',
         restartHostComponents: new Array(20),
         result: {
           batchSize: 2,
           tolerateSize: 2
         }
+      },
+      {
+        hostComponentName: 'DATANODE',
+        restartHostComponents: new Array(20),
+        result: {
+          batchSize: 1,
+          tolerateSize: 1
+        }
       }
     ];
 
@@ -62,6 +73,7 @@ describe('App.RollingRestartView', function () {
         view.set('batchSize', -1);
         view.set('interBatchWaitTimeSeconds', -1);
         view.set('tolerateSize', -1);
+        view.set('hostComponentName', test.hostComponentName);
         view.set('restartHostComponents', test.restartHostComponents);
         view.initialize();
         expect(view.get('batchSize')).to.equal(test.result.batchSize);