We may use DivisionInfo.getLastAppliedIndex() to get the last log index
already applied by the state machine.  Use
RaftServer.getDivision().getInfo(groupId) to get the DivisionInfo of the
group.

Tsz-Wo


On Thu, Jan 21, 2021 at 3:14 AM Pietro Tollot <[email protected]> wrote:

> Maybe there is a misunderstanding, what i wanted to say is “that is if on
> a node i can know if all the transaction committed has been applied” on
> that node
>
> On 20 Jan 2021, at 20:11, Pietro Tollot <[email protected]> wrote:
>
> Yes, i have a component that has 2 passive replicas. The component process
> data, update the state and at certain intervals commit the new state, when
> the active replica fails a leader election mechanism elect one of the
> passive that start to process data. The problem is when the active replica
> commit the state and then fail and the elected replica start processing
> data without having applied the last transaction that has been committed,
> when this last transaction will be applied i will lose the data processes
> in between.
> I saw that there is in BaseStateMachine a method  getLastAppliedTermIndex()
> that should return the last applied term, that is half of the work, the
> other half would be to know the last commit term index,
>
> Thanks
>
> On 20 Jan 2021, at 19:58, Rui Wang <[email protected]> wrote:
>
> I think Right now in Ratis you cannot know that on a node: applying
> transactions are asynchronous on each node. It's hard to estimate and it is
> also very costly to sync such information among nodes.
>
> BTW, is there a use case in your mind that you need to know this
> information?
>
> -Rui
>
> On Wed, Jan 20, 2021 at 10:51 AM Pietro Tollot <[email protected]> wrote:
>
>> Thanks for answering, what i meant was all the transactions of a commit
>> on Ratis nodes, that is if on a node i can know if all the transaction
>> committed has been applied,
>>
>> thanks
>>
>> On 20 Jan 2021, at 19:36, Rui Wang <[email protected]> wrote:
>>
>> > all the transactions has been applied
>>
>> Can you clarify what you mean by "all" the transaction? Is it mean all
>> transactions of a commit on Ratis nodes or all transactions in the raft log
>> in a single Ratis node?
>>
>>
>> -Rui
>>
>> On Wed, Jan 20, 2021 at 9:51 AM Pietro Tollot <[email protected]> wrote:
>>
>>> Thanks very much for the answer, is there a method to know if all the
>>> transactions has been applied?
>>>
>>> Thanks
>>>
>>> On 20 Jan 2021, at 17:47, Tsz Wo Sze <[email protected]> wrote:
>>>
>>> Hi Pietro,
>>>
>>> The applyTransaction method is called once the transaction has been
>>> committed.
>>> A transaction is committed once it has been replicated (not applied) to
>>> a majority of nodes.
>>>
>>> Hope it helps.
>>> Tsz-Wo
>>>
>>>
>>> On Thu, Jan 21, 2021 at 12:04 AM Pietro Tollot <[email protected]>
>>> wrote:
>>>
>>>> Hi all, i have a doubt about the use of the applyTransaction method of
>>>> a BaseStateMachine, my doubt regards when the methods is called, it is done
>>>> once the cluster has committed a message or before to commit a message?
>>>> That is a message is committed once applyTransaction has been performed in
>>>> the majority of nodes?
>>>>
>>>> Thanks,
>>>> Pietro
>>>
>>>
>>>
>>
>
>

Reply via email to