HIVE-29563: Iceberg REST Catalog's error logs are too verbose#6425
HIVE-29563: Iceberg REST Catalog's error logs are too verbose#6425okumin wants to merge 5 commits intoapache:masterfrom
Conversation
9debb2e to
1daa058
Compare
| // The caller is responsible for closing the underlying catalog backing this REST catalog. | ||
| response.setStatus(error.code()); | ||
| RESTObjectMapper.mapper().writeValue(response.getWriter(), error); | ||
| return null; |
There was a problem hiding this comment.
RESTServerCatalogAdapter on apache/iceberg extends a RESTClient. I don't know the exact reason. The trick is used in some integration tests.
Anyway, as our adapter never behaves as a client, I removed the dependency on RESTClient. As a good side effect, this change ensures only a single path invokes RESTServerCatalogAdapter#execute and allows us to simplify the implementation.
|
@henrib can you check once |
henrib
left a comment
There was a problem hiding this comment.
If this does not require any test changes, LGTM 👍
There was a problem hiding this comment.
May be also reduce exception verbosity:
public static void configureResponseFromException(
Exception exc, ErrorResponse.Builder errorBuilder) {
int errorCode = EXCEPTION_ERROR_CODES.getOrDefault(exc.getClass(), 500);
errorBuilder
.responseCode(errorCode)
.withType(exc.getClass().getSimpleName())
.withMessage(exc.getMessage());
// avoid exposing stack traces for client errors, but include them for server errors to aid debugging
if (errorCode == 500) {
errorBuilder.withStackTrace(exc);
}
}
okumin
left a comment
There was a problem hiding this comment.
Thanks for your review! It will make upcoming changes easy to review
|
I merged the master branch and resolved conflicts. Additionally, I found that we can't see anything when a 5xx error occurs. I updated it so we can see a similar log on server errors, and INFO log for non-server errors for convenience. |
|



What changes were proposed in this pull request?
Stop logging every client-side error, i.e., 40x errors.
https://issues.apache.org/jira/browse/HIVE-29563
Why are the changes needed?
As explained in HIVE-29563, the current REST API prints the entire stack trace on every error.
apache/iceberg has the same problem and sent a patch, but it has not been reviewed: apache/iceberg#14908
Does this PR introduce any user-facing change?
It includes a change for HMS administrators.
How was this patch tested?