You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Jesse Yates (Created) (JIRA)" <ji...@apache.org> on 2012/03/09 09:02:14 UTC

[jira] [Created] (HBASE-5548) Add ability to get a table in the shell

Add ability to get a table in the shell
---------------------------------------

                 Key: HBASE-5548
                 URL: https://issues.apache.org/jira/browse/HBASE-5548
             Project: HBase
          Issue Type: Improvement
          Components: shell
            Reporter: Jesse Yates
             Fix For: 0.96.0


Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 

There are two main considerations:
* It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
* the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)

We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-v5.patch

Attaching patch with fixes as per stack. Turns out the get issue was just a misspelling I didn't catch; _think_ everything else is working.

Also, this includes a slight refactor so the help text actually lives in the table class, not remotely in table_help.rb. If it was enough that I forgot where it lived, then others will too :)

Should be good to go.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

stack updated HBASE-5548:
-------------------------

    Status: Patch Available  (was: Reopened)

Submitting addendum.  Pardon my being zealous for this fancy new feature
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates commented on HBASE-5548:
------------------------------------

yeah, was waiting for the QA run on it... maybe we jumped the gun a little there (though TestShell has been always a little funky on my machine). Looking into the issue now.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

stack updated HBASE-5548:
-------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

I committed this a while back.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Sorry Jesse for taking a while to get back to this.  Patch looks good.  I tried it some more and got this:

{code}
hbase(main):011:0> t.put 'x', 'y:x', 'x'
0 row(s) in 0.0110 seconds
hbase(main):012:0> t.get 'x'
COLUMN                                               CELL                                                                                                                                                   

