ss77892 opened a new pull request, #11999: URL: https://github.com/apache/ozone/pull/11999
## What changes were proposed in this pull request? When a stream read fails, `StreamBlockInputStream` excludes the failed datanode, refreshes the block info and starts a new stream, up to the configured read retry count. When the read gives up (retries exhausted, a non-retriable error, or the refresh itself fails), the stream kept the state of that failed read: - the failed stream and its xceiver client were not released, - the datanodes excluded during the read stayed excluded, - the retry counter stayed at its exhausted value. The next `read()` on the same stream then failed right away with no retries left, and possibly with no datanode left to start a new stream on. The stream stayed broken until it was closed. Changes: - `handleExceptions()`: every way out other than a retry now calls `resetAfterTerminalFailure()`, which releases the client, clears the excluded datanodes and resets the retry counter before the exception is rethrown. This also covers an `IOException` or `RuntimeException` thrown while refreshing the block info. - `initialize()` now makes a single attempt instead of running its own retry loop. Its callers already retry, so a failed stream start is handled exactly once. With the reset above, the nested loop would otherwise restart the retry budget and never give up. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17765 ## How was this patch tested? New unit tests in `TestStreamBlockInputStream`. Each one fails a read, then checks that the next read on the same stream starts a fresh stream and returns the data: - terminal and non-retriable stream failures, - excluded datanodes are forgotten after the read gives up, - retry budget is restored, for stream reads and for the under-construction block length lookup, - a stream that keeps failing to start gives up instead of retrying forever, - block info refresh failing with an `IOException` or a `RuntimeException`, - the next read resumes from the current position after a full or partial failure, - an interrupted retry sleep. -- 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]
