Repository navigation
[Server] Answer unrouted Iceberg requests with an Iceberg error document - #1836
Merged
yili-db merged 2 commits intoSep 9, 2026
Merged
Conversation
A request to an Iceberg REST endpoint this server does not implement never reaches the Iceberg service, so IcebergRestExceptionHandler never sees it and Armeria answers with its own plain-text body, a "Status" line followed by a "Description" line. Iceberg's own ErrorResponseParser cannot read that, so a client that does not consult the advertised endpoints list -- one written before that field existed, or one that skips it -- gets an unreadable response where the REST spec puts an error document. Register a ServerErrorHandler that renders these status-only responses as an Iceberg ErrorResponse, for paths under the Iceberg API only. Requests that reach a service keep being rendered by that service's handler, and paths outside the Iceberg API keep Armeria's rendering, so nothing else on the server changes. The prefix comes from the same constant the service is mounted with, so the two cannot drift apart, and it matches the mount point itself as well as the paths under it, on a slash boundary so that a sibling path starting with the same characters is not caught by it. Signed-off-by: Noritaka Sekiyama <[email protected]>
moomindani
force-pushed
the
feat/iceberg-unrouted-errors
branch
from
September 5, 2026 19:30
bd56e3b to
ff01411
Compare
yili-db
reviewed
Sep 7, 2026
|
|
||
| @Test | ||
| public void testUnroutedIcebergRequestsAnswerWithAnIcebergError() throws Exception { | ||
| createUniformIcebergTable(); |
Collaborator
There was a problem hiding this comment.
This setup looks unnecessary since none of the RPC calls below hits any actual endpoint.
Contributor
Author
There was a problem hiding this comment.
Removed; you are right, every request there is answered before a service is reached, so nothing needs to exist. A comment says so instead.
yili-db
reviewed
Sep 7, 2026
yili-db
left a comment
Collaborator
There was a problem hiding this comment.
This is a good fix. Just a minor comment.
Thank you!
Review follow-up. Every request in the test is answered before a service is reached, so the catalog, schema and table it created were never involved; a comment says so in their place. Signed-off-by: Noritaka Sekiyama <[email protected]>
yili-db
approved these changes
Sep 9, 2026
This was referenced Sep 10, 2026
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.
PR Checklist
docsis updatedDescription of changes
Fixes #1835.
A request to an Iceberg REST path this server does not implement never reaches
IcebergRestCatalogService, soIcebergRestExceptionHandlernever sees it and Armeria renders thestatus itself as
text/plain--Status: 404and aDescription:line. Iceberg'sErrorResponseParsercannot read that, so a client that does not consult the advertisedendpointslist gets an unparsable body where the REST spec puts an error document.
This registers a
ServerErrorHandleron the Armeria server that renders those status-only responsesas an Iceberg
ErrorResponse, and only for paths under the Iceberg API:onServiceExceptionreturns null, so an exception raised by a service is still rendered by thatservice's own handler; nothing about the existing error paths changes.
renderStatusreturns null unless the request path starts with the Iceberg API prefix, sonon-Iceberg paths and
/keep Armeria's rendering.ICEBERG_RELATIVE_PATHconstantUnityCatalogServermounts theservice with, so the mount point and the handler cannot drift apart. It matches on a slash
boundary, and matches the mount point itself as well as the paths under it, so
GET /api/2.1/unity-catalog/icebergis covered while a sibling path that merely starts with thesame characters is not.
NotFoundException; the remaining statuses have no Iceberg exception of their own andare named
RESTException, which is what Iceberg's client raises for them.For users: an Iceberg client that calls an endpoint this catalog does not implement now fails with
the exception the status means, instead of a parse error. Responses from implemented endpoints are
byte-for-byte unchanged.
Verified on
mainat 58d5c7b. Before,GET .../namespaces/{ns}/viewsansweredtext/plainStatus: 404\nDescription: Not Found\nandDELETE .../namespaces/{ns}answeredStatus: 405\nDescription: Method Not Allowed\n; after, they answer{"error":{"message":"Not Found","type":"NotFoundException","code":404}}and{"error":{"message":"Method Not Allowed","type":"RESTException","code":405}}asapplication/json.testUnroutedIcebergRequestsAnswerWithAnIcebergErrorfails on an unfixed tree(
expected: application/json but was: text/plain; charset=utf-8) and passes with the fix. It pins theerror
typeandmessageas well as the status --NotFoundExceptionfor the 404 andRESTExceptionfor the 405 -- the mount point itself, and two paths outside the Iceberg API: anotherUC endpoint, and
/, which still answersHello, Unity Catalog!.IcebergRestCatalogTest(10/10) andArmeriaServerBuilderTestare green, and the fullserver/testsuite shows no failure attributable to this change.