ERROR: undefined method `get_internal' for Hbase::Table - y:Hbase::Table

Here is some help for this command:
Get row or cell contents; pass table name, row, and optionally
a dictionary of column(s), timestamp, timerange and versions. Examples:

  hbase> get 't1', 'r1'
  hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]}
  hbase> get 't1', 'r1', {COLUMN => 'c1'}
  hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
  hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
  hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
  hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
  hbase> get 't1', 'r1', 'c1'
  hbase> get 't1', 'r1', 'c1', 'c2'
  hbase> get 't1', 'r1', ['c1', 'c2']

The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding commands would be:

  hbase> t.get 'r1'
  hbase> t.get 'r1', {TIMERANGE => [ts1, ts2]}
  hbase> t.get 'r1', {COLUMN => 'c1'}
  hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']}
  hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
  hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
  hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
  hbase> t.get 'r1', 'c1'
  hbase> t.get 'r1', 'c1', 'c2'
  hbase> t.get 'r1', ['c1', 'c2']
{code}

Seems like an issue?

Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems).  It could be confusing talking about a 't' w/o saying where it came from?

I like the output of t.help.

This is odd though:

{code}
  hbase> t.put 'r', 'c', 'q', 'v'
 which puts a row 'r' with column family 'c', qualifier 'q' and value 'v' into table t.
{code}

In the rest of the shell columns are a combo of family and qualifier delimited by the ':'.  You are changing that w/ the above.


                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK-security #189 (See [https://builds.apache.org/job/HBase-TRUNK-security/189/])
    HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766)

     Result = SUCCESS
stack : 
Files : 
* /hbase/trunk/src/main/ruby/hbase/table.rb
* /hbase/trunk/src/main/ruby/shell/commands/count.rb
* /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
* /hbase/trunk/src/test/ruby/hbase/admin_test.rb
* /hbase/trunk/src/test/ruby/hbase/table_test.rb
* /hbase/trunk/src/test/ruby/shell/commands_test.rb
* /hbase/trunk/src/test/ruby/test_helper.rb

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13248045#comment-13248045 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world.

Doing a 360 on my comments above; looks like you can suppress it pretty easily, if not entirely cleanly. I'd rather not hack the irb too much, but just do it via changes to the methods on Table. Below is the output I have it using now.

{code}
1.9.2-p290 :002 > t = get_table 't'
0 row(s) in 0.0240 seconds

 =>Hbase::Table - t  
1.9.2-p290 :003 >
{code} 

Essentially, we are just printing out the class and then the name of the table. If we wanted to do more complicated things  (for instance, print the CFs for the table, or the whole descriptor) we can easily add it later to the Table.to_s method.

Pretty clean and makes sense for people used to the ruby REPL as you see the value of what you just got back (as a string).

bq. I'm thinking it might be nice to add in some help specific to a table command more dynamically.

Punting on this - doubt it is going to be very rare that we will have to mod the help for the command dynamically - you probably are changing the nature of the command, so its really not worth it at the moment.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13248070#comment-13248070 ] 

jiraposter@reviews.apache.org commented on HBASE-5548:
------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4668/
-----------------------------------------------------------

Review request for hbase and Michael Stack.


Summary
-------

Adding the ability to get a reference to a table in the shell. 

Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a  reference to a table both on creation (via create(...)) and at will (via get_table(...)).

Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc.. 

There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class.  


This addresses bug HBASE-5548.
    https://issues.apache.org/jira/browse/HBASE-5548


Diffs
-----

  src/main/ruby/hbase/hbase.rb 2c37840 
  src/main/ruby/hbase/table.rb 41dcf21 
  src/main/ruby/shell.rb 53f3de8 
  src/main/ruby/shell/commands.rb af6df33 
  src/main/ruby/shell/commands/count.rb 6596441 
  src/main/ruby/shell/commands/create.rb 14c1b0f 
  src/main/ruby/shell/commands/delete.rb 12bc405 
  src/main/ruby/shell/commands/deleteall.rb 5731b60 
  src/main/ruby/shell/commands/get.rb 754c3d6 
  src/main/ruby/shell/commands/get_counter.rb 3cbe226 
  src/main/ruby/shell/commands/get_table.rb PRE-CREATION 
  src/main/ruby/shell/commands/incr.rb 38a2fc5 
  src/main/ruby/shell/commands/put.rb dde0433 
  src/main/ruby/shell/commands/scan.rb e58aaac 
  src/main/ruby/shell/commands/table_help.rb PRE-CREATION 
  src/test/ruby/hbase/admin_test.rb 0c2672b 

Diff: https://reviews.apache.org/r/4668/diff


Testing
-------

Manual and basic unit tests.


Thanks,

Jesse


                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257829#comment-13257829 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. Seems like an issue?

yeah, I think so. Odd that I missed that, though I may have made some changes and not done all the testing I should have. I'll take a look.

bq. Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems). It could be confusing talking about a 't' w/o saying where it came from?

Yeah, that can be confusing. I'll clean it up a bit.

bq. In the rest of the shell columns are a combo of family and qualifier delimited by the ':'. You are changing that w/ the above.

Fair enough, though I would argue this is cleaner, but I switch it over for this patch.

Thanks for giving it a spin stack!
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK #2832 (See [https://builds.apache.org/job/HBase-TRUNK/2832/])
    HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766)

     Result = FAILURE
stack : 
Files : 
* /hbase/trunk/src/main/ruby/hbase/table.rb
* /hbase/trunk/src/main/ruby/shell/commands/count.rb
* /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
* /hbase/trunk/src/test/ruby/hbase/admin_test.rb
* /hbase/trunk/src/test/ruby/hbase/table_test.rb
* /hbase/trunk/src/test/ruby/shell/commands_test.rb
* /hbase/trunk/src/test/ruby/test_helper.rb

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-v2.patch

Went back and forth a bunch on how I wanted to implement this (including coding up a couple different versions), hence the few days its taken me to get this patch up. 

Went with the current model as it helps keep concerns separate - table just does the internal work of how to do scans, puts, etc (the latter to be impl), and passes on the formatting work and specific help implementations to the command instances. 

To get here, had to add the ability to call a command by name in the Shell class, hence the internal_command method, but actually reuses most of the current support, even when calling the method from the table (safe views of commands, etc).

Final consideration: we may want to add a method to the command class so a command instance can add the ability to add a method to a table more easily, instead of having to add the section seen at the bottom of ::Commands::Scan, where we open back up the Table class. 

Thoughts? Or is that work minimal enough to justify for adding new commands?

If we are happy with this, I'll port the other table commands to this new model and post up a patch for review.

For completeness, the other major options considered:
* have table do all the formatting,etc now handled by the commands 
** side effect - commands are pretty useless except for help and is a pretty big rewrite and require the table to get a formmater as well as an instance of each command
** bonus - methods like scan_internal can be made private

* similar to this patch, but have the command on load register itself with the table so can do help
** minus - lots of reproduced functionality like what the Shell is currently doing with loading commands. Also, don't gain much and same problems as above
** bonus - code is a bit more centralized 
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

You going to upload new patch Jesse or this is good to go?
St.Ack
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257641#comment-13257641 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

Sooo, I guess no one has comments on it and we can roll it in? I know this isn't super crucial (likely causing the lack of reviews), but its been up for a while and would like to get it in.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230853#comment-13230853 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

Oh, and for completeness, here is what the output now looks like:
{code}
1.9.2-p290 :002 > list
TABLE                                                                                                            
0 row(s) in 0.0300 seconds

1.9.2-p290 :003 > t = create 't', 'f'
0 row(s) in 1.0970 seconds

 => #<Hbase::Table:0x6601879b @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x5b489c06>, @shell=#<Shell::Shell:0x3bba1894 @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @hbase_admin=#<Hbase::Admin:0x3755e508 @zk_wrapper=#<#<Class:0x682f8c99>:0x45ed957d>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x385715>, @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2a717ef5>>, @hbase=#<Hbase::Hbase:0x21ff3fcf @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>>>> 
1.9.2-p290 :004 > t.put 'r', 'f', 'v'
1.9.2-p290 :005 > t.scan
ROW                           COLUMN+CELL                                                                        
 r                            column=f:, timestamp=1331865816290, value=v                                        
1 row(s) in 0.0520 seconds
1.9.2-p290 :006 > t.help 'scan'
Scan a table; pass table name and optionally a dictionary of scanner
specifications.  Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS.

If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family:'.

The filter can be specified in two ways:
1. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE-4176 JIRA
2. Using the entire package name of the filter.

Some examples:

  hbase> scan '.META.'
  hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
  hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
  hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
  hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
  hbase> scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}

For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false).  By
default it is enabled.  Examples:

  hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}

Also for experts, there is an advanced option -- RAW -- which instructs the
scanner to return all cells (including delete markers and uncollected deleted
cells). This option cannot be combined with requesting specific COLUMNS.
Disabled by default.  Example:

  hbase> scan 't1', {RAW => true, VERSIONS => 10}

Scan can also be used directly from a table, by first getting a reference to a table, like such:

  hbase> t = get_table 't'
  hbase> t.scan

Note in the above situation, you can still provide all the filtering, columns, options, etc as
described above.
1.9.2-p290 :007 >
{code}
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Backed out the miscommit of hbase-5840 that went in with this.  Sorry for the mess.  Thanks Ram for fingering it.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235683#comment-13235683 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. You are doing call by String methodname. It makes it all a bit more brittle 

Indeed, but its how we do everything else in the shell, so I didn't think it would be so bad. 

bq. Whats an exception look like if you pass an unknown 'command'. Is it intelligible?

Ends up spitting out this:
{code}
NoMethodError: undefined method `new' for nil:NilClass
{code}
So not really - I'll clean it up.

