[
https://issues.apache.org/jira/browse/HBASE-28999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17903599#comment-17903599
]
Dávid Paksy commented on HBASE-28999:
-------------------------------------
In the [https://github.com/apache/hbase/pull/6520] it was determined that we
cannot improve the error handling since JAXB / Jackson (for XML / JSON
respectively) calls (streaming) the related code
(TableScanResource.CellSetModelStream) when JAXB / Jackson serializes the
response. Changing the implementation (moving away from the streaming) does not
makes sense because of this.
Other possibility would be to add an explicit check if the table is disabled
but the explicit check may cause some extra network traffic.
We should just leave this be, and trade a good error message off for
performance.
> Scan endpoint returns HTTP 500 Internal Server Error when table is disabled
> ---------------------------------------------------------------------------
>
> Key: HBASE-28999
> URL: https://issues.apache.org/jira/browse/HBASE-28999
> Project: HBase
> Issue Type: Task
> Components: REST
> Affects Versions: 4.0.0-alpha-1
> Reporter: Dávid Paksy
> Assignee: Dávid Paksy
> Priority: Major
> Labels: pull-request-available
>
> h2. Scenario
> Try to use stateless scanner a *disabled table* on REST interface.
> h2. Actual result
> Scan endpoint returns HTTP 500 Internal Server Error.
> {code:java}
> {
> "servlet":"org.apache.hbase.thirdparty.org.glassfish.jersey.servlet.ServletContainer-33c2bd",
> "message":"Request failed.",
> "url":"/test/*",
> "status":"500"
> } {code}
> h2. Expected result
> It should NOT return HTTP 500 Internal Server Error.
> (?) Probably some client error status code (4xx).
> h2. How to reproduce
> * Create a new table (e.g via hbase shell, etc)
> * Disable the table
> * Try to scan the table with the [stateless
> scanner|https://issues.apache.org/jira/browse/HBASE-9343] REST endpoint
> {code:java}
> curl -v -X GET \
> -H "Accept: application/json" \
> "http://localhost:8080/test/*"
> ...
> < HTTP/1.1 500 Server Error
> ...{code}
> h2. Additional information
> REST server logs snippet:
> {code:java}
> 2024-11-26T08:53:25,140 WARN [qtp485475507-50 {}] server.HttpChannel:
> handleException /test/* com.fasterxml.jackson.databind.JsonMappingException:
> org.apache.hadoop.hbase.TableNotEnabledException: test (through reference
> chain:
> org.apache.hadoop.hbase.rest.TableScanResource$CellSetModelStream["Row"])2024-11-26T08:53:25,141
> WARN [qtp485475507-50 {}] server.HttpChannelState: unhandled due to prior
> sendErrorjavax.servlet.ServletException:
> org.apache.hbase.thirdparty.org.glassfish.jersey.server.ContainerException:
> com.fasterxml.jackson.databind.JsonMappingException:
> org.apache.hadoop.hbase.TableNotEnabledException: test (through reference
> chain:
> org.apache.hadoop.hbase.rest.TableScanResource$CellSetModelStream["Row"])
> Caused by: java.io.UncheckedIOException:
> org.apache.hadoop.hbase.TableNotEnabledException: test at
> org.apache.hadoop.hbase.client.ResultScanner$1.hasNext(ResultScanner.java:53)
> ~[hbase-client-4.0.0-alpha-1-SNAPSHOT.jar:4.0.0-alpha-1-SNAPSHOT] at
> org.apache.hadoop.hbase.rest.TableScanResource$1$1.hasNext(TableScanResource.java:77)
> ~[hbase-rest-4.0.0-alpha-1-SNAPSHOT.jar:4.0.0-alpha-1-SNAPSHOT] {code}
> The other scan endpoint handles this better (returns HTTP 406 - Not
> Acceptable):
> {code:java}
> curl -v -X PUT \
>
> -H "Accept: application/json" \
> -H "Content-Type: text/xml" \
> -d '<Scanner batch="1"/>' \
> "http://localhost:8080/test/scanner" | jq
> * Host localhost:8080 was resolved.
> * IPv6: ::1
> * IPv4: 127.0.0.1
> * Connected to localhost (::1) port 8080
> > PUT /test/scanner HTTP/1.1
> > Host: localhost:8080
> > User-Agent: curl/8.9.1
> > Accept: application/json
> > Content-Type: text/xml
> > Content-Length: 20
> >
> } [20 bytes data]
> * upload completely sent off: 20 bytes
> < HTTP/1.1 201 Created
> < X-Frame-Options: DENY
> < X-Content-Type-Options: nosniff
> < X-XSS-Protection: 1; mode=block
> < Location: http://localhost:8080/test/scanner/17327004740183794717d
> < Content-Length: 0
> curl -vi -X GET -H "Accept: text/json"
> http://localhost:8080/test/scanner/17327004740183794717d
> * Host localhost:8080 was resolved.
> * IPv6: ::1
> * IPv4: 127.0.0.1
> * Trying [::1]:8080...
> * Connected to localhost (::1) port 8080
> > GET /test/scanner/17327004740183794717d HTTP/1.1
> > Host: localhost:8080
> > User-Agent: curl/8.9.1
> > Accept: text/json
> >
> * Request completely sent off
> < HTTP/1.1 406 Not Acceptable
> HTTP/1.1 406 Not Acceptable
> < X-Frame-Options: DENY
> X-Frame-Options: DENY
> < X-Content-Type-Options: nosniff
> X-Content-Type-Options: nosniff
> < X-XSS-Protection: 1; mode=block
> X-XSS-Protection: 1; mode=block
> < Cache-Control: must-revalidate,no-cache,no-store
> Cache-Control: must-revalidate,no-cache,no-store
> < Content-Type: text/json
> Content-Type: text/json
> < Content-Length: 187
> Content-Length: 187
> <
> {
> "servlet":"org.apache.hbase.thirdparty.org.glassfish.jersey.servlet.ServletContainer-1dfd5f51",
> "message":"Not Acceptable",
> "url":"/test/scanner/17327004740183794717d",
> "status":"406"
> * Connection #0 to host localhost left intact
> }%
>
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)