You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@distributedlog.apache.org by Jay Juma <ja...@gmail.com> on 2016/09/09 06:47:48 UTC

Question about the sequence numbers

Hello,

I am newbie to distributed log. What is the major difference between the
sequence id and transaction id of a log record? They seem to be both long
numbers.

Thanks,
Jay

Re: Question about the sequence numbers

Posted by Jay Juma <ja...@gmail.com>.
Thank you Sijie. This is super useful. It would be good that you can put
this in the FAQ page. I believe it is very useful for newbies like me.

- Jay

On Sat, Sep 10, 2016 at 12:31 PM, Sijie Guo <si...@apache.org> wrote:

> Hello Jay,
>
> There is an explanation in the API page -
> http://distributedlog.io/api/core.html#sequence-numbers
>
> In short, the transaction id is an application supplied sequence number. It
> is required to be non-decreasing. Users usually use either timestamp or
> offset (bytes written so far) as the transaction id, so that they can use
> transaction id to rewind either by time or offset.
>
> The sequence id is the system generated sequence number. It indicates that
> global sequence of a log record in the stream. if you are familiar with
> Raft
> <https://raft.github.io/raft.pdf>, it is same as the log *index *in Raft.
> There are two typical use cases of sequence id. You can use sequence id to
> identify the number of records in between of any two records. You can use
> sequence id to do any sanity check on the delivery sequence.
>
> Let me know if you have any questions.
>
> - Sijie
>
>
>
> On Thu, Sep 8, 2016 at 11:47 PM, Jay Juma <ja...@gmail.com> wrote:
>
> > Hello,
> >
> > I am newbie to distributed log. What is the major difference between the
> > sequence id and transaction id of a log record? They seem to be both long
> > numbers.
> >
> > Thanks,
> > Jay
> >
>

Re: Question about the sequence numbers

Posted by Sijie Guo <si...@apache.org>.
Hello Jay,

There is an explanation in the API page -
http://distributedlog.io/api/core.html#sequence-numbers

In short, the transaction id is an application supplied sequence number. It
is required to be non-decreasing. Users usually use either timestamp or
offset (bytes written so far) as the transaction id, so that they can use
transaction id to rewind either by time or offset.

The sequence id is the system generated sequence number. It indicates that
global sequence of a log record in the stream. if you are familiar with Raft
<https://raft.github.io/raft.pdf>, it is same as the log *index *in Raft.
There are two typical use cases of sequence id. You can use sequence id to
identify the number of records in between of any two records. You can use
sequence id to do any sanity check on the delivery sequence.

Let me know if you have any questions.

- Sijie



On Thu, Sep 8, 2016 at 11:47 PM, Jay Juma <ja...@gmail.com> wrote:

> Hello,
>
> I am newbie to distributed log. What is the major difference between the
> sequence id and transaction id of a log record? They seem to be both long
> numbers.
>
> Thanks,
> Jay
>