分布式日志记录的事务 ID 和序列 ID 有什么区别?

what is the difference between transaction id and sequence id of a distributedlog record?

我使用分布式日志 AsyncLogReader 从分布式日志流中读取记录。对于流中的每条日志记录,我发现有两个序列号与之关联,一个是事务ID,一个是序列ID。我应该使用哪一个来跟踪阅读位置?

基于邮件列表中一位分布式日志作者的回答:

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.

API页面也有解释http://distributedlog.io/api/core.html#sequence-numbers