You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ratis.apache.org by Zili Chen <wa...@gmail.com> on 2019/10/02 02:34:55 UTC

What does setWatch(idx, replicationLevel) mean?

Hi ratis,

Noticed that RaftClient has a method setWatch(idx, replicationLevel) I
think it is quite different from
"Watcher" mechanism in etcd or zk. After a bit of look I don't understand
what this method used
for.

Could you kindly share the intention we have this method?

Best,
tison.

Re: What does setWatch(idx, replicationLevel) mean?

Posted by Zili Chen <wa...@gmail.com>.
Thanks a lot Tsz-Wo!


Tsz Wo Sze <sz...@gmail.com> 于2019年10月2日周三 下午12:24写道:

> For write requests, the success RaftClientReply will include the log
> index for that request.
>
> For other requests, the log index in RaftClientReply is 0.
>
> For any requests, the commit indies of each server can be found in
> commit infos (see RaftClientReply.getCommitInfos()), if available.
>
> Tsz-Wo
>
> On Wed, Oct 2, 2019 at 11:51 AM Zili Chen <wa...@gmail.com> wrote:
> >
> > Thanks for the clarification! It helps indeed.
> >
> > One more question, does client always get index of log from
> RaftClientReply?
> >
> > Best,
> > tison.
> >
> >
> > Tsz Wo Sze <sz...@gmail.com> 于2019年10月2日周三 上午11:27写道:
> >>
> >> Thanks for the question.
> >>
> >> /** Async call to watch the given index to satisfy the given
> >> replication level. */
> >> CompletableFuture<RaftClientReply> sendWatchAsync(long index,
> >> ReplicationLevel replication);
> >>
> >> /** Watch the given index to satisfy the given replication level. */
> >> RaftClientReply sendWatch(long index, ReplicationLevel replication)
> >> throws IOException;
> >>
> >> sendWatch/sendWatchAsync are to watch a particular log index to reach
> >> the given replication level.  By default, a write request is replied
> >> if replication MAJORITY is satisfied.  However, some applications
> >> (e.g. Apache Hadoop Ozone) may require a more strict replication level
> >> such as ALL or ALL_COMMITTED.  Then, they may send a watch request to
> >> wait for it.
> >>
> >> Hope it helps.
> >> Tsz-Wo
> >>
> >> On Wed, Oct 2, 2019 at 10:35 AM Zili Chen <wa...@gmail.com> wrote:
> >> >
> >> > Hi ratis,
> >> >
> >> > Noticed that RaftClient has a method setWatch(idx, replicationLevel)
> I think it is quite different from
> >> > "Watcher" mechanism in etcd or zk. After a bit of look I don't
> understand what this method used
> >> > for.
> >> >
> >> > Could you kindly share the intention we have this method?
> >> >
> >> > Best,
> >> > tison.
>

Re: What does setWatch(idx, replicationLevel) mean?

Posted by Tsz Wo Sze <sz...@gmail.com>.
For write requests, the success RaftClientReply will include the log
index for that request.

For other requests, the log index in RaftClientReply is 0.

For any requests, the commit indies of each server can be found in
commit infos (see RaftClientReply.getCommitInfos()), if available.

Tsz-Wo

On Wed, Oct 2, 2019 at 11:51 AM Zili Chen <wa...@gmail.com> wrote:
>
> Thanks for the clarification! It helps indeed.
>
> One more question, does client always get index of log from RaftClientReply?
>
> Best,
> tison.
>
>
> Tsz Wo Sze <sz...@gmail.com> 于2019年10月2日周三 上午11:27写道:
>>
>> Thanks for the question.
>>
>> /** Async call to watch the given index to satisfy the given
>> replication level. */
>> CompletableFuture<RaftClientReply> sendWatchAsync(long index,
>> ReplicationLevel replication);
>>
>> /** Watch the given index to satisfy the given replication level. */
>> RaftClientReply sendWatch(long index, ReplicationLevel replication)
>> throws IOException;
>>
>> sendWatch/sendWatchAsync are to watch a particular log index to reach
>> the given replication level.  By default, a write request is replied
>> if replication MAJORITY is satisfied.  However, some applications
>> (e.g. Apache Hadoop Ozone) may require a more strict replication level
>> such as ALL or ALL_COMMITTED.  Then, they may send a watch request to
>> wait for it.
>>
>> Hope it helps.
>> Tsz-Wo
>>
>> On Wed, Oct 2, 2019 at 10:35 AM Zili Chen <wa...@gmail.com> wrote:
>> >
>> > Hi ratis,
>> >
>> > Noticed that RaftClient has a method setWatch(idx, replicationLevel) I think it is quite different from
>> > "Watcher" mechanism in etcd or zk. After a bit of look I don't understand what this method used
>> > for.
>> >
>> > Could you kindly share the intention we have this method?
>> >
>> > Best,
>> > tison.

Re: What does setWatch(idx, replicationLevel) mean?

Posted by Zili Chen <wa...@gmail.com>.
Thanks for the clarification! It helps indeed.

One more question, does client always get index of log from RaftClientReply?

Best,
tison.


Tsz Wo Sze <sz...@gmail.com> 于2019年10月2日周三 上午11:27写道:

> Thanks for the question.
>
> /** Async call to watch the given index to satisfy the given
> replication level. */
> CompletableFuture<RaftClientReply> sendWatchAsync(long index,
> ReplicationLevel replication);
>
> /** Watch the given index to satisfy the given replication level. */
> RaftClientReply sendWatch(long index, ReplicationLevel replication)
> throws IOException;
>
> sendWatch/sendWatchAsync are to watch a particular log index to reach
> the given replication level.  By default, a write request is replied
> if replication MAJORITY is satisfied.  However, some applications
> (e.g. Apache Hadoop Ozone) may require a more strict replication level
> such as ALL or ALL_COMMITTED.  Then, they may send a watch request to
> wait for it.
>
> Hope it helps.
> Tsz-Wo
>
> On Wed, Oct 2, 2019 at 10:35 AM Zili Chen <wa...@gmail.com> wrote:
> >
> > Hi ratis,
> >
> > Noticed that RaftClient has a method setWatch(idx, replicationLevel) I
> think it is quite different from
> > "Watcher" mechanism in etcd or zk. After a bit of look I don't
> understand what this method used
> > for.
> >
> > Could you kindly share the intention we have this method?
> >
> > Best,
> > tison.
>

Re: What does setWatch(idx, replicationLevel) mean?

Posted by Tsz Wo Sze <sz...@gmail.com>.
Thanks for the question.

/** Async call to watch the given index to satisfy the given
replication level. */
CompletableFuture<RaftClientReply> sendWatchAsync(long index,
ReplicationLevel replication);

/** Watch the given index to satisfy the given replication level. */
RaftClientReply sendWatch(long index, ReplicationLevel replication)
throws IOException;

sendWatch/sendWatchAsync are to watch a particular log index to reach
the given replication level.  By default, a write request is replied
if replication MAJORITY is satisfied.  However, some applications
(e.g. Apache Hadoop Ozone) may require a more strict replication level
such as ALL or ALL_COMMITTED.  Then, they may send a watch request to
wait for it.

Hope it helps.
Tsz-Wo

On Wed, Oct 2, 2019 at 10:35 AM Zili Chen <wa...@gmail.com> wrote:
>
> Hi ratis,
>
> Noticed that RaftClient has a method setWatch(idx, replicationLevel) I think it is quite different from
> "Watcher" mechanism in etcd or zk. After a bit of look I don't understand what this method used
> for.
>
> Could you kindly share the intention we have this method?
>
> Best,
> tison.