bq. Needs lots of comments explaining whats going on.

I'll work on it - anything in particular odd?
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

You are doing call by String methodname.  It makes it all a bit more brittle but there is only the one code path so its grokable.  Whats an exception look like if you pass an unknown 'command'.  Is it intelligible?  I don't think you have any other choice.  Looks good to me as a direction.  Needs lots of comments explaining whats going on.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234979#comment-13234979 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

Was planning on getting it the code up on RB tonight, but I guess for reviews it would take a couple days. If its not done on time, 0.94.1 would be acceptable. But 0.94 up since that was what we were thinking as per the discussion on HBASE-5592. 
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates commented on HBASE-5548:
------------------------------------

do we want to close this ticket now?
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-v3.patch

Updated patch with:
* more commenting!
* updates for all the table commands
* addition of admin utilities on a table (e.g. flush, enable, disable and drop)

Think this is ready (and large enough to RB). thoughts?
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates commented on HBASE-5548:
------------------------------------

thanks stack!
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Release Note: 
Adding the ability to get a reference to a table in the shell.

Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a reference to a table both on creation (via create(...)) and at will (via get_table(...)).

Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc..

There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class. 
    
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

I don't get this comment:

{code}
+        #define the command name in 'where' namespace
+        #which actually just delegates to the shell instance
{code}

