> On July 5, 2016, 7:34 p.m., Vinod Kone wrote:
> > src/master/http.cpp, line 609
> > <https://reviews.apache.org/r/49518/diff/4/?file=1436049#file1436049line609>
> >
> > hmm. the weird part is that "Added subscriber.." log message will be printed
after the snapshot is sent.
> >
> > also sending SUBSCRIBED (in the future) after SNAPSHOT sounds weird.
> >
> > the more i think about it, the more i'm leaning towards renaming SNAPSHOT to
SUBSCRIBED and pushing this logic of getting state inside `Master::subscribe()`.
> >
> > something like...
> >
> > ```
> > Master::subscribe()
> > {
> > return _getState()
> > .then([] {
> >
> > // Send SUBSCRIBED.
> > })
> > }
> >
> > ```
> >
> > thoughts? cc @anand
>
> Zhitao Li wrote:
> I like the idea of using `SUBSCRIBED` event and embed snapshot as an optional field
in the response. The public API is probably something like:
>
> ```
> message Event {
> enum Type {
> SUBSCRIBED = 1;
> ...
> }
>
> // This is the first event that is sent after a client is subscribed.
> // Further updates to the cluster state are sent as separate events on the stream.
> message Subscribed {
> // Snapshot of the entire cluster state.
> // This might be filterable in the future.
> optional Response.GetStates snapshot = 1;
> ...
> }
> }
> ```
>
> The only concern I have about moving snapshot sending to `Master::subscribe()` is
that `Master` class needs to access the current private function `Master::Http::_getState()`.
If that is outweighted by the ordering of logging, then I can a shot.
In fact, if the only concern you have the order of logging, moving `master->subscribe(http);`
before `http.send<mesos::master::Event, v1::master::Event>(event);` should be a simpler
and valid fix, because this entire callback is executed in `Master`'s actor so no events can
be sent incorrectly at the same time, so any `Event` sent by `subscribers` is still guaranteed
after this send.
- Zhitao
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/49518/#review140856
-----------------------------------------------------------
On July 4, 2016, 4:06 a.m., Zhitao Li wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49518/
> -----------------------------------------------------------
>
> (Updated July 4, 2016, 4:06 a.m.)
>
>
> Review request for mesos, Anand Mazumdar, haosdent huang, and Vinod Kone.
>
>
> Bugs: MESOS-5498
> https://issues.apache.org/jira/browse/MESOS-5498
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Initial snapshot for v1 master event stream.
>
>
> Diffs
> -----
>
> include/mesos/master/master.proto d06258e9fd39c7eefd8ecd394e3bdfb888479b1e
> include/mesos/v1/master/master.proto b7cb6fdf2e4f34a11d326ac3ad3ec26525f8f343
> src/master/http.cpp 7b2f77b9264242f31ab62eb9db7c621a1b8aa2fe
> src/tests/api_tests.cpp e2d8bf591667ec9d8c609e55a424b55561892b5f
>
> Diff: https://reviews.apache.org/r/49518/diff/
>
>
> Testing
> -------
>
> Updated test and make check.
>
>
> Thanks,
>
> Zhitao Li
>
>
|