[ 
https://issues.apache.org/jira/browse/RATIS-2434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze resolved RATIS-2434.
-------------------------------
    Fix Version/s: 3.3.0
       Resolution: Fixed

The pull request is now merged.  Thanks, [~weichiu]!

> Regression test for data race between SegmentedRaftLog.get() and 
> LogSegment.append()
> ------------------------------------------------------------------------------------
>
>                 Key: RATIS-2434
>                 URL: https://issues.apache.org/jira/browse/RATIS-2434
>             Project: Ratis
>          Issue Type: Test
>          Components: test
>            Reporter: Wei-Chiu Chuang
>            Assignee: Wei-Chiu Chuang
>            Priority: Major
>             Fix For: 3.3.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> RATIS-2129 has significant performance improvement due to the removal of 
> RaftLog lock. There was a race condition bug between the order of entry cache 
> and appending the entry to log segment record, which is fixed by RATIS-2282
>  
> That is to say,
> [https://github.com/apache/ratis/blob/b73cf97c6f6349abb2e37a801f214629cb5245b3/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/LogSegment.java#L374-L376]
> {code:java}
>       putEntryCache(record.getTermIndex(), entry, op);
>     }
>     records.append(record); {code}
> and
> [https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java#L289-L293]
> {code:java}
>       record = segment.getLogRecord(index);
>       if (record == null) {
>         return null;
>       }
>       final LogEntryProto entry = 
> segment.getEntryFromCache(record.getTermIndex());
>  {code}
> are not atomic. It is only correct if the append() puts into entry cache 
> before appending to records.
>  
> We should have a regression test to ensure no that order is not changed. (Add 
> javadoc comments too)
>  



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

Reply via email to