Instead of
{code}
+        ret = translate_hbase_exceptions(*args) { command(*args) }
+        return ret
{code}

.. why not just
{code}
+        return translate_hbase_exceptions(*args) { command(*args) }
{code}

Don't need this anymore

+# Copyright 2010 The Apache Software Foundation


I don't see table.help.  Is it missing from this patch?

Can you include snippet of a session using this new facility in shell?

Good on you Jesse
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Lars Hofhansl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234947#comment-13234947 ] 

Lars Hofhansl commented on HBASE-5548:
--------------------------------------

@Jesse: What's your feeling here. 0.94? Means it needs to be done in a day or two.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13226747#comment-13226747 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

{code}
+        #define the command name in 'where' namespace
+        #which actually just delegates to the shell instance
{code}
The 'where' namespace is just the variable name, which in our case is the IRB shell namespace. However, internally, hirb just has a reference to the an instance of the Shell class, to which it is delegating all the calls. I'll fix the commenting to make it clearer.

{code}
+        ret = translate_hbase_exceptions(*args) { command(*args) }
+        return ret
{code}
Yeah, that is just cruft from debugging, where I dumping some output in the middle.

bq. I don't see table.help. Is it missing from this patch?

Yeah, completely forgot to implement it ;) I'll put it into the next version. There are still some issues around hiding methods, since we do actually get autocomplete, which is nice. I'm also working on a version that will format the output (as opposed to the raw stuff we see from a scan below).

Here is what some shell output looks like with the current patch:
{code}
1.9.2-p290 :001 > create 't', 'f'
0 row(s) in 1.7060 seconds

1.9.2-p290 :002 > t = get_table 't'
0 row(s) in 0.0770 seconds

 => #<Hbase::Table:0x6c6742d0 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x59046270>> 
1.9.2-p290 :003 > t.put 'r', 'f', 'value'
1.9.2-p290 :004 > t.scan
 => {"r"=>{"f:"=>"timestamp=1331353365816, value=value"}} 
{code}
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13227975#comment-13227975 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. get 'tablename', 'yadda', 'yadda'....

Yeah, nothing changes there. In fact, scan (which is the only change that patch introduces) still will work exactly the same way. Same deal for doing something like t.scan

bq. On get_table, should it just be table? 'status' dumps out status, 'version', dumps out 'version'. Maybe it should stay get_table, because it returns something you can catch into a variable?

I was thinking it should stay get_table since table will be clutter the overall naming a little (Table is also the name of the ::Hbase::Table class) and yeah, it implies holding a reference, which _all_ the other commands don't give you. I would imagine doing 
{code}
t = table 't1'
{code}
as actually creating the table if it doesn't exist, or just getting a reference to it (similar to how 'create' works in the latest patch). A follow-on patch would be nice there.

I want to think about the 'right' way to do the extension of ::Hbase::Table, rather than this piecemeal, method-by-method, decentralized increase. Also, adding the same type of system for put, get, delete, etc would be nice. But, yeah, close! 
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK-security #190 (See [https://builds.apache.org/job/HBase-TRUNK-security/190/])
    HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123)

     Result = SUCCESS
stack : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Ok.  Over in hbase-5840 I say I'm going to leave it in but instead I'm going to back it out so its easier on the fellows who are trying to follow behind us trying to make sense of our actions.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Committed addendum.  Thanks for following up Ted (and you Jesse)
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5528-v0.patch

Initial cut at this ticket. Its a little unclean as we don't have a nice way to isolate the java methods from the ruby methods and absolutely zero formatting from the output of the different commands as that is currently handled by the individual 'command' implementations.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (HBASE-5548) Add ability to get a table in the shell

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

