You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/22 23:11:49 UTC

[1/4] mesos git commit: Updated `high-availability` and `operational-guide` docs.

Repository: mesos
Updated Branches:
  refs/heads/master 97bc9cab1 -> bb52b44a3


Updated `high-availability` and `operational-guide` docs.

In this change, we update the `high-availability` and
`operational-guide` documents about master HTTP endpoints redirection
behavior when the current master is not the leader.

Review: https://reviews.apache.org/r/46473/


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

Branch: refs/heads/master
Commit: bb52b44a330c2d49abd0044cef7ff9a100e35414
Parents: aac192c
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Apr 22 14:10:52 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Apr 22 14:11:39 2016 -0700

----------------------------------------------------------------------
 docs/high-availability.md | 4 ++++
 docs/operational-guide.md | 3 +++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bb52b44a/docs/high-availability.md
----------------------------------------------------------------------
diff --git a/docs/high-availability.md b/docs/high-availability.md
index b0e744e..a8b4fce 100644
--- a/docs/high-availability.md
+++ b/docs/high-availability.md
@@ -26,6 +26,10 @@ To put Mesos into high-availability mode:
 
 From now on, the Mesos masters and slaves all communicate with ZooKeeper to find out which master is the current leading master. This is in addition to the usual communication between the leading master and the slaves.
 
+In addition to ZooKeeper, one can get the location of the leading master by sending an HTTP request to [/redirect](master/redirect.md) endpoint on any master.
+
+For HTTP endpoints that only work at the leading master, requests made to endpoints at a non-leading master will result in either a `307 Temporary Redirect` (with the location of the leading master) or `503 Service Unavailable` (if the master does not know who the current leader is).
+
 Refer to the [Scheduler API](app-framework-development-guide.md) for how to deal with leadership changes.
 
 ## Component Disconnection Handling

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb52b44a/docs/operational-guide.md
----------------------------------------------------------------------
diff --git a/docs/operational-guide.md b/docs/operational-guide.md
index 5ae7ede..193cf0a 100644
--- a/docs/operational-guide.md
+++ b/docs/operational-guide.md
@@ -64,3 +64,6 @@ Please see the NOTE section above. So long as the failed master is guaranteed to
 
 ## External access for Mesos master
 If the default IP (or the command line arg `--ip`) is an internal IP, then external entities such as framework schedulers will be unable to reach the master. To address that scenario, an externally accessible IP:port can be setup via the `--advertise_ip` and `--advertise_port` command line arguments of `mesos-master`. If configured, external entities such as framework schedulers interact with the advertise_ip:advertise_port from where the request needs to be proxied to the internal IP:port on which the Mesos master is listening.
+
+## HTTP requests to non-leading master
+HTTP requests to some master endpoints (e.g., [/state](master/state.md), [/machine/down](master/machine/down.md)) can only be answered by the leading master. Such requests made to a non-leading master will result in either a `307 Temporary Redirect` (with the location of the leading master) or `503 Service Unavailable` (if the master does not know who the current leader is).


[2/4] mesos git commit: Updated descriptions for master endpoints which may return redirect.

Posted by vi...@apache.org.
Updated descriptions for master endpoints which may return redirect.

Update master endpoints descriptions about `TEMPORARY_REDIRECT` and
`SERVICE_UNAVAILABLE` when current master is not the leader.

Review: https://reviews.apache.org/r/46471/


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

Branch: refs/heads/master
Commit: ba4328d4bae33f6d3dbe007cbd63fbe5220a0508
Parents: c915333
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Apr 22 14:10:29 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Apr 22 14:11:39 2016 -0700

----------------------------------------------------------------------
 src/master/http.cpp | 129 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 109 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ba4328d4/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 38fe498..4f489fb 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -329,7 +329,11 @@ string Master::Http::SCHEDULER_HELP()
     TLDR(
         "Endpoint for schedulers to make calls against the master."),
     DESCRIPTION(
-        "Returns 202 Accepted iff the request is accepted."),
+        "Returns 202 Accepted iff the request is accepted.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found."),
     AUTHENTICATION(false));
 }
 
