You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "JiangHua Zhu (Jira)" <ji...@apache.org> on 2024/10/09 15:22:00 UTC
[jira] [Assigned] (RATIS-2171) Safer initialization of TransactionContext#logIndexFuture
[ https://issues.apache.org/jira/browse/RATIS-2171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
JiangHua Zhu reassigned RATIS-2171:
-----------------------------------
Assignee: JiangHua Zhu
> Safer initialization of TransactionContext#logIndexFuture
> ---------------------------------------------------------
>
> Key: RATIS-2171
> URL: https://issues.apache.org/jira/browse/RATIS-2171
> Project: Ratis
> Issue Type: Improvement
> Components: server
> Affects Versions: 3.0.1
> Reporter: JiangHua Zhu
> Assignee: JiangHua Zhu
> Priority: Major
>
> In TransactionContextImpl(), logIndexFuture is initialized after setLogEntry(), which is very reasonable. However, in initLogEntry(), the assignment of logIndexFuture is arranged before setLogEntry(), which seems to be a flaw.
> TransactionContextImpl():
> {code:java}
> TransactionContextImpl(RaftPeerRole serverRole, StateMachine stateMachine, LogEntryProto logEntry) {
> this(serverRole, null, stateMachine, logEntry.getStateMachineLogEntry());
> setLogEntry(logEntry);
> this.logIndexFuture.complete(logEntry.getIndex());
> }
> {code}
> initLogEntry():
> {code:java}
> ......
> logIndexFuture.complete(index);
> return setLogEntry(LogProtoUtils.toLogEntryProto(stateMachineLogEntry, term, index));
> ......
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)