Zhihong Yu reopened HBASE-5548:
-------------------------------


I don't see Hadoop QA report on this JIRA.
I can reproduce the following test failure:
{code}
  testRunShellTests(org.apache.hadoop.hbase.client.TestShell): (RuntimeError) Shell unit tests failed. Check output file for details.
{code}
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234594#comment-13234594 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

Waiting on your comments as to if you liked the design of the current patch, with the addition of the table methods via class-reopening and with the internal vs external method stuff, etc. If you are happy, then I'll do the rest of the table commands (put, get, etc.) in the same style and throw a patch up on RB tonight so everyone gets a chance to look.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234120#comment-13234120 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. You pass in the shell instance now instead of formatter when we create a table instance. Do we get the formatter to use from the shell?

Turns out passing in the formatter was cruft - we weren't actually using it. The shell is passed in here so we can use it to do 'good' help output (referencing individual methods). 

bq. For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for. Is this right? Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method?

It shouldn't be running every time - bug if it is. The lines:
{code}
+      if command
+        return @shell.help_command(command)
+      end
+      return <<-EOF
{code}

ensures that only if they _don't_ pass in a command name, that we print out the 'Access an HTable...' lines (note the if...return, end. If you do match the if, then run the help for that command, else print out the general table help. Just a little cleaner to drop the else).

bq. The above comment doesn't run right?

Nope, but thought it would be good to leave in there for future shell-hackers. This was a big step in my understanding of what is going on.

Thanks for feedback stack!
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Patch looks fine.  Needs --no-prefix so I can pass it via hadoopqa.  Needs a fat release note too.  Patch applied for me.  I was able to do basic new functionality operations.  I'd say its good to go.

I installed the patch, when I do general 'help', I see nothing on this new facility.  I probably should?

When I create a table, the output is kinda ugly?  I suppose no way around it.... its not end of world.  Then when I do t.help it dumps out the help unformatted as in:

{code}
hbase(main):003:0* t = create 't', 'f'
0 row(s) in 0.2220 seconds

=> #<Hbase::Table:0x3067e236 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x6d386751>, @name="t", @shell=#<Shell::Shell:0x159576c3 @formatter=#<Shell::Formatter::Console:0x7a80747 @out=Kernel, @row_count=0, @max_width=364>, @hbase_admin=#<Hbase::Admin:0x2875ca3e @zk_wrapper=#<#<Class:0x4d30c132>:0x300b6421>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x609e7d46>, @formatter=#<Shell::Formatter::Console:0x7a80747 @out=Kernel, @row_count=0, @max_width=364>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x14235085>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x788ebb5a>>, @hbase=#<Hbase::Hbase:0x21e8614a @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x14235085>>>>
hbase(main):004:0> t.help
=> "       Access an HTable. The table is accessed based on the name of the table\n       and the current default configuration (hbase-site.xml and hbase-default.xml).\n\n       There are a variety of things you can do with a table. For instance, say\n       you have a table 't':\n\n         hbase> t.scan\n\n       Will get you all the rows in t.\n\n       Similarly, to put a row into table t, assuming it was created with\n       the column family 'fam':\n\n         hbase> t.put 'row', 'fam', 'value'\n\n       Other commands include things like: get, delete, deleteall,\n         get_all_columns, get_counter, count, incr. These functions, along with\n         the standard JRuby object methods are also available via tab completion.\n\n       For more information on how to use each of these commands, you can also just\n       type:\n\n         hbase> t.help 'scan'\n\n       which will output more information on how to use that command.\n\n       You can also do general admin actions directly on a table; things like enable, disable,\n       flush and drop just by typing:\n\n         hbase> t.enable\n         hbase> t.flush\n         hbase> t.disable\n         hbase> t.drop\n\n      Note that after dropping a table, your reference to it becomes useless and further usage\n      is undefined (and not recommended).\n\n      General help on this commands can also be obtained similarly to other table-centric commands.\n"
{code}

Does that happen for you?

If I do t.put, w/ wrong args it gives me the help but its general help rather than help for my table context:

