feat: adding read stall retry for gRPC storage client#20169
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for dynamic read stall timeouts to the gRPC API, bringing feature parity with the XML API. It introduces a bucketDelayManager to track latencies and dynamically adjust timeouts, and adds emulator tests to verify the behavior. The review feedback highlights two main issues: first, using time.After in request-scoped paths can cause temporary memory leaks, so it should be replaced with time.NewTimer and stopped via defer timer.Stop(). Second, the dynamic stall timeout should not be increased if the outer context was cancelled by the caller, which can be prevented by checking ctx.Err() == nil before calling increase().
1736fa8 to
acf0915
Compare
200b8cb to
5baec6d
Compare
| } | ||
|
|
||
| // executeWithReadStallTimeout executes openStream with dynamic delay stall retry tracking. | ||
| func executeWithReadStallTimeout( |
There was a problem hiding this comment.
Why can't this be a method on the struct only instead of passing bucketDelayManager again into this?
There was a problem hiding this comment.
My main motivation for keeping executeWithReadStallTimeout as a standalone helper function is to maintain a clear separation of concerns:
- bucketDelayManager acts as a pure statistics/delay calculator.
- executeWithReadStallTimeout handles concurrency orchestration (context cancellation, timers, and callbacks).
Keeping execution flow decoupled from data management prevents bucketDelayManager from becoming tightly coupled to gRPC/HTTP stream lifecycle management.
Happy to refactor if you still prefer having it as a method on bucketDelayManager!"
…tx and adjust emulator read stall test parameters
27034a2 to
80ea3f4
Compare
Extending the dynamic delay algorithm and stall retry mechanism (previously HTTP XML only) to support gRPC read operations. At high level changes includes: