[ 
https://issues.apache.org/jira/browse/RATIS-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17807807#comment-17807807
 ] 

Duong commented on RATIS-2001:
------------------------------

Thanks for the quick turnaround [~szetszwo] .

> TransactionContext can be wrongly reused
> ----------------------------------------
>
>                 Key: RATIS-2001
>                 URL: https://issues.apache.org/jira/browse/RATIS-2001
>             Project: Ratis
>          Issue Type: Bug
>          Components: server
>            Reporter: Duong
>            Assignee: Tsz-wo Sze
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> After RATIS-1897, TransactionContext is 
> [created|https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java#L477]
>  during {{{}appendEntries{}}}.
> {code:java}
>       // in SegmentedRaftLog#appendImpl
>       for (int i = index; i < entries.size(); i++) {
>         final LogEntryProto entry = entries.get(i);
>         futures.add(appendEntry(entry, server.getTransactionContext(entry, 
> true)));
>       } {code}
> The created transaction is cached in TransactionManager, keyed by index only.
> This opens a possibility of error, e.g. uncommitted logs can be reverted when 
> leader changes, and the index can be reused for another entirely different 
> log entry in another term. This will make the cached `TransactionContext` 
> obsolete but still be used for the later entry.
> A sample error and details discussion can be found in this 
> [PR|https://github.com/apache/ratis/pull/1011#issuecomment-1894374538].
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to