{code}
hbase(main):006:0> t.put 'x', 'x:x', 'x'

ERROR: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 action: DoNotRetryIOException: 1 time, servers with issues: pynchon:57156, 

Here is some help for this command:
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates.  To put a cell value into table 't1' at
row 'r1' under column 'c1' marked with the time 'ts1', do:

  hbase> put 't1', 'r1', 'c1', 'value', ts1
{code}

This stuff works though:

{code}
hbase(main):019:0> put 't', 'x', 'f:x', 'x'
0 row(s) in 0.0330 seconds

hbase(main):020:0> t.put 'y', 'f:x', 'x'
0 row(s) in 0.0450 seconds
hbase(main):021:0> t.scan
ROW                                                                                          COLUMN+CELL                                                                                                                                                                                                                                                                    
 x                                                                                           column=f:x, timestamp=1333431415571, value=x                                                                                                                                                                                                                                   
 y                                                                                           column=f:x, timestamp=1333431427136, value=x   
{code}
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

You pass in the shell instance now instead of formatter when we create a table instance.  Do we get the formatter to use from the shell?

For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for.  Is this right?  Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method?

{code}
+        # here where is the IRB namespace
+        # this method just adds the call to the specified command
{code}

The above comment doesn't run right?

Otherwise, patch looks good (I think -- smile).  Let me try it.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hadoop QA commented on HBASE-5548:
----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12525162/ruby_HBASE-5548-addendum.patch
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 12 new or modified tests.

    +1 hadoop23.  The patch compiles against the hadoop 0.23.x profile.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 2 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed unit tests in .

Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//console

This message is automatically generated.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Fix Version/s:     (was: 0.94.0)
                   0.94.1
    
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK-security #188 (See [https://builds.apache.org/job/HBase-TRUNK-security/188/])
    HBASE-5548 Add ability to get a table in the shell (Revision 1332419)

     Result = FAILURE
stack : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
* /hbase/trunk/src/main/ruby/hbase/hbase.rb
* /hbase/trunk/src/main/ruby/hbase/table.rb
* /hbase/trunk/src/main/ruby/shell.rb
* /hbase/trunk/src/main/ruby/shell/commands.rb
* /hbase/trunk/src/main/ruby/shell/commands/count.rb
* /hbase/trunk/src/main/ruby/shell/commands/create.rb
* /hbase/trunk/src/main/ruby/shell/commands/delete.rb
* /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
* /hbase/trunk/src/main/ruby/shell/commands/get.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_table.rb
* /hbase/trunk/src/main/ruby/shell/commands/incr.rb
* /hbase/trunk/src/main/ruby/shell/commands/put.rb
* /hbase/trunk/src/main/ruby/shell/commands/scan.rb
* /hbase/trunk/src/main/ruby/shell/commands/table_help.rb
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
* /hbase/trunk/src/test/ruby/hbase/admin_test.rb

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-addendum.patch

fixes for tests and slight bugs. Passes on locally on OSX.

Should be good for testing (and submit?).
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Looks good.

Does stuff work as it used to after this patch goes in?  Can you do the old dumb:

get 'tablename', 'yadda', 'yadda'....

still?

On get_table, should it just be table?  'status' dumps out status, 'version', dumps out 'version'.  Maybe it should stay get_table, because it returns something you can catch into a variable?

Oh, this is nice:

{code}
+  hbase> t1 = create 't1', 'f1'
{code}

How do i add a filter? Is it the same old: t.scan, {STARTROW => 'xyz'} or something?

Patch is looking good I think.  Introduces a nice bit of functionality...
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (HBASE-5548) Add ability to get a table in the shell

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

stack resolved HBASE-5548.
--------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 0.94.1)
     Hadoop Flags: Reviewed

Committed to trunk after poking around with it for a while. It looks good. Thanks for the patch Jesse.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "ramkrishna.s.vasudevan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266699#comment-13266699 ] 

ramkrishna.s.vasudevan commented on HBASE-5548:
-----------------------------------------------

@Stack
I think you committed HBASE-5840 also along with this!!!
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

