Ashish Kumar created HDDS-15656:
-----------------------------------

             Summary: sizeActuallyMovedInLatestIteration can give wrong result 
                 Key: HDDS-15656
                 URL: https://issues.apache.org/jira/browse/HDDS-15656
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Ashish Kumar


 
Multiple container moves can complete simultaneously, and each {{whenComplete}} 
callback executes in its own thread. The compound {{+=}} operation on a 
{{long}} is not atomic and can produce incorrect results.
{code:java}
 future = future.whenComplete((result, ex) -> {   
metrics.incrementCurrentIterationContainerMoveMetric(result,1);   
moveSelectionToFutureMap.remove(moveSelection);   
if(ex !=null) {  
 ...   } else {   
if(result ==MoveManager.MoveResult.COMPLETED){   
sizeActuallyMovedInLatestIteration += // ← non-atomic   
containerInfo.getUsedBytes(); {code}
 



--
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