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

Attila Doroszlai resolved HDDS-9984.
------------------------------------
    Fix Version/s: 1.5.0
       Resolution: Fixed

> RatisSnapshotInfo is synchronized incorrectly
> ---------------------------------------------
>
>                 Key: HDDS-9984
>                 URL: https://issues.apache.org/jira/browse/HDDS-9984
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: OM, SCM
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.5.0
>
>
> Both term and snapshotIndex are volatile.  It is possible to get inconsistent 
> return values from getTermIndex() and toString() while updateTermIndex(..) is 
> running in the middle.
> {code}
>   private volatile long term = 0;
>   private volatile long snapshotIndex = -1;
>   ...
>   public void updateTermIndex(long newTerm, long newIndex) {
>     this.term = newTerm;
>     this.snapshotIndex = newIndex;
>   }
>   ...
>   @Override
>   public TermIndex getTermIndex() {
>     return TermIndex.valueOf(term, snapshotIndex);
>   }
>   ...
>   @Override
>   public String toString() {
>     StringBuilder stringBuilder = new StringBuilder();
>     stringBuilder.append(term);
>     stringBuilder.append(TRANSACTION_INFO_SPLIT_KEY);
>     stringBuilder.append(snapshotIndex);
>     return stringBuilder.toString();
>   }
> {code}
> Also, RatisSnapshotInfo is not useful since it mostly duplicates the code in 
> TransactionInfo.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to