@@ -563,6 +567,10 @@ string Master::Http::CREATE_VOLUMES_HELP()
     DESCRIPTION(
         "Returns 202 ACCEPTED which indicates that the create",
         "operation has been validated successfully by the master.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "The request is then forwarded asynchronously to the Mesos",
         "agent where the reserved resources are located.",
         "That asynchronous message may not be delivered or",
@@ -683,6 +691,10 @@ string Master::Http::DESTROY_VOLUMES_HELP()
     DESCRIPTION(
         "Returns 202 ACCEPTED which indicates that the destroy",
         "operation has been validated successfully by the master.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "The request is then forwarded asynchronously to the Mesos",
         "agent where the reserved resources are located.",
         "That asynchronous message may not be delivered or",
@@ -783,6 +795,12 @@ string Master::Http::FRAMEWORKS_HELP()
 {
   return HELP(
     TLDR("Exposes the frameworks info."),
+    DESCRIPTION(
+        "Returns 200 OK when the frameworks info was queried successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found."),
     AUTHENTICATION(true));
 }
 
@@ -982,9 +1000,10 @@ string Master::Http::REDIRECT_HELP()
     TLDR(
         "Redirects to the leading Master."),
     DESCRIPTION(
-        "This returns a 307 Temporary Redirect to the leading Master.",
-        "If no Master is leading (according to this Master), then the",
-        "Master will redirect to itself.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "",
         "**NOTES:**",
         "1. This is the recommended way to bookmark the WebUI when",
@@ -1047,6 +1066,10 @@ string Master::Http::RESERVE_HELP()
     DESCRIPTION(
         "Returns 202 ACCEPTED which indicates that the reserve",
         "operation has been validated successfully by the master.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "The request is then forwarded asynchronously to the Mesos",
         "agent where the reserved resources are located.",
         "That asynchronous message may not be delivered or",
@@ -1153,6 +1176,11 @@ string Master::Http::SLAVES_HELP()
     TLDR(
         "Information about registered agents."),
     DESCRIPTION(
+        "Returns 200 OK when the request was processed successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "This endpoint shows information about the agents registered in",
         "this master formatted as a JSON object."),
     AUTHENTICATION(true));
@@ -1232,6 +1260,11 @@ string Master::Http::QUOTA_HELP()
     TLDR(
         "Sets quota for a role."),
     DESCRIPTION(
+        "Returns 200 OK when the quota has been changed successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "POST: Validates the request body as JSON",
         " and sets quota for a role."),
     AUTHENTICATION(true));
@@ -1275,6 +1308,11 @@ string Master::Http::WEIGHTS_HELP()
     TLDR(
         "Updates weights for the specified roles."),
     DESCRIPTION(
+        "Returns 200 OK when the weights update was successful.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "PUT: Validates the request body as JSON",
         "and updates the weights for the specified roles."),
     AUTHENTICATION(true));
@@ -1313,6 +1351,11 @@ string Master::Http::STATE_HELP()
     TLDR(
         "Information about state of master."),
     DESCRIPTION(
+        "Returns 200 OK when the state of the master was queried successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "This endpoint shows information about the frameworks, tasks,",
         "executors and agents running in the cluster as a JSON object.",
         "",
@@ -1664,6 +1707,12 @@ string Master::Http::STATESUMMARY_HELP()
     TLDR(
         "Summary of state of all tasks and registered frameworks in cluster."),
     DESCRIPTION(
+        "Returns 200 OK when a summary of the master's state was queried",
+        "successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "This endpoint gives a summary of the state of all tasks and",
         "registered frameworks in the cluster as a JSON object."),
     AUTHENTICATION(true));
@@ -1789,6 +1838,11 @@ string Master::Http::ROLES_HELP()
     TLDR(
         "Information about roles."),
     DESCRIPTION(
+        "Returns 200 OK when information about roles was queried successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "This endpoint provides information about roles as a JSON object.",
         "It returns information about every role that is on the role",
         "whitelist (if enabled), has one or more registered frameworks,",
@@ -1905,9 +1959,13 @@ string Master::Http::TEARDOWN_HELP()
         "Tears down a running framework by shutting down all tasks/executors "
         "and removing the framework."),
     DESCRIPTION(
+        "Returns 200 OK if the framework was torn down successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "Please provide a \"frameworkId\" value designating the running",
-        "framework to tear down.",
-        "Returns 200 OK if the framework was correctly teared down."),
+        "framework to tear down."),
     AUTHENTICATION(true));
 }
 
@@ -1996,18 +2054,23 @@ string Master::Http::TASKS_HELP()
 {
   return HELP(
     TLDR(
-      "Lists tasks from all active frameworks."),
+        "Lists tasks from all active frameworks."),
     DESCRIPTION(
-      "Lists known tasks.",
-      "",
-      "Query parameters:",
-      "",
-      ">        limit=VALUE          Maximum number of tasks returned "
-      "(default is " + stringify(TASK_LIMIT) + ").",
-      ">        offset=VALUE         Starts task list at offset.",
-      ">        order=(asc|desc)     Ascending or descending sort order "
-      "(default is descending)."
-      ""),
+        "Returns 200 OK when task information was queried successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
+        "Lists known tasks.",
+        "",
+        "Query parameters:",
+        "",
+        ">        limit=VALUE          Maximum number of tasks returned "
+        "(default is " + stringify(TASK_LIMIT) + ").",
+        ">        offset=VALUE         Starts task list at offset.",
+        ">        order=(asc|desc)     Ascending or descending sort order "
+        "(default is descending)."
+        ""),
     AUTHENTICATION(true));
 }
 
@@ -2127,6 +2190,12 @@ string Master::Http::MAINTENANCE_SCHEDULE_HELP()
     TLDR(
         "Returns or updates the cluster's maintenance schedule."),
     DESCRIPTION(
+        "Returns 200 OK when the requested maintenance operation was performed",
+        "successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "GET: Returns the current maintenance schedule as JSON.",
         "",
         "POST: Validates the request body as JSON",
@@ -2271,6 +2340,11 @@ string Master::Http::MACHINE_DOWN_HELP()
     TLDR(
         "Brings a set of machines down."),
     DESCRIPTION(
+        "Returns 200 OK when the operation was successful.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "POST: Validates the request body as JSON and transitions",
         "  the list of machines into DOWN mode.  Currently, only",
         "  machines in DRAINING mode are allowed to be brought down."),
@@ -2382,6 +2456,11 @@ string Master::Http::MACHINE_UP_HELP()
     TLDR(
         "Brings a set of machines back up."),
     DESCRIPTION(
+        "Returns 200 OK when the operation was successful.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "POST: Validates the request body as JSON and transitions",
         "  the list of machines into UP mode.  This also removes",
         "  the list of machines from the maintenance schedule."),
@@ -2492,11 +2571,17 @@ string Master::Http::MAINTENANCE_STATUS_HELP()
     TLDR(
         "Retrieves the maintenance status of the cluster."),
     DESCRIPTION(
+        "Returns 200 OK when the maintenance status was queried successfully.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "Returns an object with one list of machines per machine mode.",
         "For draining machines, this list includes the frameworks' responses",
-        "to inverse offers.  NOTE: Inverse offer responses are cleared if",
-        "the master fails over.  However, new inverse offers will be sent",
-        "once the master recovers."),
+        "to inverse offers.",
+        "**NOTE**:",
+        "Inverse offer responses are cleared if the master fails over.",
+        "However, new inverse offers will be sent once the master recovers."),
     AUTHENTICATION(true));
 }
 
