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

   ## What changes were proposed in this pull request?
   
   **Problem.** `XceiverClientGrpc.initStreamRead` took a permit from the same 
semaphore that limits unary requests 
(`hdds.ratis.raft.client.async.outstanding-requests.max`) and held it until the 
block stream was closed. A streaming read can stay open for a long time, so:
   
   - Open block streams use up permits that short requests (`GetBlock`, 
`ReadChunk`, etc.) on the same pipeline client need, and those requests stall.
   - The wait was unbounded (`semaphore.acquire()`). A reader that already 
holds streams on the client (sequential read plus pread, or seeks across 
blocks) could wait forever for a permit only it can release.
   
   **Fix.**
   
   - Streaming reads use their own fair semaphore, separate from the request 
semaphore. Unary requests are no longer affected by open streams.
   - New client config `ozone.client.stream.read.max-concurrent-streams` sets 
the limit. The default (`-1`, any non-positive value) uses 
`hdds.ratis.raft.client.async.outstanding-requests.max`, so the capacity for 
streams is the same as before.
   - Waiting for a stream slot is bounded by 
`ozone.client.stream.read.timeout`. On timeout it throws `TimeoutIOException`, 
which the block input stream retries under the read retry policy before failing 
the read.
   - Excluded datanodes are filtered out before waiting for a slot, so an open 
that no datanode can serve fails right away.
   - The slot is released if the stream fails to start on every datanode; 
otherwise it is held until `completeStreamRead()`.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17767
   
   ## How was this patch tested?
   
   - New `TestXceiverClientGrpcStreamRead`: limit is enforced and released on 
completion, a waiter gets a slot freed before the timeout, a full client fails 
instead of hanging, interrupt handling, permit is released when the start fails 
or all datanodes are excluded, and the limit falls back to the request limit 
when unset.
   - `TestStreamBlockInputStream`: an admission timeout is retried for 
sequential and positioned reads.
   - `TestOzoneClientConfig`: parsing and default of the new config key.
   
   


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