Requests from different clients may arrive at the same time. When the leader receives client requests, it assigns a unique log index (monotonically) for each request. The log index decides the serial order of the client requests. Within a leader, two different requests cannot have the same index.
> ... Uncommitted log may have same index, and one of them will be committed, others will be overwritten. ... Suppose there is a leader change and C is the last commit index of the old leader. The old leader may have assigned log indices C+1, C+2, ... to some uncommitted requests. The new leader begins assigning log indices to new client requests at C+1. Then, it could have two different uncommitted log entries in two different machines. When the old leader joins the new leader, it will truncate its uncommitted log entries. Hope it helps. Tsz-Wo On Sun, Mar 19, 2023 at 12:11 AM tison <[email protected]> wrote: > Thank you for quick response! > > Best, > tison. > > > Kaijie Chen <[email protected]> 于2023年3月19日周日 00:09写道: > > > No. Index of committed log increases monotonically.Uncommitted log may > > have same index, and one of them will be committed, others will be > > overwritten.Kaijie ---- On Sun, 19 Mar 2023 00:03:10 +0800 > > [email protected] wrote ----IIUC different terms can have the same > > index. I'm not quite familiar with > > the underneath promise here. > > > > The API in issue is org.apache.ratis.client.api.AsyncApi#watch > > > > CompletableFuture<RaftClientReply> watch(long index, ReplicationLevel > > replication); > > > > Best, > > tison. > > >
