aayush2761 opened a new pull request, #12194:
URL: https://github.com/apache/ozone/pull/12194

   ## What changes were proposed in this pull request?
   
   At datanode start, `OzoneContainer.buildContainerSet` runs one 
`ContainerReader` per volume against a shared `ContainerSet`. 
`ContainerReader.verifyAndFixupContainerData` added a container to the set and 
only then reserved its space (`commitSpace`). These two steps were not ordered 
against the other volumes' readers.
   
   When the same container exists on two volumes at start (the stale copy 
`OPEN`, the other copy with a higher BCSID or `CLOSED`), the other volume's 
reader can find the first copy in the set, swap it out, delete it from disk, 
and call `releaseCommitSpace` on it in the window between the first reader's 
`addContainer` and its `commitSpace`. That release does nothing, because 
nothing is reserved yet. The first reader then runs `commitSpace` and
   reserves space for the copy that was just deleted.
   
   As a result, the deleted copy's volume keeps one container size (minus the 
copy's used bytes) committed until the next restart, refuses that much new 
data, and reports it to SCM in the storage report. No data is lost.
   
   This change reserves the space before the container becomes visible in the 
set, so a copy is reserved from the moment another reader can see it and swap 
it out. A `finally` releases the copy's own reservation when it is not kept 
(duplicate not swapped, or the add or duplicate resolution failed before the 
copy entered the set). When the new copy wins, the
   existing copy is released as before, and because it was reserved before 
becoming visible the release now frees a real reservation instead of a no-op.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17008
   
   ## How was this patch tested?
   
   - `mvn -pl :hdds-container-service test -Dtest=TestContainerReader 
-DskipShade -DskipRecon`
   - `./hadoop-ozone/dev-support/checks/checkstyle.sh`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to