Core, REST: Avoid logging on every error #14908
Open
+3
−0
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.
I see a long stack trace every time a REST server returns an error response, e.g., 404. This is the minimal reproduction.
$ gradle :iceberg-core:test --tests "org.apache.iceberg.rest.TestRESTCatalog.testSetNamespacePropertiesNamespaceDoesNotExist" ... [qtp236002428-39] ERROR org.apache.iceberg.rest.RESTCatalogServlet - Error processing REST request org.apache.iceberg.exceptions.RESTException: Unhandled error: ErrorResponse(code=404, type=NoSuchNamespaceException, message=Namespace does not exist: newdb) org.apache.iceberg.exceptions.NoSuchNamespaceException: Namespace does not exist: newdb at org.apache.iceberg.inmemory.InMemoryCatalog.loadNamespaceMetadata(InMemoryCatalog.java:275) at org.apache.iceberg.rest.CatalogHandlers.updateNamespaceProperties(CatalogHandlers.java:218) at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:242) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:165) at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:569) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)Or we can reproduce it by sending a request, e.g.,
curl http://localhost:8181/v1/namespaces/default/tables/test, againsticeberg-rest-fixture.Logging a stack trace for a 404 Not Found response is verbose in most use cases.
The first implementation of this pull request does not change the overall flow control. Ideally,
RESTCatalogAdapter#executeshould probably not throw a RESTException; however, it may require modifyingBaseHTTPClient, so I opened this PR with a minimal change.