Ren Koike created HDDS-16262:
--------------------------------

             Summary: Fix thread-safety issues in AbstractCommitWatcher
                 Key: HDDS-16262
                 URL: https://issues.apache.org/jira/browse/HDDS-16262
             Project: Apache Ozone
          Issue Type: Improvement
          Components: Ozone Client
            Reporter: Ren Koike
            Assignee: Ren Koike


AbstractCommitWatcher is shared by both the DataStream path 
(StreamCommitWatcher) and the Ratis path (CommitWatcher). It has check-then-act 
sequences in watchOnFirstIndex() and watchOnLastIndex() that are not 
synchronized, while other mutating methods (updateCommitInfoMap, adjustBuffers) 
are synchronized. A concurrent
drain between isEmpty() and firstKey()/lastKey() can cause 
NoSuchElementException.

Fix: add synchronized to the watch methods to match the existing locking 
policy, and document the threading contract for releaseBuffers().

Both the DataStream and Ratis paths benefit from this fix.



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