Core, AWS: Fix REST catalog hanging on permission errors - #17400
Open
sqd wants to merge 1 commit into
Open
Conversation
xndai
reviewed
Jul 29, 2026
|
|
||
| assertThatThrownBy(() -> s3InputStream.readFully(0, new byte[0])) | ||
| .isInstanceOf(ForbiddenException.class) | ||
| .hasMessageContaining("Access Denied"); |
Contributor
There was a problem hiding this comment.
Should we validate message content here? The exception message could change in the future.
Contributor
Author
There was a problem hiding this comment.
This is not testing what exact words are returned from awssdk. This is testing that whatever the library returns will get propagated so the error is clearer to the client. I extrapolated this to a const to make the intention clearer.
| import org.apache.iceberg.io.FileIO; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class TestBaseMetastoreTableOperations { |
Contributor
There was a problem hiding this comment.
Class name is very general. But you are only testing the retries on transient error and un-recoverable errors.
Contributor
Author
There was a problem hiding this comment.
Good point. I'll change this.
Refreshing table or view metadata retries any read failure up to 20 times with exponential backoff (about 90 seconds) unless it is a NotFoundException. A permission error is permanent, so retrying can never succeed and only delays surfacing the real failure. Behind a REST catalog, the server holds the loadTable request open for the whole retry loop, so clients hit their socket read timeout first and report SocketTimeoutException while the actual cause (for example an HDFS "Permission denied" on the metadata file) is only visible in server logs. Stuck requests also pin server worker threads, causing timeouts for unrelated tables. Translate access-denied errors into ForbiddenException at the read boundary - HadoopFileIO on AccessControlException and S3FileIO on S3Exception with status 403 - and stop metadata refresh retries on ForbiddenException. RESTCatalogAdapter already maps ForbiddenException to HTTP 403 and REST clients map 403 back to ForbiddenException, so callers now receive the underlying permission error immediately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refreshing table or view metadata retries any read failure up to 20 times with exponential backoff (about 90 seconds) unless it is a NotFoundException. A permission error is permanent, so retrying can never succeed and only delays surfacing the real failure.
Behind a REST catalog, the server holds the loadTable request open for the whole retry loop, so clients hit their socket read timeout first and report SocketTimeoutException while the actual cause (for example an HDFS "Permission denied" on the metadata file) is only visible in server logs. Stuck requests also pin server worker threads, causing timeouts for unrelated tables.
Translate access-denied errors into ForbiddenException at the read boundary - HadoopFileIO on AccessControlException and S3FileIO on S3Exception with status 403 - and stop metadata refresh retries on ForbiddenException. RESTCatalogAdapter already maps ForbiddenException to HTTP 403 and REST clients map 403 back to ForbiddenException, so callers now receive the underlying permission error immediately.