@@ -2578,6 +2663,10 @@ string Master::Http::UNRESERVE_HELP()
     DESCRIPTION(
         "Returns 202 ACCEPTED which indicates that the unreserve",
         "operation has been validated successfully by the master.",
+        "Returns 307 TEMPORARY_REDIRECT redirect to the leading master when",
+        "current master is not the leader.",
+        "Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be",
+        "found.",
         "The request is then forwarded asynchronously to the Mesos",
         "agent where the reserved resources are located.",
         "That asynchronous message may not be delivered or",


[4/4] mesos git commit: Redirected some HTTP requests to the leading master.

Posted by vi...@apache.org.
Redirected some HTTP requests to the leading master.

HTTP requests to certain endpoints are redirected to the leading master
if the current master is not the leader. These endpoints do not contain
meaningful information at non-leading masters.

Review: https://reviews.apache.org/r/34646/


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

Branch: refs/heads/master
Commit: c9153336165b50cb140d4115ae85d2593a7b066f
Parents: 97bc9ca
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Apr 22 14:08:03 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Apr 22 14:11:39 2016 -0700

----------------------------------------------------------------------
 src/master/http.cpp | 123 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 110 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c9153336/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 58f6a00..38fe498 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -342,14 +342,11 @@ Future<Response> Master::Http::scheduler(
 
   // TODO(vinod): Add support for rate limiting.
 
+  // When current master is not the leader, redirect to the leading master.
+  // Note that this could happen if the scheduler realizes this is the
+  // leading master before master itself realizes it (e.g., ZK watch delay).
   if (!master->elected()) {
-    // Note that this could happen if the scheduler realizes this is the
-    // leading master before master itself realizes it (e.g., ZK watch delay).
-    if (master->leader.isNone()) {
-      return ServiceUnavailable("No leader elected");
-    } else {
-      return redirect(request);
-    }
+    return redirect(request);
   }
 
   CHECK_SOME(master->recovered);
@@ -594,6 +591,11 @@ Future<Response> Master::Http::createVolumes(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -696,6 +698,11 @@ Future<Response> Master::Http::destroyVolumes(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -784,6 +791,11 @@ Future<Response> Master::Http::frameworks(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   auto frameworks = [this](JSON::ObjectWriter* writer) {
     // Model all of the frameworks.
     writer->field("frameworks", [this](JSON::ArrayWriter* writer) {
@@ -986,10 +998,15 @@ string Master::Http::REDIRECT_HELP()
 
 Future<Response> Master::Http::redirect(const Request& request) const
 {
-  // If there's no leader, redirect to this master's base url.
-  MasterInfo info = master->leader.isSome()
-    ? master->leader.get()
-    : master->info_;
+  // If there's no leader, return `ServiceUnavailable`.
+  if (master->leader.isNone()) {
+    LOG(WARNING) << "Current master is not elected as leader, and leader "
+                 << "information is unavailable. Failed to redirect the "
+                 << "request url: " << request.url;
+    return ServiceUnavailable("No leader elected");
+  }
+
+  MasterInfo info = master->leader.get();
 
   // NOTE: Currently, 'info.ip()' stores ip in network order, which
   // should be fixed. See MESOS-1201 for details.
@@ -1001,14 +1018,24 @@ Future<Response> Master::Http::redirect(const Request& request) const
     return InternalServerError(hostname.error());
   }
 
+  LOG(INFO) << "Redirecting request for " << request.url
+            << " to the leading master " << hostname.get();
+
   // NOTE: We can use a protocol-relative URL here in order to allow
   // the browser (or other HTTP client) to prefix with 'http:' or
   // 'https:' depending on the original request. See
   // https://tools.ietf.org/html/rfc7231#section-7.1.2 as well as
   // http://stackoverflow.com/questions/12436669/using-protocol-relative-uris-within-location-headers
   // which discusses this.
-  return TemporaryRedirect(
-    "//" + hostname.get() + ":" + stringify(info.port()) + request.url.path);
+  string basePath = "//" + hostname.get() + ":" + stringify(info.port());
+  if (request.url.path == "/redirect" ||
+      request.url.path == "/" + master->self().id + "/redirect") {
+    // When request url is '/redirect' or '/master/redirect', redirect to the
+    // base url of leading master to avoid infinite redirect loop.
+    return TemporaryRedirect(basePath);
+  } else {
+    return TemporaryRedirect(basePath + request.url.path);
+  }
 }
 
 
@@ -1035,6 +1062,11 @@ Future<Response> Master::Http::reserve(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -1131,6 +1163,11 @@ Future<Response> Master::Http::slaves(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   auto slaves = [this](JSON::ObjectWriter* writer) {
     writer->field("slaves", [this](JSON::ArrayWriter* writer) {
       foreachvalue (const Slave* slave, master->slaves.registered) {
@@ -1205,6 +1242,11 @@ Future<Response> Master::Http::quota(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   // Dispatch based on HTTP method to separate `QuotaHandler`.
   if (request.method == "GET") {
     return quotaHandler.status(request);
@@ -1243,6 +1285,11 @@ Future<Response> Master::Http::weights(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   // TODO(Yongqiao Wang): `/roles` endpoint also shows the weights information,
   // consider erasing the duplicated information later.
   if (request.method == "GET") {
@@ -1346,6 +1393,11 @@ Future<Response> Master::Http::state(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   auto state = [this](JSON::ObjectWriter* writer) {
     writer->field("version", MESOS_VERSION);
 
@@ -1622,6 +1674,11 @@ Future<Response> Master::Http::stateSummary(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   auto stateSummary = [this](JSON::ObjectWriter* writer) {
     writer->field("hostname", master->info().hostname());
 
@@ -1783,6 +1840,11 @@ Future<Response> Master::Http::roles(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   JSON::Object object;
 
   // Compute the role names to return results for. When an explicit
@@ -1854,6 +1916,11 @@ Future<Response> Master::Http::teardown(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -1993,6 +2060,11 @@ Future<Response> Master::Http::tasks(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   // Get list options (limit and offset).
   Result<int> result = numify<int>(request.url.query.get("limit"));
   size_t limit = result.isSome() ? result.get() : TASK_LIMIT;
@@ -2068,6 +2140,11 @@ Future<Response> Master::Http::maintenanceSchedule(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "GET" && request.method != "POST") {
     return MethodNotAllowed(
         {"GET", "POST"},
@@ -2206,6 +2283,11 @@ Future<Response> Master::Http::machineDown(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -2312,6 +2394,11 @@ Future<Response> Master::Http::machineUp(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");
@@ -2419,6 +2506,11 @@ Future<Response> Master::Http::maintenanceStatus(
     const Request& request,
     const Option<string>& /*principal*/) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "GET") {
     return MethodNotAllowed(
         {"GET"}, "Expecting 'GET', received '" + request.method + "'");
@@ -2501,6 +2593,11 @@ Future<Response> Master::Http::unreserve(
     const Request& request,
     const Option<string>& principal) const
 {
+  // When current master is not the leader, redirect to the leading master.
+  if (!master->elected()) {
+    return redirect(request);
+  }
+
   if (request.method != "POST") {
     return MethodNotAllowed(
         {"POST"}, "Expecting 'POST', received '" + request.method + "'");


[3/4] mesos git commit: Reran `generate-endpoint-help.py` script for endpoints redirection.

Posted by vi...@apache.org.
Reran `generate-endpoint-help.py` script for endpoints redirection.

Review: https://reviews.apache.org/r/46472/


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

Branch: refs/heads/master
Commit: aac192c8f5d2945c76796019191d9907106fb419
Parents: ba4328d
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Apr 22 14:10:45 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Apr 22 14:11:39 2016 -0700

----------------------------------------------------------------------
 docs/endpoints/index.md                         |  6 ++-
 docs/endpoints/master/api/v1/scheduler.md       |  4 ++
 docs/endpoints/master/create-volumes.md         | 13 ++++--
 docs/endpoints/master/destroy-volumes.md        | 13 ++++--
 docs/endpoints/master/frameworks.md             |  8 ++++
 docs/endpoints/master/machine/down.md           |  5 +++
 docs/endpoints/master/machine/up.md             |  5 +++
 docs/endpoints/master/maintenance/schedule.md   |  6 +++
 docs/endpoints/master/maintenance/status.md     | 12 ++++--
 docs/endpoints/master/quota.md                  |  5 +++
 docs/endpoints/master/redirect.md               |  7 ++--
 docs/endpoints/master/reserve.md                | 15 +++++--
 docs/endpoints/master/roles.json.md             |  5 +++
 docs/endpoints/master/roles.md                  |  5 +++
 docs/endpoints/master/slaves.md                 |  9 ++++-
 docs/endpoints/master/state-summary.md          |  6 +++
 docs/endpoints/master/state.json.md             |  7 +++-
 docs/endpoints/master/state.md                  |  7 +++-
 docs/endpoints/master/tasks.json.md             |  5 +++
 docs/endpoints/master/tasks.md                  |  5 +++
 docs/endpoints/master/teardown.md               |  6 ++-
 docs/endpoints/master/unreserve.md              | 15 +++++--
 docs/endpoints/master/weights.md                |  5 +++
 docs/endpoints/monitor/statistics.json.md       | 41 +++++++++++++++++++
 docs/endpoints/monitor/statistics.md            | 41 +++++++++++++++++++
 docs/endpoints/slave/health.md                  |  4 +-
 docs/endpoints/slave/monitor/statistics.json.md | 42 --------------------
 docs/endpoints/slave/monitor/statistics.md      | 42 --------------------
 docs/endpoints/slave/state.json.md              |  4 +-
 docs/endpoints/slave/state.md                   |  4 +-
 30 files changed, 235 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/index.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/index.md b/docs/endpoints/index.md
index d57239e..8ef110f 100644
--- a/docs/endpoints/index.md
+++ b/docs/endpoints/index.md
@@ -103,6 +103,10 @@ For example, http://agent.com:5051/files/browse
 ### metrics ###
 * [/metrics/snapshot](metrics/snapshot.md)
 
+### monitor ###
+* [/monitor/statistics](monitor/statistics.md)
+* [/monitor/statistics.json](monitor/statistics.json.md)
+
 ### profiler ###
 * [/profiler/start](profiler/start.md)
 * [/profiler/stop](profiler/stop.md)
@@ -112,8 +116,6 @@ For example, http://agent.com:5051/files/browse
 * [/containers](slave/containers.md)
 * [/flags](slave/flags.md)
 * [/health](slave/health.md)
-* [/monitor/statistics](slave/monitor/statistics.md)
-* [/monitor/statistics.json](slave/monitor/statistics.json.md)
 * [/state](slave/state.md)
 * [/state.json](slave/state.json.md)
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/api/v1/scheduler.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/api/v1/scheduler.md b/docs/endpoints/master/api/v1/scheduler.md
index f647dc0..d590121 100644
--- a/docs/endpoints/master/api/v1/scheduler.md
+++ b/docs/endpoints/master/api/v1/scheduler.md
@@ -13,6 +13,10 @@ Endpoint for schedulers to make calls against the master.
 
 ### DESCRIPTION ###
 Returns 202 Accepted iff the request is accepted.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 
 
 ### AUTHENTICATION ###

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/create-volumes.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/create-volumes.md b/docs/endpoints/master/create-volumes.md
index 5c86480..f6ec938 100644
--- a/docs/endpoints/master/create-volumes.md
+++ b/docs/endpoints/master/create-volumes.md
@@ -12,9 +12,16 @@ layout: documentation
 Create persistent volumes on reserved resources.
 
 ### DESCRIPTION ###
-Returns 202 Accepted if the request was accepted. This does not
-imply that the volume was created successfully: volume
-creation is done asynchronously and may fail.
+Returns 202 ACCEPTED which indicates that the create
+operation has been validated successfully by the master.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+The request is then forwarded asynchronously to the Mesos
+agent where the reserved resources are located.
+That asynchronous message may not be delivered or
+creating the volumes at the agent might fail.
 
 Please provide "slaveId" and "volumes" values designating
 the volumes to be created.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/destroy-volumes.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/destroy-volumes.md b/docs/endpoints/master/destroy-volumes.md
index f75dd52..054e816 100644
--- a/docs/endpoints/master/destroy-volumes.md
+++ b/docs/endpoints/master/destroy-volumes.md
@@ -12,9 +12,16 @@ layout: documentation
 Destroy persistent volumes.
 
 ### DESCRIPTION ###
-Returns 202 Accepted if the request was accepted. This does not
-imply that the volume was destroyed successfully: volume
-destruction is done asynchronously and may fail.
+Returns 202 ACCEPTED which indicates that the destroy
+operation has been validated successfully by the master.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+The request is then forwarded asynchronously to the Mesos
+agent where the reserved resources are located.
+That asynchronous message may not be delivered or
+destroying the volumes at the agent might fail.
 
 Please provide "slaveId" and "volumes" values designating
 the volumes to be destroyed.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/frameworks.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/frameworks.md b/docs/endpoints/master/frameworks.md
index 15ecabf..1aed723 100644
--- a/docs/endpoints/master/frameworks.md
+++ b/docs/endpoints/master/frameworks.md
@@ -12,5 +12,13 @@ layout: documentation
 Exposes the frameworks info.
 
 ### DESCRIPTION ###
+Returns 200 OK when the frameworks info was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+
+
+### AUTHENTICATION ###
 This endpoint requires authentication iff HTTP authentication is
 enabled.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/machine/down.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/machine/down.md b/docs/endpoints/master/machine/down.md
index f7e8141..d2d5e87 100644
--- a/docs/endpoints/master/machine/down.md
+++ b/docs/endpoints/master/machine/down.md
@@ -12,6 +12,11 @@ layout: documentation
 Brings a set of machines down.
 
 ### DESCRIPTION ###
+Returns 200 OK when the operation was successful.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 POST: Validates the request body as JSON and transitions
   the list of machines into DOWN mode.  Currently, only
   machines in DRAINING mode are allowed to be brought down.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/machine/up.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/machine/up.md b/docs/endpoints/master/machine/up.md
index d96be72..aa2fb9b 100644
--- a/docs/endpoints/master/machine/up.md
+++ b/docs/endpoints/master/machine/up.md
@@ -12,6 +12,11 @@ layout: documentation
 Brings a set of machines back up.
 
 ### DESCRIPTION ###
+Returns 200 OK when the operation was successful.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 POST: Validates the request body as JSON and transitions
   the list of machines into UP mode.  This also removes
   the list of machines from the maintenance schedule.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/maintenance/schedule.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/maintenance/schedule.md b/docs/endpoints/master/maintenance/schedule.md
index 3d69900..9244a34 100644
--- a/docs/endpoints/master/maintenance/schedule.md
+++ b/docs/endpoints/master/maintenance/schedule.md
@@ -12,6 +12,12 @@ layout: documentation
 Returns or updates the cluster's maintenance schedule.
 
 ### DESCRIPTION ###
+Returns 200 OK when the requested maintenance operation was performed
+successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 GET: Returns the current maintenance schedule as JSON.
 
 POST: Validates the request body as JSON

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/maintenance/status.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/maintenance/status.md b/docs/endpoints/master/maintenance/status.md
index 249dae2..5174335 100644
--- a/docs/endpoints/master/maintenance/status.md
+++ b/docs/endpoints/master/maintenance/status.md
@@ -12,11 +12,17 @@ layout: documentation
 Retrieves the maintenance status of the cluster.
 
 ### DESCRIPTION ###
+Returns 200 OK when the maintenance status was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 Returns an object with one list of machines per machine mode.
 For draining machines, this list includes the frameworks' responses
-to inverse offers.  NOTE: Inverse offer responses are cleared if
-the master fails over.  However, new inverse offers will be sent
-once the master recovers.
+to inverse offers.
+**NOTE**:
+Inverse offer responses are cleared if the master fails over.
+However, new inverse offers will be sent once the master recovers.
 
 
 ### AUTHENTICATION ###

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/quota.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/quota.md b/docs/endpoints/master/quota.md
index b1e3462..682370f 100644
--- a/docs/endpoints/master/quota.md
+++ b/docs/endpoints/master/quota.md
@@ -12,6 +12,11 @@ layout: documentation
 Sets quota for a role.
 
 ### DESCRIPTION ###
+Returns 200 OK when the quota has been changed successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 POST: Validates the request body as JSON
  and sets quota for a role.
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/redirect.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/redirect.md b/docs/endpoints/master/redirect.md
index 833d993..3387b64 100644
--- a/docs/endpoints/master/redirect.md
+++ b/docs/endpoints/master/redirect.md
@@ -12,9 +12,10 @@ layout: documentation
 Redirects to the leading Master.
 
 ### DESCRIPTION ###
-This returns a 307 Temporary Redirect to the leading Master.
-If no Master is leading (according to this Master), then the
-Master will redirect to itself.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 
 **NOTES:**
 1. This is the recommended way to bookmark the WebUI when

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/reserve.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/reserve.md b/docs/endpoints/master/reserve.md
index 8f38cc0..9bb04ed 100644
--- a/docs/endpoints/master/reserve.md
+++ b/docs/endpoints/master/reserve.md
@@ -9,12 +9,19 @@ layout: documentation
 >        /master/reserve
 
 ### TL;DR; ###
-Reserve resources dynamically on a specific slave.
+Reserve resources dynamically on a specific agent.
 
 ### DESCRIPTION ###
-Returns 202 Accepted if the request was accepted. This does not
-imply that the requested resources have been reserved successfully:
-resource reservation is done asynchronously and may fail.
+Returns 202 ACCEPTED which indicates that the reserve
+operation has been validated successfully by the master.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+The request is then forwarded asynchronously to the Mesos
+agent where the reserved resources are located.
+That asynchronous message may not be delivered or
+reserving resources at the agent might fail.
 
 Please provide "slaveId" and "resources" values designating
 the resources to be reserved.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/roles.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/roles.json.md b/docs/endpoints/master/roles.json.md
index 01e2653..b967547 100644
--- a/docs/endpoints/master/roles.json.md
+++ b/docs/endpoints/master/roles.json.md
@@ -12,6 +12,11 @@ layout: documentation
 Information about roles.
 
 ### DESCRIPTION ###
+Returns 200 OK when information about roles was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 This endpoint provides information about roles as a JSON object.
 It returns information about every role that is on the role
 whitelist (if enabled), has one or more registered frameworks,

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/roles.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/roles.md b/docs/endpoints/master/roles.md
index 9c01d37..5468b5f 100644
--- a/docs/endpoints/master/roles.md
+++ b/docs/endpoints/master/roles.md
@@ -12,6 +12,11 @@ layout: documentation
 Information about roles.
 
 ### DESCRIPTION ###
+Returns 200 OK when information about roles was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 This endpoint provides information about roles as a JSON object.
 It returns information about every role that is on the role
 whitelist (if enabled), has one or more registered frameworks,

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/slaves.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/slaves.md b/docs/endpoints/master/slaves.md
index 9e9fff7..90d0fb8 100644
--- a/docs/endpoints/master/slaves.md
+++ b/docs/endpoints/master/slaves.md
@@ -9,10 +9,15 @@ layout: documentation
 >        /master/slaves
 
 ### TL;DR; ###
-Information about registered slaves.
+Information about registered agents.
 
 ### DESCRIPTION ###
-This endpoint shows information about the slaves registered in
+Returns 200 OK when the request was processed successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+This endpoint shows information about the agents registered in
 this master formatted as a JSON object.
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/state-summary.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/state-summary.md b/docs/endpoints/master/state-summary.md
index a0da400..4eb517e 100644
--- a/docs/endpoints/master/state-summary.md
+++ b/docs/endpoints/master/state-summary.md
@@ -12,6 +12,12 @@ layout: documentation
 Summary of state of all tasks and registered frameworks in cluster.
 
 ### DESCRIPTION ###
+Returns 200 OK when a summary of the master's state was queried
+successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 This endpoint gives a summary of the state of all tasks and
 registered frameworks in the cluster as a JSON object.
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/state.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/state.json.md b/docs/endpoints/master/state.json.md
index 7998b80..4ccd146 100644
--- a/docs/endpoints/master/state.json.md
+++ b/docs/endpoints/master/state.json.md
@@ -12,8 +12,13 @@ layout: documentation
 Information about state of master.
 
 ### DESCRIPTION ###
+Returns 200 OK when the state of the master was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 This endpoint shows information about the frameworks, tasks,
-executors and slaves running in the cluster as a JSON object.
+executors and agents running in the cluster as a JSON object.
 
 Example (**Note**: this is not exhaustive):
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/state.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/state.md b/docs/endpoints/master/state.md
index 59518d6..5f45205 100644
--- a/docs/endpoints/master/state.md
+++ b/docs/endpoints/master/state.md
@@ -12,8 +12,13 @@ layout: documentation
 Information about state of master.
 
 ### DESCRIPTION ###
+Returns 200 OK when the state of the master was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 This endpoint shows information about the frameworks, tasks,
-executors and slaves running in the cluster as a JSON object.
+executors and agents running in the cluster as a JSON object.
 
 Example (**Note**: this is not exhaustive):
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/tasks.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/tasks.json.md b/docs/endpoints/master/tasks.json.md
index 29bb973..5d2c0e6 100644
--- a/docs/endpoints/master/tasks.json.md
+++ b/docs/endpoints/master/tasks.json.md
@@ -12,6 +12,11 @@ layout: documentation
 Lists tasks from all active frameworks.
 
 ### DESCRIPTION ###
+Returns 200 OK when task information was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 Lists known tasks.
 
 Query parameters:

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/tasks.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/tasks.md b/docs/endpoints/master/tasks.md
index ab9bb09..c7df686 100644
--- a/docs/endpoints/master/tasks.md
+++ b/docs/endpoints/master/tasks.md
@@ -12,6 +12,11 @@ layout: documentation
 Lists tasks from all active frameworks.
 
 ### DESCRIPTION ###
+Returns 200 OK when task information was queried successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 Lists known tasks.
 
 Query parameters:

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/teardown.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/teardown.md b/docs/endpoints/master/teardown.md
index 9b62b26..4c14f59 100644
--- a/docs/endpoints/master/teardown.md
+++ b/docs/endpoints/master/teardown.md
@@ -12,9 +12,13 @@ layout: documentation
 Tears down a running framework by shutting down all tasks/executors and removing the framework.
 
 ### DESCRIPTION ###
+Returns 200 OK if the framework was torn down successfully.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 Please provide a "frameworkId" value designating the running
 framework to tear down.
-Returns 200 OK if the framework was correctly teared down.
 
 
 ### AUTHENTICATION ###

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/unreserve.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/unreserve.md b/docs/endpoints/master/unreserve.md
index 8e9a696..5cce428 100644
--- a/docs/endpoints/master/unreserve.md
+++ b/docs/endpoints/master/unreserve.md
@@ -9,12 +9,19 @@ layout: documentation
 >        /master/unreserve
 
 ### TL;DR; ###
-Unreserve resources dynamically on a specific slave.
+Unreserve resources dynamically on a specific agent.
 
 ### DESCRIPTION ###
-Returns 202 Accepted if the request was accepted. This does not
-imply that the requested resources have been unreserved successfully:
-resource unreservation is done asynchronously and may fail.
+Returns 202 ACCEPTED which indicates that the unreserve
+operation has been validated successfully by the master.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
+The request is then forwarded asynchronously to the Mesos
+agent where the reserved resources are located.
+That asynchronous message may not be delivered or
+unreserving resources at the agent might fail.
 
 Please provide "slaveId" and "resources" values designating
 the resources to be unreserved.

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/master/weights.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/master/weights.md b/docs/endpoints/master/weights.md
index 7c45173..1e54079 100644
--- a/docs/endpoints/master/weights.md
+++ b/docs/endpoints/master/weights.md
@@ -12,6 +12,11 @@ layout: documentation
 Updates weights for the specified roles.
 
 ### DESCRIPTION ###
+Returns 200 OK when the weights update was successful.
+Returns 307 TEMPORARY_REDIRECT redirect to the leading master when
+current master is not the leader.
+Returns 503 SERVICE_UNAVAILABLE if the leading master cannot be
+found.
 PUT: Validates the request body as JSON
 and updates the weights for the specified roles.
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/monitor/statistics.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/monitor/statistics.json.md b/docs/endpoints/monitor/statistics.json.md
new file mode 100644
index 0000000..1830493
--- /dev/null
+++ b/docs/endpoints/monitor/statistics.json.md
@@ -0,0 +1,41 @@
+---
+title: Apache Mesos - HTTP Endpoints - /monitor/statistics.json
+layout: documentation
+---
+<!--- This is an automatically generated file. DO NOT EDIT! --->
+
+### USAGE ###
+>        /monitor/statistics.json
+
+### TL;DR; ###
+Retrieve resource monitoring information.
+
+### DESCRIPTION ###
+Returns the current resource consumption data for containers
+running under this slave.
+
+Example:
+
+```
+[{
+    "executor_id":"executor",
+    "executor_name":"name",
+    "framework_id":"framework",
+    "source":"source",
+    "statistics":
+    {
+        "cpus_limit":8.25,
+        "cpus_nr_periods":769021,
+        "cpus_nr_throttled":1046,
+        "cpus_system_time_secs":34501.45,
+        "cpus_throttled_time_secs":352.597023453,
+        "cpus_user_time_secs":96348.84,
+        "mem_anon_bytes":4845449216,
+        "mem_file_bytes":260165632,
+        "mem_limit_bytes":7650410496,
+        "mem_mapped_file_bytes":7159808,
+        "mem_rss_bytes":5105614848,
+        "timestamp":1388534400.0
+    }
+}]
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/monitor/statistics.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/monitor/statistics.md b/docs/endpoints/monitor/statistics.md
new file mode 100644
index 0000000..38dede0
--- /dev/null
+++ b/docs/endpoints/monitor/statistics.md
@@ -0,0 +1,41 @@
+---
+title: Apache Mesos - HTTP Endpoints - /monitor/statistics
+layout: documentation
+---
+<!--- This is an automatically generated file. DO NOT EDIT! --->
+
+### USAGE ###
+>        /monitor/statistics
+
+### TL;DR; ###
+Retrieve resource monitoring information.
+
+### DESCRIPTION ###
+Returns the current resource consumption data for containers
+running under this slave.
+
+Example:
+
+```
+[{
+    "executor_id":"executor",
+    "executor_name":"name",
+    "framework_id":"framework",
+    "source":"source",
+    "statistics":
+    {
+        "cpus_limit":8.25,
+        "cpus_nr_periods":769021,
+        "cpus_nr_throttled":1046,
+        "cpus_system_time_secs":34501.45,
+        "cpus_throttled_time_secs":352.597023453,
+        "cpus_user_time_secs":96348.84,
+        "mem_anon_bytes":4845449216,
+        "mem_file_bytes":260165632,
+        "mem_limit_bytes":7650410496,
+        "mem_mapped_file_bytes":7159808,
+        "mem_rss_bytes":5105614848,
+        "timestamp":1388534400.0
+    }
+}]
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/slave/health.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/slave/health.md b/docs/endpoints/slave/health.md
index 301a851..988567c 100644
--- a/docs/endpoints/slave/health.md
+++ b/docs/endpoints/slave/health.md
@@ -9,10 +9,10 @@ layout: documentation
 >        /slave(1)/health
 
 ### TL;DR; ###
-Health check of the Slave.
+Health check of the Agent.
 
 ### DESCRIPTION ###
-Returns 200 OK iff the Slave is healthy.
+Returns 200 OK iff the Agent is healthy.
 Delayed responses are also indicative of poor health.
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/slave/monitor/statistics.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/slave/monitor/statistics.json.md b/docs/endpoints/slave/monitor/statistics.json.md
deleted file mode 100644
index f409a21..0000000
--- a/docs/endpoints/slave/monitor/statistics.json.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Apache Mesos - HTTP Endpoints - /monitor/statistics.json
-layout: documentation
----
-<!--- This is an automatically generated file. DO NOT EDIT! --->
-
-### USAGE ###
->        /monitor/statistics.json
->        /slave(1)/monitor/statistics.json
-
-### TL;DR; ###
-Retrieve resource monitoring information.
-
-### DESCRIPTION ###
-Returns the current resource consumption data for containers
-running under this slave.
-
-Example:
-
-```
-[{
-    "executor_id":"executor",
-    "executor_name":"name",
-    "framework_id":"framework",
-    "source":"source",
-    "statistics":
-    {
-        "cpus_limit":8.25,
-        "cpus_nr_periods":769021,
-        "cpus_nr_throttled":1046,
-        "cpus_system_time_secs":34501.45,
-        "cpus_throttled_time_secs":352.597023453,
-        "cpus_user_time_secs":96348.84,
-        "mem_anon_bytes":4845449216,
-        "mem_file_bytes":260165632,
-        "mem_limit_bytes":7650410496,
-        "mem_mapped_file_bytes":7159808,
-        "mem_rss_bytes":5105614848,
-        "timestamp":1388534400.0
-    }
-}]
-```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/slave/monitor/statistics.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/slave/monitor/statistics.md b/docs/endpoints/slave/monitor/statistics.md
deleted file mode 100644
index ec9f095..0000000
--- a/docs/endpoints/slave/monitor/statistics.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Apache Mesos - HTTP Endpoints - /monitor/statistics
-layout: documentation
----
-<!--- This is an automatically generated file. DO NOT EDIT! --->
-
-### USAGE ###
->        /monitor/statistics
->        /slave(1)/monitor/statistics
-
-### TL;DR; ###
-Retrieve resource monitoring information.
-
-### DESCRIPTION ###
-Returns the current resource consumption data for containers
-running under this slave.
-
-Example:
-
-```
-[{
-    "executor_id":"executor",
-    "executor_name":"name",
-    "framework_id":"framework",
-    "source":"source",
-    "statistics":
-    {
-        "cpus_limit":8.25,
-        "cpus_nr_periods":769021,
-        "cpus_nr_throttled":1046,
-        "cpus_system_time_secs":34501.45,
-        "cpus_throttled_time_secs":352.597023453,
-        "cpus_user_time_secs":96348.84,
-        "mem_anon_bytes":4845449216,
-        "mem_file_bytes":260165632,
-        "mem_limit_bytes":7650410496,
-        "mem_mapped_file_bytes":7159808,
-        "mem_rss_bytes":5105614848,
-        "timestamp":1388534400.0
-    }
-}]
-```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/slave/state.json.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/slave/state.json.md b/docs/endpoints/slave/state.json.md
index 92cd4e1..ac85369 100644
--- a/docs/endpoints/slave/state.json.md
+++ b/docs/endpoints/slave/state.json.md
@@ -9,11 +9,11 @@ layout: documentation
 >        /slave(1)/state.json
 
 ### TL;DR; ###
-Information about state of the Slave.
+Information about state of the Agent.
 
 ### DESCRIPTION ###
 This endpoint shows information about the frameworks, executors
-and the slave's master as a JSON object.
+and the agent's master as a JSON object.
 
 Example (**Note**: this is not exhaustive):
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/aac192c8/docs/endpoints/slave/state.md
----------------------------------------------------------------------
diff --git a/docs/endpoints/slave/state.md b/docs/endpoints/slave/state.md
index 9777466..c7b61d7 100644
--- a/docs/endpoints/slave/state.md
+++ b/docs/endpoints/slave/state.md
@@ -9,11 +9,11 @@ layout: documentation
 >        /slave(1)/state
 
 ### TL;DR; ###
-Information about state of the Slave.
+Information about state of the Agent.
 
 ### DESCRIPTION ###
 This endpoint shows information about the frameworks, executors
-and the slave's master as a JSON object.
+and the agent's master as a JSON object.
 
 Example (**Note**: this is not exhaustive):