You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2010/10/27 21:17:20 UTC

[jira] Created: (HBASE-3161) Provide option for Stargate to only serve GET requests

Provide option for Stargate to only serve GET requests
------------------------------------------------------

                 Key: HBASE-3161
                 URL: https://issues.apache.org/jira/browse/HBASE-3161
             Project: HBase
          Issue Type: Improvement
          Components: rest
    Affects Versions: 0.20.6
            Reporter: Ted Yu


Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "HBase Review Board (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930760#action_12930760 ] 

HBase Review Board commented on HBASE-3161:
-------------------------------------------

Message from: "Bennett Neale" <be...@gmail.com>


bq.  On 2010-11-10 08:34:06, stack wrote:
bq.  > This patch looks great to me.  Andrew or Ted, you want to take a look?  Bennett do all hbase tests pass locally for you?

Tests pass locally, already see you committed.  Cool.  :)


- Bennett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://review.cloudera.org/r/1204/#review1885
-----------------------------------------------------------





> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>             Fix For: 0.90.0
>
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925569#action_12925569 ] 

Ted Yu commented on HBASE-3161:
-------------------------------

And these places:
tyumac:stargate tyu$ find . -name '*.java' -exec grep -i '@POST' {} \; -print
  @POST
  @POST
./src/java/org/apache/hadoop/hbase/stargate/RowResource.java
  @POST
./src/java/org/apache/hadoop/hbase/stargate/ScannerResource.java
  @POST
./src/java/org/apache/hadoop/hbase/stargate/SchemaResource.java

> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "Andrew Purtell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925914#action_12925914 ] 

Andrew Purtell commented on HBASE-3161:
---------------------------------------

Yes this looks good. Add a helper function to RestServlet that checks the configuration, i.e. RestServlet#isReadOnly and use it to do a check at the top of methods tagged with @PUT or @POST, or the common functions they call out to, and if read only do throw new WebApplicationException(Response.Status.FORBIDDEN). 

> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack resolved HBASE-3161.
--------------------------

       Resolution: Fixed
    Fix Version/s: 0.90.0
     Hadoop Flags: [Reviewed]

Committed.  Thanks for the patch Bennett.

> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>             Fix For: 0.90.0
>
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "HBase Review Board (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930646#action_12930646 ] 

HBase Review Board commented on HBASE-3161:
-------------------------------------------

Message from: stack@duboce.net

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://review.cloudera.org/r/1204/#review1885
-----------------------------------------------------------

Ship it!


This patch looks great to me.  Andrew or Ted, you want to take a look?  Bennett do all hbase tests pass locally for you?

- stack





> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925562#action_12925562 ] 

Ted Yu commented on HBASE-3161:
-------------------------------

One solution is to introduce a new command line option, -ro.

./bin/hbase org.apache.hadoop.hbase.stargate.Main -ro

In Main.java:
    port = servlet.getConfiguration().getInt("hbase.rest.port", port);
    if (cmd.hasOption("ro")) {
        servlet.getConfiguration().setInt("hbase.rest.readonly", 1);
    }

I used the following:
      if (servlet.getConfiguration().getInt("hbase.rest.readonly", 0) == 1) {
          ResponseBuilder response = Response.ok(); 
          return response.build();
      }

in these places:
tyumac:stargate tyu$ find . -name '*.java' -exec grep -i '@Delete' {} \; -print
  @DELETE
./src/java/org/apache/hadoop/hbase/stargate/RowResource.java
  @DELETE
./src/java/org/apache/hadoop/hbase/stargate/ScannerInstanceResource.java
  @DELETE
./src/java/org/apache/hadoop/hbase/stargate/SchemaResource.java
tyumac:stargate tyu$ find . -name '*.java' -exec grep -i '@Put' {} \; -print
  @PUT
  @PUT
./src/java/org/apache/hadoop/hbase/stargate/RowResource.java
  @PUT
./src/java/org/apache/hadoop/hbase/stargate/ScannerResource.java
  @PUT
./src/java/org/apache/hadoop/hbase/stargate/SchemaResource.java

> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "HBase Review Board (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930662#action_12930662 ] 

HBase Review Board commented on HBASE-3161:
-------------------------------------------

Message from: "Ted Yu" <te...@yahoo.com>

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://review.cloudera.org/r/1204/#review1886
-----------------------------------------------------------

Ship it!


- Ted





> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3161) Provide option for Stargate to only serve GET requests

Posted by "HBase Review Board (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930543#action_12930543 ] 

HBase Review Board commented on HBASE-3161:
-------------------------------------------

Message from: "Bennett Neale" <be...@gmail.com>

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://review.cloudera.org/r/1204/
-----------------------------------------------------------

Review request for hbase.


Summary
-------

Provided an option to pass a "read-only" argument when starting up the REST server based on the comments provided by apurtell.  Server will only honor GET HTTP method requests in this mode.  Also added "hbase.rest.port" and "hbase.rest.readonly" to the config hbase-default.xml and updated test cases.  


apurtell -- "Add a helper function to RestServlet that checks the configuration, i.e. RestServlet#isReadOnly and use it to do a check at the top of methods tagged with @PUT or @POST, or the common functions they call out to, and if read only do throw new WebApplicationException(Response.Status.FORBIDDEN)."


This addresses bug HBASE-3161.
    http://issues.apache.org/jira/browse/HBASE-3161


Diffs
-----

  /trunk/src/main/java/org/apache/hadoop/hbase/rest/Constants.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/Main.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java 1033370 
  /trunk/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java 1033370 
  /trunk/src/main/resources/hbase-default.xml 1033370 
  /trunk/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java 1033370 
  /trunk/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java 1033370 
  /trunk/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java 1033370 

Diff: http://review.cloudera.org/r/1204/diff


Testing
-------


Thanks,

Bennett




> Provide option for Stargate to only serve GET requests
> ------------------------------------------------------
>
>                 Key: HBASE-3161
>                 URL: https://issues.apache.org/jira/browse/HBASE-3161
>             Project: HBase
>          Issue Type: Improvement
>          Components: rest
>    Affects Versions: 0.20.6
>            Reporter: Ted Yu
>
> Provide option for Stargate to only serve GET requests. Hbase health check can utilize this option.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.