----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/34646/#review85955 -----------------------------------------------------------
Much better. Redirecting to the leading master seems like the correct desired behavior. Let's apply this to some of the other master endpoints, reusing code where possible. src/master/http.cpp <https://reviews.apache.org/r/34646/#comment137785> What about the other master endpoints, like /slaves, /state, /roles, and /teardown? /health and /observe might be better off without redirects, in case we're trying to get the non-leading master's health. Getting to the /files endpoints in src/files/files.hpp would be more difficult, since FilesProcess doesn't know if it's a master or slave. We can probably ignore them for now. Plus we might actually want to see the master log from a non-leading master. src/master/http.cpp <https://reviews.apache.org/r/34646/#comment137787> Could I ask you to write a quick unit test for this? src/master/http.cpp <https://reviews.apache.org/r/34646/#comment137786> Looks like a lot of duplicated code with Master::Http::redirect(). Can you please dedupe? src/master/http.cpp <https://reviews.apache.org/r/34646/#comment137784> Nit: we prefer trailing "+"s rather than leading "+"s. - Adam B On May 31, 2015, 11:35 p.m., haosdent huang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/34646/ > ----------------------------------------------------------- > > (Updated May 31, 2015, 11:35 p.m.) > > > Review request for mesos and Adam B. > > > Bugs: MESOS-1865 > https://issues.apache.org/jira/browse/MESOS-1865 > > > Repository: mesos > > > Description > ------- > > Return empty task list when current master is not a leader. > > > Diffs > ----- > > src/master/http.cpp 01dbdad9720a9cd30505683ae1117970cda918a0 > > Diff: https://reviews.apache.org/r/34646/diff/ > > > Testing > ------- > > make check > > when current master is not a leader, it would redirect to the leader master. > > ``` > $ curl -i http://master1:5050/master/tasks.json > HTTP/1.1 307 Temporary Redirect > Date: Mon, 01 Jun 2015 06:30:08 GMT > Location: http://master2:5050//master/tasks.json > Content-Length: 0 > ``` > > > Thanks, > > haosdent huang > >