[
https://issues.apache.org/jira/browse/RATIS-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Duong updated RATIS-2094:
-------------------------
Description:
stateMachineLogEntry and stateMachineContext are parsed/created from
RaftClientRequest or LogEntryProto and attached to TransactionContext in the
StateMachine.startTransaction methods.
There are 2 variant of StateMachine.startTransaction;
1. startTransaction(RaftClientRequest): This is called only on the leader side.
The result of this method is not cached and is passed temporarily alongside
RaftClientRequest for further processing, for example.
2. startTransaction(LogEntryProto, RaftPeerRole): this is called on both leader
and follower side. The result of this call is cached on the node
* On leader: this is called right before applyTransaction to produce a
TransactionContext for StateMachine.applyTransaction.
* On follower: this is called when the appendEntries request is received. The
result is cached to be used by StateMachine.write and then
StateMachine.applyTransaction.
The startTransaction methods are called with the RaftClientRequest or
LogEntryProto parsed directly from the original zero-copy buffers. In turn, the
stateMachineLogEntry and stateMachineContext (which is parsed/created from
them) will have data reference directly to the original zero-copy buffer
without explicit referent counter. The fact that TransactionContext is cached
makes it worse.
was:
stateMachineLogEntry and stateMachineContext are parsed/created from
RaftClientRequest or LogEntryProto and attached to TransactionContext in the
StateMachine.startTransaction methods.
There are 2 variant of StateMachine.startTransaction;
1. startTransactions(RaftClientRequest): This is called only on the leader
side. The result of this method is not cached and is passed temporarily
alongside RaftClientRequest for further processing, for example. This is
probably safe.
2. startTransactions(LogEntryProto, RaftPeerRole): this is called on both
leader and follower side. The result of this call is cached on the node
* On leader: this is called right before applyTransaction to produce a
TransactionContext for StateMachine.applyTransaction.
* On follower: this is called when the appendEntries request is received. The
result is cached to be used by StateMachine.write and then
StateMachine.applyTransaction.
> TransactionContext's stateMachineLogEntry and stateMachineContext may cause
> corruption
> --------------------------------------------------------------------------------------
>
> Key: RATIS-2094
> URL: https://issues.apache.org/jira/browse/RATIS-2094
> Project: Ratis
> Issue Type: Sub-task
> Reporter: Duong
> Assignee: Duong
> Priority: Major
>
> stateMachineLogEntry and stateMachineContext are parsed/created from
> RaftClientRequest or LogEntryProto and attached to TransactionContext in the
> StateMachine.startTransaction methods.
> There are 2 variant of StateMachine.startTransaction;
> 1. startTransaction(RaftClientRequest): This is called only on the leader
> side. The result of this method is not cached and is passed temporarily
> alongside RaftClientRequest for further processing, for example.
> 2. startTransaction(LogEntryProto, RaftPeerRole): this is called on both
> leader and follower side. The result of this call is cached on the node
> * On leader: this is called right before applyTransaction to produce a
> TransactionContext for StateMachine.applyTransaction.
> * On follower: this is called when the appendEntries request is received.
> The result is cached to be used by StateMachine.write and then
> StateMachine.applyTransaction.
> The startTransaction methods are called with the RaftClientRequest or
> LogEntryProto parsed directly from the original zero-copy buffers. In turn,
> the stateMachineLogEntry and stateMachineContext (which is parsed/created
> from them) will have data reference directly to the original zero-copy buffer
> without explicit referent counter. The fact that TransactionContext is cached
> makes it worse.
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)