[webui] Add warning for even number of masters

Preview at 
https://github.com/wdberkeley/kudu/blob/warnevenmasters_screenshots/www/evenmasterwarning.png

Change-Id: I9838ca99423722492bc2d4f27eb5fd8f5cbb199c
Reviewed-on: http://gerrit.cloudera.org:8080/9513
Reviewed-by: Todd Lipcon <t...@apache.org>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: dbcd6218010ef71cb32b0774a8a7da0d48969962
Parents: 72eb86f
Author: Will Berkeley <wdberke...@apache.org>
Authored: Tue Mar 6 12:36:06 2018 -0800
Committer: Will Berkeley <wdberke...@gmail.com>
Committed: Tue Mar 6 22:23:55 2018 +0000

----------------------------------------------------------------------
 src/kudu/master/master_options.cc       | 1 +
 src/kudu/master/master_path_handlers.cc | 1 +
 www/masters.mustache                    | 7 +++++++
 3 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/dbcd6218/src/kudu/master/master_options.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master_options.cc 
b/src/kudu/master/master_options.cc
index e5e4333..bad65cf 100644
--- a/src/kudu/master/master_options.cc
+++ b/src/kudu/master/master_options.cc
@@ -53,6 +53,7 @@ MasterOptions::MasterOptions() {
           "master_addresses flag ('" << FLAGS_master_addresses << "') only 
specifies "
                  << master_addresses.size() << " masters.";
     }
+    // TODO(wdberkeley): Un-actionable warning. Link to docs, once they exist.
     if (master_addresses.size() == 2) {
       LOG(WARNING) << "Only 2 masters are specified by master_addresses_flag 
('" <<
           FLAGS_master_addresses << "'), but minimum of 3 are required to 
tolerate failures"

http://git-wip-us.apache.org/repos/asf/kudu/blob/dbcd6218/src/kudu/master/master_path_handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master_path_handlers.cc 
b/src/kudu/master/master_path_handlers.cc
index d06ddd1..15da46f 100644
--- a/src/kudu/master/master_path_handlers.cc
+++ b/src/kudu/master/master_path_handlers.cc
@@ -387,6 +387,7 @@ void MasterPathHandlers::HandleMasters(const 
Webserver::WebRequest& /*req*/,
     (*output)["error"] = msg;
     return;
   }
+  output->Set("even_masters", masters.size() % 2 == 0);
   output->Set("masters", EasyJson::kArray);
   for (const ServerEntryPB& master : masters) {
     EasyJson master_json = (*output)["masters"].PushBack(EasyJson::kObject);

http://git-wip-us.apache.org/repos/asf/kudu/blob/dbcd6218/www/masters.mustache
----------------------------------------------------------------------
diff --git a/www/masters.mustache b/www/masters.mustache
index 3b79425..0b7a6b2 100644
--- a/www/masters.mustache
+++ b/www/masters.mustache
@@ -19,6 +19,13 @@ under the License.
 {{#error}}
   <div class="text-error">{{.}}</div>
 {{/error}}
+{{#even_masters}}
+  {{! TODO(wdberkeley): Un-actionable warning. Link to add/remove master docs 
once they exist. }}
+  <div class="alert alert-danger" role="alert">WARNING: There are an even 
number of master peers.
+    This provides no more fault tolerance than having one less master.
+    In particular, 2 masters cannot tolerate the failure of a single master.
+  </div>
+{{/even_masters}}
 {{^error}}
   <h2>Masters</h2>
   <table class='table table-striped'>

Reply via email to