From 63c68273767caa73fe3a39dc89b37a193b9ee367 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 10 Nov 2010 22:06:40 +0000 Subject: [PATCH] HBASE-3218 Shell help cleanup/cosmetics/edit git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1033754 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../RetriesExhaustedWithDetailsException.java | 1 + src/main/ruby/shell.rb | 39 +++++++++-------- src/main/ruby/shell/commands/add_peer.rb | 16 +++---- src/main/ruby/shell/commands/alter.rb | 42 ++++++++++-------- src/main/ruby/shell/commands/close_region.rb | 11 ++--- src/main/ruby/shell/commands/compact.rb | 6 +-- src/main/ruby/shell/commands/count.rb | 24 +++++------ src/main/ruby/shell/commands/create.rb | 21 +++++---- src/main/ruby/shell/commands/delete.rb | 14 +++--- src/main/ruby/shell/commands/deleteall.rb | 12 +++--- src/main/ruby/shell/commands/describe.rb | 6 +-- src/main/ruby/shell/commands/disable.rb | 4 +- src/main/ruby/shell/commands/disable_peer.rb | 12 +++--- .../ruby/shell/commands/disable_region.rb | 6 +-- src/main/ruby/shell/commands/drop.rb | 8 ++-- src/main/ruby/shell/commands/enable.rb | 4 +- src/main/ruby/shell/commands/enable_peer.rb | 12 +++--- src/main/ruby/shell/commands/enable_region.rb | 6 +-- src/main/ruby/shell/commands/exists.rb | 4 +- src/main/ruby/shell/commands/flush.rb | 10 ++--- src/main/ruby/shell/commands/get.rb | 22 +++++----- src/main/ruby/shell/commands/get_counter.rb | 10 ++--- src/main/ruby/shell/commands/incr.rb | 14 +++--- src/main/ruby/shell/commands/is_disabled.rb | 43 +------------------ src/main/ruby/shell/commands/is_enabled.rb | 43 +------------------ src/main/ruby/shell/commands/list.rb | 10 ++--- src/main/ruby/shell/commands/major_compact.rb | 6 +-- src/main/ruby/shell/commands/put.rb | 10 ++--- src/main/ruby/shell/commands/remove_peer.rb | 9 ++-- src/main/ruby/shell/commands/scan.rb | 28 ++++++------ src/main/ruby/shell/commands/shutdown.rb | 4 +- src/main/ruby/shell/commands/split.rb | 4 +- .../ruby/shell/commands/start_replication.rb | 14 +++--- src/main/ruby/shell/commands/status.rb | 14 +++--- .../ruby/shell/commands/stop_replication.rb | 14 +++--- src/main/ruby/shell/commands/truncate.rb | 4 +- src/main/ruby/shell/commands/version.rb | 6 +-- src/main/ruby/shell/commands/zk.rb | 6 +-- src/main/ruby/shell/commands/zk_dump.rb | 4 +- 40 files changed, 227 insertions(+), 297 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0f318046354..ccf0cda3b97 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1144,6 +1144,7 @@ Release 0.90.0 - Unreleased HBASE-3090 Don't include hbase-default in conf/ assembly HBASE-3161 Provide option for Stargate to only serve GET requests (Bennett Neale via Stack) + HBASE-3218 Shell help cleanup/cosmetics/edit NEW FEATURES diff --git a/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.java b/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.java index e3f13935ace..6c6202424e2 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.java +++ b/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.java @@ -114,6 +114,7 @@ public class RetriesExhaustedWithDetailsException extends RetriesExhaustedExcept public static Map classifyExs(List ths) { Map cls = new HashMap(); for (Throwable t : ths) { + if (t == null) continue; String name = t.getClass().getSimpleName(); Integer i = cls.get(name); if (i == null) { diff --git a/src/main/ruby/shell.rb b/src/main/ruby/shell.rb index 839d411167b..3c942ed32b4 100644 --- a/src/main/ruby/shell.rb +++ b/src/main/ruby/shell.rb @@ -109,22 +109,26 @@ module Shell def print_banner puts "HBase Shell; enter 'help' for list of supported commands." puts 'Type "exit" to leave the HBase Shell' + print 'Version ' command('version') puts end - def help_command(command) - puts "COMMAND: #{command}" + def help_multi_command(command) + puts "Command: #{command}" puts command_instance(command).help puts return nil end + def help_command(command) + puts command_instance(command).help + return nil + end + def help_group(group_name) group = ::Shell.command_groups[group_name.to_s] - puts group[:full_name] - puts '-' * 80 - group[:commands].sort.each { |cmd| help_command(cmd) } + group[:commands].sort.each { |cmd| help_multi_command(cmd) } if group[:comment] puts '-' * 80 puts @@ -135,7 +139,6 @@ module Shell end def help(command = nil) - puts if command return help_command(command) if ::Shell.commands[command.to_s] return help_group(command) if ::Shell.command_groups[command.to_s] @@ -145,32 +148,30 @@ module Shell puts help_header puts - puts '-' * 80 - puts + puts 'COMMAND GROUPS:' ::Shell.command_groups.each do |name, group| - puts " " + group[:full_name] + ": " - puts " group name: " + name - puts " commands: " + group[:command_names].sort.join(', ') + puts " Group name: " + name + puts " Commands: " + group[:command_names].sort.join(', ') puts end - puts unless command - puts '-' * 80 - puts + puts 'SHELL USAGE:' help_footer - puts end return nil end def help_header - return "Enter, help 'COMMAND_GROUP', (e.g. help 'general') to get help on all commands in a group\n" + - "Enter, help 'COMMAND', (e.g. help 'get') to get help on a specific command" + return "HBase Shell, version #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " + + "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " + + "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" + "\n" + + "Type 'help \"COMMAND\"', (e.g. 'help \"get\"' -- the quotes are necessary) for help on a specific command.\n" + + "Commands are grouped. Type 'help \"COMMAND_GROUP\"', (e.g. 'help \"general\"') for help on a command group." end def help_footer puts <<-HERE -Quote all names in HBase shell such as table and column names. Commas delimit +Quote all names in HBase Shell such as table and column names. Commas delimit command parameters. Type after entering a command to run it. Dictionaries of configuration used in the creation and alteration of tables are Ruby Hashes. They look like this: @@ -190,7 +191,7 @@ double-quote'd hexadecimal representation. For example: hbase> put 't1', "test\\xef\\xff", 'f1:', "\\x01\\x33\\x40" The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added. -For more on the HBase Shell, see http://wiki.apache.org/hadoop/Hbase/Shell +For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html HERE end end diff --git a/src/main/ruby/shell/commands/add_peer.rb b/src/main/ruby/shell/commands/add_peer.rb index 8548aee8bcb..7669fb7c526 100644 --- a/src/main/ruby/shell/commands/add_peer.rb +++ b/src/main/ruby/shell/commands/add_peer.rb @@ -23,15 +23,15 @@ module Shell class AddPeer< Command def help return <<-EOF - Add a peer cluster to replicate to, the id must be a short and - the cluster key is composed like this: - hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent - This gives a full path for HBase to connect to another cluster. - Examples: +Add a peer cluster to replicate to, the id must be a short and +the cluster key is composed like this: +hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent +This gives a full path for HBase to connect to another cluster. +Examples: - hbase> add_peer '1', "server1.cie.com:2181:/hbase" - hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod" - EOF + hbase> add_peer '1', "server1.cie.com:2181:/hbase" + hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod" +EOF end def command(id, cluster_key) diff --git a/src/main/ruby/shell/commands/alter.rb b/src/main/ruby/shell/commands/alter.rb index f736409075b..1dd43ada4b7 100644 --- a/src/main/ruby/shell/commands/alter.rb +++ b/src/main/ruby/shell/commands/alter.rb @@ -23,29 +23,35 @@ module Shell class Alter < Command def help return <<-EOF - Alter column family schema; pass table name and a dictionary - specifying new column family schema. Dictionaries are described - on the main help command output. Dictionary must include name - of column family to alter. For example, +Alter column family schema; pass table name and a dictionary +specifying new column family schema. Dictionaries are described +on the main help command output. Dictionary must include name +of column family to alter. For example, - To change or add the 'f1' column family in table 't1' from defaults - to instead keep a maximum of 5 cell VERSIONS, do: - hbase> alter 't1', NAME => 'f1', VERSIONS => 5 +To change or add the 'f1' column family in table 't1' from defaults +to instead keep a maximum of 5 cell VERSIONS, do: - To delete the 'f1' column family in table 't1', do: - hbase> alter 't1', NAME => 'f1', METHOD => 'delete' - or a shorter version: - hbase> alter 't1', 'delete' => 'f1' + hbase> alter 't1', NAME => 'f1', VERSIONS => 5 - You can also change table-scope attributes like MAX_FILESIZE - MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH. +To delete the 'f1' column family in table 't1', do: - For example, to change the max size of a family to 128MB, do: - hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728' + hbase> alter 't1', NAME => 'f1', METHOD => 'delete' - There could be more than one alteration in one command: - hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'} - EOF +or a shorter version: + + hbase> alter 't1', 'delete' => 'f1' + +You can also change table-scope attributes like MAX_FILESIZE +MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH. + +For example, to change the max size of a family to 128MB, do: + + hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728' + +There could be more than one alteration in one command: + + hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'} +EOF end def command(table, *args) diff --git a/src/main/ruby/shell/commands/close_region.rb b/src/main/ruby/shell/commands/close_region.rb index 4866820b9cd..d70823957e7 100644 --- a/src/main/ruby/shell/commands/close_region.rb +++ b/src/main/ruby/shell/commands/close_region.rb @@ -23,11 +23,12 @@ module Shell class CloseRegion < Command def help return <<-EOF - Close a single region. Optionally specify regionserver. - Examples: - hbase> close_region 'REGIONNAME' - hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT' - EOF +Close a single region. Optionally specify regionserver. +Examples: + + hbase> close_region 'REGIONNAME' + hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT' +EOF end def command(region_name, server = nil) diff --git a/src/main/ruby/shell/commands/compact.rb b/src/main/ruby/shell/commands/compact.rb index 743e26ead01..d8f71de4904 100644 --- a/src/main/ruby/shell/commands/compact.rb +++ b/src/main/ruby/shell/commands/compact.rb @@ -23,9 +23,9 @@ module Shell class Compact < Command def help return <<-EOF - Compact all regions in passed table or pass a region row - to compact an individual region - EOF +Compact all regions in passed table or pass a region row +to compact an individual region +EOF end def command(table_or_region_name) diff --git a/src/main/ruby/shell/commands/count.rb b/src/main/ruby/shell/commands/count.rb index 06de3b5eeed..6596441c1c3 100644 --- a/src/main/ruby/shell/commands/count.rb +++ b/src/main/ruby/shell/commands/count.rb @@ -23,19 +23,19 @@ module Shell class Count < Command def help return <<-EOF - Count the number of rows in a table. This operation may take a LONG - time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a - counting mapreduce job). Current count is shown every 1000 rows by - default. Count interval may be optionally specified. Scan caching - is enabled on count scans by default. Default cache size is 10 rows. - If your rows are small in size, you may want to increase this - parameter. Examples: +Count the number of rows in a table. This operation may take a LONG +time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a +counting mapreduce job). Current count is shown every 1000 rows by +default. Count interval may be optionally specified. Scan caching +is enabled on count scans by default. Default cache size is 10 rows. +If your rows are small in size, you may want to increase this +parameter. Examples: - hbase> count 't1' - hbase> count 't1', INTERVAL => 100000 - hbase> count 't1', CACHE => 1000 - hbase> count 't1', INTERVAL => 10, CACHE => 1000 - EOF + hbase> count 't1' + hbase> count 't1', INTERVAL => 100000 + hbase> count 't1', CACHE => 1000 + hbase> count 't1', INTERVAL => 10, CACHE => 1000 +EOF end def command(table, params = {}) diff --git a/src/main/ruby/shell/commands/create.rb b/src/main/ruby/shell/commands/create.rb index 576e8cac726..cfe5d3f9dc0 100644 --- a/src/main/ruby/shell/commands/create.rb +++ b/src/main/ruby/shell/commands/create.rb @@ -23,18 +23,17 @@ module Shell class Create < Command def help return <<-EOF - Create table; pass table name, a dictionary of specifications per - column family, and optionally a dictionary of table configuration. - Dictionaries are described below in the GENERAL NOTES section. - Examples: +Create table; pass table name, a dictionary of specifications per +column family, and optionally a dictionary of table configuration. +Dictionaries are described below in the GENERAL NOTES section. +Examples: - hbase> create 't1', {NAME => 'f1', VERSIONS => 5} - hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} - hbase> # The above in shorthand would be the following: - hbase> create 't1', 'f1', 'f2', 'f3' - hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, - BLOCKCACHE => true} - EOF + hbase> create 't1', {NAME => 'f1', VERSIONS => 5} + hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} + hbase> # The above in shorthand would be the following: + hbase> create 't1', 'f1', 'f2', 'f3' + hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true} +EOF end def command(table, *args) diff --git a/src/main/ruby/shell/commands/delete.rb b/src/main/ruby/shell/commands/delete.rb index daefeefe617..12bc4059335 100644 --- a/src/main/ruby/shell/commands/delete.rb +++ b/src/main/ruby/shell/commands/delete.rb @@ -23,14 +23,14 @@ module Shell class Delete < Command def help return <<-EOF - Put a delete cell value at specified table/row/column and optionally - timestamp coordinates. Deletes must match the deleted cell's - coordinates exactly. When scanning, a delete cell suppresses older - versions. To delete a cell from 't1' at row 'r1' under column 'c1' - marked with the time 'ts1', do: +Put a delete cell value at specified table/row/column and optionally +timestamp coordinates. Deletes must match the deleted cell's +coordinates exactly. When scanning, a delete cell suppresses older +versions. To delete a cell from 't1' at row 'r1' under column 'c1' +marked with the time 'ts1', do: - hbase> delete 't1', 'r1', 'c1', ts1 - EOF + hbase> delete 't1', 'r1', 'c1', ts1 +EOF end def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) diff --git a/src/main/ruby/shell/commands/deleteall.rb b/src/main/ruby/shell/commands/deleteall.rb index 5ba549e206b..5731b606b41 100644 --- a/src/main/ruby/shell/commands/deleteall.rb +++ b/src/main/ruby/shell/commands/deleteall.rb @@ -23,13 +23,13 @@ module Shell class Deleteall < Command def help return <<-EOF - Delete all cells in a given row; pass a table name, row, and optionally - a column and timestamp. Examples: +Delete all cells in a given row; pass a table name, row, and optionally +a column and timestamp. Examples: - hbase> deleteall 't1', 'r1' - hbase> deleteall 't1', 'r1', 'c1' - hbase> deleteall 't1', 'r1', 'c1', ts1 - EOF + hbase> deleteall 't1', 'r1' + hbase> deleteall 't1', 'r1', 'c1' + hbase> deleteall 't1', 'r1', 'c1', ts1 +EOF end def command(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) diff --git a/src/main/ruby/shell/commands/describe.rb b/src/main/ruby/shell/commands/describe.rb index fe0579599f0..0f355074cda 100644 --- a/src/main/ruby/shell/commands/describe.rb +++ b/src/main/ruby/shell/commands/describe.rb @@ -23,9 +23,9 @@ module Shell class Describe < Command def help return <<-EOF - Describe the named table. For example: - hbase> describe 't1' - EOF +Describe the named table. For example: + hbase> describe 't1' +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/disable.rb b/src/main/ruby/shell/commands/disable.rb index d5428316e43..34c5f9ca7d0 100644 --- a/src/main/ruby/shell/commands/disable.rb +++ b/src/main/ruby/shell/commands/disable.rb @@ -23,8 +23,8 @@ module Shell class Disable < Command def help return <<-EOF - Start disable of named table: e.g. "hbase> disable 't1'" - EOF +Start disable of named table: e.g. "hbase> disable 't1'" +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/disable_peer.rb b/src/main/ruby/shell/commands/disable_peer.rb index 5480655e02e..ad1ebbd4c7d 100644 --- a/src/main/ruby/shell/commands/disable_peer.rb +++ b/src/main/ruby/shell/commands/disable_peer.rb @@ -23,15 +23,15 @@ module Shell class DisablePeer< Command def help return <<-EOF - Stops the replication stream to the specified cluster, but still - keeps track of new edits to replicate. +Stops the replication stream to the specified cluster, but still +keeps track of new edits to replicate. - CURRENTLY UNSUPPORTED +CURRENTLY UNSUPPORTED - Examples: +Examples: - hbase> disable_peer '1' - EOF + hbase> disable_peer '1' +EOF end def command(id) diff --git a/src/main/ruby/shell/commands/disable_region.rb b/src/main/ruby/shell/commands/disable_region.rb index 4f2c9b2b5eb..a5ccf76d34c 100644 --- a/src/main/ruby/shell/commands/disable_region.rb +++ b/src/main/ruby/shell/commands/disable_region.rb @@ -23,10 +23,10 @@ module Shell class DisableRegion < Command def help return <<-EOF - Disable a single region. For example: +Disable a single region. For example: - hbase> disable_region 'REGIONNAME' - EOF + hbase> disable_region 'REGIONNAME' +EOF end def command(region_name) diff --git a/src/main/ruby/shell/commands/drop.rb b/src/main/ruby/shell/commands/drop.rb index eb82d65687a..181b83500f6 100644 --- a/src/main/ruby/shell/commands/drop.rb +++ b/src/main/ruby/shell/commands/drop.rb @@ -23,11 +23,11 @@ module Shell class Drop < Command def help return <<-EOF - Drop the named table. Table must first be disabled. If table has - more than one region, run a major compaction on .META.: +Drop the named table. Table must first be disabled. If table has +more than one region, run a major compaction on .META.: - hbase> major_compact ".META." - EOF + hbase> major_compact ".META." +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/enable.rb b/src/main/ruby/shell/commands/enable.rb index 16d647c8b37..a0dc340f5dd 100644 --- a/src/main/ruby/shell/commands/enable.rb +++ b/src/main/ruby/shell/commands/enable.rb @@ -23,8 +23,8 @@ module Shell class Enable < Command def help return <<-EOF - Start enable of named table: e.g. "hbase> enable 't1'" - EOF +Start enable of named table: e.g. "hbase> enable 't1'" +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/enable_peer.rb b/src/main/ruby/shell/commands/enable_peer.rb index 5a658672a22..099f3fd4549 100644 --- a/src/main/ruby/shell/commands/enable_peer.rb +++ b/src/main/ruby/shell/commands/enable_peer.rb @@ -23,15 +23,15 @@ module Shell class EnablePeer< Command def help return <<-EOF - Restarts the replication to the specified peer cluster, - continuing from where it was disabled. +Restarts the replication to the specified peer cluster, +continuing from where it was disabled. - CURRENTLY UNSUPPORTED +CURRENTLY UNSUPPORTED - Examples: +Examples: - hbase> enable_peer '1' - EOF + hbase> enable_peer '1' +EOF end def command(id) diff --git a/src/main/ruby/shell/commands/enable_region.rb b/src/main/ruby/shell/commands/enable_region.rb index d8b0f8bc7ff..a58f7fcfc82 100644 --- a/src/main/ruby/shell/commands/enable_region.rb +++ b/src/main/ruby/shell/commands/enable_region.rb @@ -23,10 +23,10 @@ module Shell class EnableRegion < Command def help return <<-EOF - Enable a single region. For example: +Enable a single region. For example: - hbase> enable_region 'REGIONNAME' - EOF + hbase> enable_region 'REGIONNAME' +EOF end def command(region_name) diff --git a/src/main/ruby/shell/commands/exists.rb b/src/main/ruby/shell/commands/exists.rb index 93eb0337689..f35f197238f 100644 --- a/src/main/ruby/shell/commands/exists.rb +++ b/src/main/ruby/shell/commands/exists.rb @@ -23,8 +23,8 @@ module Shell class Exists < Command def help return <<-EOF - Does the named table exist? e.g. "hbase> exists 't1'" - EOF +Does the named table exist? e.g. "hbase> exists 't1'" +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/flush.rb b/src/main/ruby/shell/commands/flush.rb index 1f0047a4bfc..ba597662c52 100644 --- a/src/main/ruby/shell/commands/flush.rb +++ b/src/main/ruby/shell/commands/flush.rb @@ -23,12 +23,12 @@ module Shell class Flush < Command def help return <<-EOF - Flush all regions in passed table or pass a region row to - flush an individual region. For example: +Flush all regions in passed table or pass a region row to +flush an individual region. For example: - hbase> flush 'TABLENAME' - hbase> flush 'REGIONNAME' - EOF + hbase> flush 'TABLENAME' + hbase> flush 'REGIONNAME' +EOF end def command(table_or_region_name) diff --git a/src/main/ruby/shell/commands/get.rb b/src/main/ruby/shell/commands/get.rb index 39083a73683..f42062c1f8c 100644 --- a/src/main/ruby/shell/commands/get.rb +++ b/src/main/ruby/shell/commands/get.rb @@ -23,18 +23,18 @@ module Shell class Get < Command def help return <<-EOF - Get row or cell contents; pass table name, row, and optionally - a dictionary of column(s), timestamp and versions. Examples: +Get row or cell contents; pass table name, row, and optionally +a dictionary of column(s), timestamp and versions. Examples: - hbase> get 't1', 'r1' - 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', TIMESTAMP => ts1, VERSIONS => 4} - hbase> get 't1', 'r1', 'c1' - hbase> get 't1', 'r1', 'c1', 'c2' - hbase> get 't1', 'r1', ['c1', 'c2'] - EOF + hbase> get 't1', 'r1' + 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', TIMESTAMP => ts1, VERSIONS => 4} + hbase> get 't1', 'r1', 'c1' + hbase> get 't1', 'r1', 'c1', 'c2' + hbase> get 't1', 'r1', ['c1', 'c2'] +EOF end def command(table, row, *args) diff --git a/src/main/ruby/shell/commands/get_counter.rb b/src/main/ruby/shell/commands/get_counter.rb index eadf58f8230..3cbe2268d9a 100644 --- a/src/main/ruby/shell/commands/get_counter.rb +++ b/src/main/ruby/shell/commands/get_counter.rb @@ -23,12 +23,12 @@ module Shell class GetCounter < Command def help return <<-EOF - Return a counter cell value at specified table/row/column coordinates. - A cell cell should be managed with atomic increment function oh HBase - and the data should be binary encoded. Example: +Return a counter cell value at specified table/row/column coordinates. +A cell cell should be managed with atomic increment function oh HBase +and the data should be binary encoded. Example: - hbase> get_counter 't1', 'r1', 'c1' - EOF + hbase> get_counter 't1', 'r1', 'c1' +EOF end def command(table, row, column, value = nil) diff --git a/src/main/ruby/shell/commands/incr.rb b/src/main/ruby/shell/commands/incr.rb index be1316c008f..38a2fc51793 100644 --- a/src/main/ruby/shell/commands/incr.rb +++ b/src/main/ruby/shell/commands/incr.rb @@ -23,14 +23,14 @@ module Shell class Incr < Command def help return <<-EOF - Increments a cell 'value' at specified table/row/column coordinates. - To increment a cell value in table 't1' at row 'r1' under column - 'c1' by 1 (can be omitted) or 10 do: +Increments a cell 'value' at specified table/row/column coordinates. +To increment a cell value in table 't1' at row 'r1' under column +'c1' by 1 (can be omitted) or 10 do: - hbase> incr 't1', 'r1', 'c1' - hbase> incr 't1', 'r1', 'c1', 1 - hbase> incr 't1', 'r1', 'c1', 10 - EOF + hbase> incr 't1', 'r1', 'c1' + hbase> incr 't1', 'r1', 'c1', 1 + hbase> incr 't1', 'r1', 'c1', 10 +EOF end def command(table, row, column, value = nil) diff --git a/src/main/ruby/shell/commands/is_disabled.rb b/src/main/ruby/shell/commands/is_disabled.rb index 486198fb737..9d3c7ee7471 100644 --- a/src/main/ruby/shell/commands/is_disabled.rb +++ b/src/main/ruby/shell/commands/is_disabled.rb @@ -23,8 +23,8 @@ module Shell class IsDisabled < Command def help return <<-EOF - Is named table disabled?: e.g. "hbase> is_disabled 't1'" - EOF +Is named table disabled?: e.g. "hbase> is_disabled 't1'" +EOF end def command(table) @@ -37,42 +37,3 @@ module Shell end end end -# -# Copyright 2010 The Apache Software Foundation -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -module Shell - module Commands - class IsDisabled < Command - def help - return <<-EOF - Is table disabled: e.g. "hbase> is_disabled 't1'" - EOF - end - - def command(table) - format_simple_command do - formatter.row([ - admin.disabled?(table) ? "true" : "false" - ]) - end - end - end - end -end diff --git a/src/main/ruby/shell/commands/is_enabled.rb b/src/main/ruby/shell/commands/is_enabled.rb index b5b7293b559..96b2b152c2e 100644 --- a/src/main/ruby/shell/commands/is_enabled.rb +++ b/src/main/ruby/shell/commands/is_enabled.rb @@ -23,8 +23,8 @@ module Shell class IsEnabled < Command def help return <<-EOF - Is named table enabled?: e.g. "hbase> is_enabled 't1'" - EOF +Is named table enabled?: e.g. "hbase> is_enabled 't1'" +EOF end def command(table) @@ -37,42 +37,3 @@ module Shell end end end -# -# Copyright 2010 The Apache Software Foundation -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -module Shell - module Commands - class IsEnabled < Command - def help - return <<-EOF - Is table enabled: e.g. "hbase> enable 't1'" - EOF - end - - def command(table) - format_simple_command do - formatter.row([ - admin.enabled?(table) ? "true" : "false" - ]) - end - end - end - end -end diff --git a/src/main/ruby/shell/commands/list.rb b/src/main/ruby/shell/commands/list.rb index 5624be27e63..e0a9f852b96 100644 --- a/src/main/ruby/shell/commands/list.rb +++ b/src/main/ruby/shell/commands/list.rb @@ -23,12 +23,12 @@ module Shell class List < Command def help return <<-EOF - List all tables in hbase. Optional regular expression parameter could - be used to filter the output. Examples: +List all tables in hbase. Optional regular expression parameter could +be used to filter the output. Examples: - hbase> list - hbase> list 'abc.*' - EOF + hbase> list + hbase> list 'abc.*' +EOF end def command(regex = ".*") diff --git a/src/main/ruby/shell/commands/major_compact.rb b/src/main/ruby/shell/commands/major_compact.rb index 45c9b0868ea..56b081e3f96 100644 --- a/src/main/ruby/shell/commands/major_compact.rb +++ b/src/main/ruby/shell/commands/major_compact.rb @@ -23,9 +23,9 @@ module Shell class MajorCompact < Command def help return <<-EOF - Run major compaction on passed table or pass a region row - to major compact an individual region - EOF +Run major compaction on passed table or pass a region row +to major compact an individual region +EOF end def command(table_or_region_name) diff --git a/src/main/ruby/shell/commands/put.rb b/src/main/ruby/shell/commands/put.rb index d81c403ba60..dde04337083 100644 --- a/src/main/ruby/shell/commands/put.rb +++ b/src/main/ruby/shell/commands/put.rb @@ -23,12 +23,12 @@ module Shell class Put < Command def help return <<-EOF - 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: +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 - EOF + hbase> put 't1', 'r1', 'c1', 'value', ts1 +EOF end def command(table, row, column, value, timestamp = nil) diff --git a/src/main/ruby/shell/commands/remove_peer.rb b/src/main/ruby/shell/commands/remove_peer.rb index 6730a55e8cd..034434aa5da 100644 --- a/src/main/ruby/shell/commands/remove_peer.rb +++ b/src/main/ruby/shell/commands/remove_peer.rb @@ -23,12 +23,11 @@ module Shell class RemovePeer< Command def help return <<-EOF - Stops the specified replication stream and deletes all the meta - information kept about it. - Examples: +Stops the specified replication stream and deletes all the meta +information kept about it. Examples: - hbase> remove_peer '1' - EOF + hbase> remove_peer '1' +EOF end def command(id) diff --git a/src/main/ruby/shell/commands/scan.rb b/src/main/ruby/shell/commands/scan.rb index 3a22149b4f3..4d722afa748 100644 --- a/src/main/ruby/shell/commands/scan.rb +++ b/src/main/ruby/shell/commands/scan.rb @@ -23,23 +23,23 @@ module Shell class Scan < Command def help return <<-EOF - Scan a table; pass table name and optionally a dictionary of scanner - specifications. Scanner specifications may include one or more of - the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, 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:'. Examples: +Scan a table; pass table name and optionally a dictionary of scanner +specifications. Scanner specifications may include one or more of +the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, 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:'. Examples: - hbase> scan '.META.' - hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} - hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'} + hbase> scan '.META.' + hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} + hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'} - 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: +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} - EOF + hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} +EOF end def command(table, args = {}) diff --git a/src/main/ruby/shell/commands/shutdown.rb b/src/main/ruby/shell/commands/shutdown.rb index a0e53ba9624..ebe74ddc3bb 100644 --- a/src/main/ruby/shell/commands/shutdown.rb +++ b/src/main/ruby/shell/commands/shutdown.rb @@ -23,8 +23,8 @@ module Shell class Shutdown < Command def help return <<-EOF - Shut down the cluster. - EOF +Shut down the cluster. +EOF end def command diff --git a/src/main/ruby/shell/commands/split.rb b/src/main/ruby/shell/commands/split.rb index 2d3c9522048..c4de87535d3 100644 --- a/src/main/ruby/shell/commands/split.rb +++ b/src/main/ruby/shell/commands/split.rb @@ -23,8 +23,8 @@ module Shell class Split < Command def help return <<-EOF - Split table or pass a region row to split individual region - EOF +Split table or pass a region row to split individual region +EOF end def command(table_or_region_name) diff --git a/src/main/ruby/shell/commands/start_replication.rb b/src/main/ruby/shell/commands/start_replication.rb index b2f55bc43d9..5d1cd1b5ee1 100644 --- a/src/main/ruby/shell/commands/start_replication.rb +++ b/src/main/ruby/shell/commands/start_replication.rb @@ -23,14 +23,14 @@ module Shell class StartReplication < Command def help return <<-EOF - Restarts all the replication features. The state in which each - stream starts in is undetermined. - WARNING: - start/stop replication is only meant to be used in critical load situations. - Examples: +Restarts all the replication features. The state in which each +stream starts in is undetermined. +WARNING: +start/stop replication is only meant to be used in critical load situations. +Examples: - hbase> start_replication - EOF + hbase> start_replication +EOF end def command diff --git a/src/main/ruby/shell/commands/status.rb b/src/main/ruby/shell/commands/status.rb index fdead8aa532..4b22acb4abf 100644 --- a/src/main/ruby/shell/commands/status.rb +++ b/src/main/ruby/shell/commands/status.rb @@ -23,14 +23,14 @@ module Shell class Status < Command def help return <<-EOF - Show cluster status. Can be 'summary', 'simple', or 'detailed'. The - default is 'summary'. Examples: +Show cluster status. Can be 'summary', 'simple', or 'detailed'. The +default is 'summary'. Examples: - hbase> status - hbase> status 'simple' - hbase> status 'summary' - hbase> status 'detailed' - EOF + hbase> status + hbase> status 'simple' + hbase> status 'summary' + hbase> status 'detailed' +EOF end def command(format = 'summary') diff --git a/src/main/ruby/shell/commands/stop_replication.rb b/src/main/ruby/shell/commands/stop_replication.rb index 75696277776..f5074d73a87 100644 --- a/src/main/ruby/shell/commands/stop_replication.rb +++ b/src/main/ruby/shell/commands/stop_replication.rb @@ -23,14 +23,14 @@ module Shell class StopReplication < Command def help return <<-EOF - Stops all the replication features. The state in which each - stream stops in is undetermined. - WARNING: - start/stop replication is only meant to be used in critical load situations. - Examples: +Stops all the replication features. The state in which each +stream stops in is undetermined. +WARNING: +start/stop replication is only meant to be used in critical load situations. +Examples: - hbase> stop_replication - EOF + hbase> stop_replication +EOF end def command diff --git a/src/main/ruby/shell/commands/truncate.rb b/src/main/ruby/shell/commands/truncate.rb index 5cf2ca916ae..a24e167b982 100644 --- a/src/main/ruby/shell/commands/truncate.rb +++ b/src/main/ruby/shell/commands/truncate.rb @@ -23,8 +23,8 @@ module Shell class Truncate < Command def help return <<-EOF - Disables, drops and recreates the specified table. - EOF + Disables, drops and recreates the specified table. +EOF end def command(table) diff --git a/src/main/ruby/shell/commands/version.rb b/src/main/ruby/shell/commands/version.rb index 461735825c4..372b0dc341f 100644 --- a/src/main/ruby/shell/commands/version.rb +++ b/src/main/ruby/shell/commands/version.rb @@ -23,13 +23,13 @@ module Shell class Version < Command def help return <<-EOF - Output this HBase version - EOF +Output this HBase version +EOF end def command # Output version. - puts "Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " + + puts "#{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " + "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " + "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" end diff --git a/src/main/ruby/shell/commands/zk.rb b/src/main/ruby/shell/commands/zk.rb index a0ca1797b1e..fc8f084c4a6 100644 --- a/src/main/ruby/shell/commands/zk.rb +++ b/src/main/ruby/shell/commands/zk.rb @@ -23,9 +23,9 @@ module Shell class Zk < Command def help return <<-EOF - Low level ZooKeeper surgery tools. Type "zk 'help'" for more - information (Yes, you must quote 'help'). - EOF +Low level ZooKeeper surgery tools. Type "zk 'help'" for more +information (Yes, you must quote 'help'). +EOF end def command(*args) diff --git a/src/main/ruby/shell/commands/zk_dump.rb b/src/main/ruby/shell/commands/zk_dump.rb index bea49227f9e..bb23962df86 100644 --- a/src/main/ruby/shell/commands/zk_dump.rb +++ b/src/main/ruby/shell/commands/zk_dump.rb @@ -23,8 +23,8 @@ module Shell class ZkDump < Command def help return <<-EOF - Dump status of HBase cluster as seen by ZooKeeper. - EOF +Dump status of HBase cluster as seen by ZooKeeper. +EOF end def command