You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by "aakashofficial-k01 (via GitHub)" <gi...@apache.org> on 2026/09/07 18:20:14 UTC

[I] [Bug]: Iceberg REST catalog missing HEAD route for namespaces returns HTTP 200 on non-existent namespaces [amoro]

aakashofficial-k01 opened a new issue, #4363:
URL: https://github.com/apache/amoro/issues/4363

   ### What happened?
   
   In `RestCatalogService.java`, the `head(...)` route is registered for tables (`tableExists`), but was omitted for namespaces:
   
   ```java
   // Tables have HEAD registered:
   head("/v1/catalogs/{catalog}/namespaces/{namespace}/tables/{table}", this::tableExists);
   
   // Namespaces only have GET, POST, DELETE:
   get("/v1/catalogs/{catalog}/namespaces/{namespace}", this::getNamespace);
   delete("/v1/catalogs/{catalog}/namespaces/{namespace}", this::dropNamespace);
   ```
   
   When clients issue `HEAD /v1/{prefix}/namespaces/{namespace}`:
   1. Javalin router finds no matching route.
   2. The request falls through to Jetty's static file handler, returning `HTTP 200 OK` (0 bytes).
   3. Modern, spec-compliant Iceberg REST clients (such as Apache's official `iceberg-go` client via `cat.CheckNamespaceExists`) interpret `HTTP 200 OK` as existence, incorrectly concluding that any non-existent database exists (`Exists: true`).
   
   **Expected Behavior:**
   Per the Iceberg REST Catalog OpenAPI specification (`operationId: namespaceExists`):
   - `HEAD /v1/{prefix}/namespaces/{namespace}` should return `204 No Content` if the namespace exists.
   - It should return `404 Not Found` if the namespace does not exist.
   
   ### Affects Versions
   master, 0.8.x, 0.9.x
   
   ### What table formats are you seeing the problem on?
   - Iceberg
   
   ### What engines are you seeing the problem on?
   - AMS
   
   ### How to reproduce
   Run:
   ```bash
   curl -i -X HEAD http://<ams-host>:1630/api/iceberg/rest/v1/catalogs/<catalog>/namespaces/non_existent_db
   ```
   
   **Actual:**
   `HTTP/1.1 200 OK`
   
   **Expected:**
   `HTTP/1.1 404 Not Found`
   
   ### Relevant log output
   ```text
   === Testing Existing Namespace 'test_db' ===
   [HTTP-GO] HEAD   http://amoro:1630/api/iceberg/rest/v1/catalogs/lakehouse/namespaces/test_db
   [HTTP-GO] -> 200 200 OK
   CheckNamespaceExists('test_db') -> Exists: true, Err: <nil>
   
   === Testing Non-Existent Namespace 'non_existent_db' ===
   [HTTP-GO] HEAD   http://amoro:1630/api/iceberg/rest/v1/catalogs/lakehouse/namespaces/non_existent_db
   [HTTP-GO] -> 200 200 OK
   CheckNamespaceExists('non_existent_db') -> Exists: true, Err: <nil>
   ```
   
   ### Are you willing to submit a PR?
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   - [x] I agree to follow this project's Code of Conduct
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@amoro.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Iceberg REST catalog missing HEAD route for namespaces returns HTTP 200 on non-existent namespaces [amoro]

Posted by "czy006 (via GitHub)" <gi...@apache.org>.
czy006 closed issue #4363: [Bug]: Iceberg REST catalog missing HEAD route for namespaces returns HTTP 200 on non-existent namespaces
URL: https://github.com/apache/amoro/issues/4363


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@amoro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org