----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/34646/ -----------------------------------------------------------
(Updated April 22, 2016, 7:18 a.m.) Review request for mesos, Adam B, Anand Mazumdar, Cody Maloney, Ian Downes, Neil Conway, and Vinod Kone. Changes ------- Fix style error and rebase. Bugs: MESOS-1865 https://issues.apache.org/jira/browse/MESOS-1865 Repository: mesos Description ------- In this changes, we redirect to the leading master in those http endpoints which depend on master elected status if current master is not the leader. Diffs (updated) ----- src/master/http.cpp de06985cafc93022fffc0d13812a119ae43b7e57 Diff: https://reviews.apache.org/r/34646/diff/ Testing ------- localhost:5053 is the leading master. localhost:5054 is another master. 1) Test normal redirection. In the leader. ``` curl -i http://localhost:5053/master/tasks HTTP/1.1 200 OK Date: Thu, 21 Apr 2016 06:57:50 GMT Content-Length: 12 Content-Type: application/json {"tasks":[]} ``` In non-leader. ``` curl -i http://localhost:5054/master/tasks HTTP/1.1 307 Temporary Redirect Date: Thu, 21 Apr 2016 07:00:06 GMT Location: //localhost:5053/master/tasks Content-Length: 0 ``` 2) Test the `/redirect`. In the leader. ``` curl -i http://localhost:5053/master/redirect HTTP/1.1 307 Temporary Redirect Date: Thu, 21 Apr 2016 07:00:53 GMT Location: //localhost:5053 Content-Length: 0 ``` In the non-leader. ``` curl -i http://localhost:5054/master/redirect HTTP/1.1 307 Temporary Redirect Date: Thu, 21 Apr 2016 07:01:34 GMT Location: //localhost:5053 Content-Length: 0 ``` 3) Test the `ServiceUnavailable` (By quit zookeeper). In the non-leader(The leader is quit because could not connect to zookeeper). ``` curl -i http://localhost:5053/master/redirect curl: (7) Failed connect to localhost:5053; Connection refused curl -i http://localhost:5054/master/redirect HTTP/1.1 503 Service Unavailable Date: Thu, 21 Apr 2016 07:02:38 GMT Content-Length: 17 No leader elected ``` Thanks, haosdent huang