Repository navigation
[Server] Report an unreadable table metadata file as the failure it is - #1845
Conversation
|
Wait for #1797 to get in first. |
4c1be22 to
a87a641
Compare
|
Rebased onto |
a87a641 to
a38b03d
Compare
|
Rebased onto |
| if (cause instanceof BadRequestException) { | ||
| return wrapException(ErrorCode.INVALID_ARGUMENT, cause); | ||
| } | ||
| if (cause instanceof NotFoundException) { |
There was a problem hiding this comment.
This error from Iceberg is thrown for any file not found. Today only table metadata error can be triggered. But this is not future proof.
The error message can be weakened as "Could not read this table" instead.
There was a problem hiding this comment.
Weakened to "Could not read this table", and the comment now says why: Iceberg raises this for any file, today only a table's metadata file reaches here, and naming that file would make the message wrong as soon as another read raises it.
| assertThat(error.code()).isEqualTo(500); | ||
| assertThat(error.type()).isEqualTo(ServiceFailureException.class.getSimpleName()); | ||
| // Where the server keeps the file is not the client's business. | ||
| assertThat(error.message()).doesNotContain(icebergTableLocation.toString()); |
There was a problem hiding this comment.
Please also assert on the mesage text.
There was a problem hiding this comment.
Added -- the test now asserts the message is exactly "Could not read this table", alongside the existing check that it does not quote the server's storage path.
A table the catalog lists whose metadata file cannot be read came back as a 500 typed "NotFoundException", with the message Iceberg's file reader produced: "Failed to read file:" and the path the server keeps the file at. Iceberg raises that exception for any file a table points at, and this handler had no case for it, so the status came from the internal error the request became while the type came from the cause. The two contradict each other: a client reads a not-found type as something it can act on -- the table it asked for is gone -- when the table is there and the server could not read it. Report it as a service failure instead, which is what the 500 already said, and say that the table's Iceberg metadata could not be read rather than quoting the reader and the location. The original failure stays as the cause, so the server's own logs still name the file. Signed-off-by: Noritaka Sekiyama <[email protected]>
Review follow-up. Iceberg raises NotFoundException for any file it cannot read; today only a table's metadata file reaches this handler, but naming that file in the message makes the answer wrong the moment another read starts raising it. Name the table instead, and pin the message in the test. Signed-off-by: Noritaka Sekiyama <[email protected]>
649b51b to
5956f6f
Compare
- Resolve conflict in `IcebergRestCatalogTest`, keeping both sides' new tests: - this PR's `testListNamespacesUnderAParent` and `testReportMetricsRejectsAnUnreadableBodyWithoutLeakingTheParser` - main's `testLoadTableWhoseMetadataCannotBeRead` (unitycatalog#1845) Signed-off-by: Yi Li <[email protected]>
PR Checklist
docsis updatedDescription of changes
Fixes #1841.
A table the catalog lists whose metadata file cannot be read came back as a 500 typed
NotFoundException, with the file reader's message and the path the server keeps the file at. Icebergraises that exception for any file a table points at, and this handler had no case for it, so the
status came from the internal error the request became while the type came from the cause.
IcebergRestExceptionHandlernow answers it as a service failure, which is what the 500 already said,with a message that says the table's Iceberg metadata could not be read. The original failure stays as
the cause, so the server's own logs still name the file and the reason.
For users: a client can tell "this table is gone" from "this server could not read this table", which
the previous response conflated, and the storage path no longer reaches the client.
testLoadTableWhoseMetadataCannotBeReaddeletes the metadata file of a registered table and pins the500, the
ServiceFailureExceptiontype and the absence of the table's location from the message. Itfails on an unfixed tree and passes with the fix; the full
server/testsuite shows no failureattributable to this change.