stack commented on HBASE-5548:
------------------------------

Hmm... did I?   It doesn't list the files above.  Let me check.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Zhihong Yu commented on HBASE-5548:
-----------------------------------

@Jesse:
I checked the two outstanding Hadoop QA jobs around 23:27 - they were not for this JIRA.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Fix Version/s: 0.94.0
    
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.94.0, 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

Posted by "Jesse Yates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246612#comment-13246612 ] 

Jesse Yates commented on HBASE-5548:
------------------------------------

bq. I installed the patch, when I do general 'help', I see nothing on this new facility. I probably should?

Yeah, probably :) I'll add some comments in a follow on patch.

bq. When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world.

You can by appending a ';' to the end of the line. But then you don't know if the operation is successful or not, as it suppresses all output. I tried a bunch of tricks to not show all that stuff, but nothing seemed to work. We can add a comment to the above effect in the guide.

bq. If I do t.put, w/ wrong args it gives me the help but its general help rather than help for my table context

Yeah, that is the general put help. I'm thinking it might be nice to add in some help specific to a table command more dynamically. I'll look into it.

thanks for the review stack! I'll get up a new patch and also throw it on RB (with associated release note) so others can take a look-see before rolling in the patch.
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK #2828 (See [https://builds.apache.org/job/HBase-TRUNK/2828/])
    HBASE-5548 Add ability to get a table in the shell (Revision 1332419)

     Result = FAILURE
stack : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
* /hbase/trunk/src/main/ruby/hbase/hbase.rb
* /hbase/trunk/src/main/ruby/hbase/table.rb
* /hbase/trunk/src/main/ruby/shell.rb
* /hbase/trunk/src/main/ruby/shell/commands.rb
* /hbase/trunk/src/main/ruby/shell/commands/count.rb
* /hbase/trunk/src/main/ruby/shell/commands/create.rb
* /hbase/trunk/src/main/ruby/shell/commands/delete.rb
* /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
* /hbase/trunk/src/main/ruby/shell/commands/get.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
* /hbase/trunk/src/main/ruby/shell/commands/get_table.rb
* /hbase/trunk/src/main/ruby/shell/commands/incr.rb
* /hbase/trunk/src/main/ruby/shell/commands/put.rb
* /hbase/trunk/src/main/ruby/shell/commands/scan.rb
* /hbase/trunk/src/main/ruby/shell/commands/table_help.rb
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
* /hbase/trunk/src/test/ruby/hbase/admin_test.rb

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

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

Hudson commented on HBASE-5548:
-------------------------------

Integrated in HBase-TRUNK #2837 (See [https://builds.apache.org/job/HBase-TRUNK/2837/])
    HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123)

     Result = SUCCESS
stack : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-addendum.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch, ruby_HBASE-5548-v5.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates reassigned HBASE-5548:
----------------------------------

    Assignee: Jesse Yates
    
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5548) Add ability to get a table in the shell

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

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-v1.patch

Attaching patch...
1) Fixed stack's comments
2) Added features:
 - create now returns the table that was created
 - scan now dynamically adds a scan method to htable

The latter makes sure that the table will output a scan 'nicely', and could be a decent paradigm for adding methods to the Table class (though probably some cleanup needs to be done as far as aliasing methods etc.). Thoughts on this new style?

Also, here is the output from some usage:
{code}
1.9.2-p290 :006 > t = create 't', 'f'
0 row(s) in 1.0470 seconds

 => #<Hbase::Table:0x55187eb3 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x92524b0>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 
1.9.2-p290 :007 > t.put 'r', 'f', 'v'
1.9.2-p290 :008 > t1 = get_table 't'
0 row(s) in 0.0240 seconds

 => #<Hbase::Table:0x7194f467 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x6a39d072>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 
1.9.2-p290 :009 > t.put 'r2', 'f', 'v'
1.9.2-p290 :010 > t.scan
ROW                   COLUMN+CELL                                               
 r                    column=f:, timestamp=1331521351836, value=v               
 r2                   column=f:, timestamp=1331521368969, value=v               
2 row(s) in 0.0870 seconds
{code}

                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira