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

   ## What changes were proposed in this pull request?
   ### Summary
   To resolve the significant lock contention experienced during concurrent 
readVectored operations, this PR implements the ByteBufferPositionedReadable 
interface for both BlockInputStream and ChunkInputStream. By supporting 
thread-safe, position-based reads directly into ByteBuffer, we bypass the 
synchronization overhead of traditional stream locks and greatly improve 
parallel read performance.  
   ### Detailed Changes
   1. Improve Visibility of Initialization State
   
     - Declared the initialized flag as volatile. This ensures that once the 
stream is initialized, the state change is instantly visible to all other 
concurrent threads, preventing redundant initialization. 
   
   2. Locking for Stream Refresh/Re-acquisition
   
     - Introduced a ReentrantLock (passed from BlockInputStream to 
ChunkInputStream) to guard critical operations such as refreshBlockInfo, 
acquireClient, and handling read errors. This ensures thread safety during 
network/client state transitions without locking the entire read path.  
   
   3. Avoid Redundant Pipeline Refreshing
   
     - Added a failedPipeline variable to track the pipeline that encountered 
an issue.  
     - During refreshBlockInfo, the stream now checks if the current pipeline 
matches failedPipeline. If it does, the redundant refresh operation is skipped, 
preventing multiple threads from hammering the refresh logic concurrently for 
the same failure.  
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15734
   
   ## How was this patch tested?
   
   Add test in `TestChunkInputStream` and `TestBlockInputStream`.
   CI: https://github.com/chungen0126/ozone/actions/runs/29289303279
   


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