You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/06/30 17:23:21 UTC
[2/4] hbase git commit: HBASE-18239 rubocop autocorrect for shell
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
index 077bd69..edaa386 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
@@ -19,9 +19,9 @@
module Shell
module Commands
- class AddPeer< Command
+ class AddPeer < Command
def help
- return <<-EOF
+ <<-EOF
A peer can either be another HBase cluster or a custom replication endpoint. In either case an id
must be specified to identify the peer.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/add_rsgroup.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/add_rsgroup.rb b/hbase-shell/src/main/ruby/shell/commands/add_rsgroup.rb
index 9a97f69..ab32d05 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_rsgroup.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_rsgroup.rb
@@ -22,7 +22,7 @@ module Shell
module Commands
class AddRsgroup < Command
def help
- return <<-EOF
+ <<-EOF
Create a new RegionServer group.
Example:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/alter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/alter.rb b/hbase-shell/src/main/ruby/shell/commands/alter.rb
index 8d6b6ca..2207111 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Alter < Command
def help
- return <<-EOF
+ <<-EOF
Alter a table. Tables can be altered without disabling them first.
Altering enabled tables has caused problems
in the past, so use caution and test it before using in production.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/alter_async.rb b/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
index 05335fb..824de10 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class AlterAsync < Command
def help
- return <<-EOF
+ <<-EOF
Alter column family schema, does not wait for all regions to receive the
schema changes. Pass table name and a dictionary specifying new column
family schema. Dictionaries are described on the main help command output.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb b/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
index 0051c7f..602ac6f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class AlterNamespace < Command
def help
- return <<-EOF
+ <<-EOF
Alter namespace properties.
To add/modify a property:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/alter_status.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/alter_status.rb b/hbase-shell/src/main/ruby/shell/commands/alter_status.rb
index 72f044d..8284825 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_status.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_status.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class AlterStatus < Command
def help
- return <<-EOF
+ <<-EOF
Get the status of the alter command. Indicates the number of regions of the
table that have received the updated schema
Pass table name.
@@ -30,6 +30,7 @@ hbase> alter_status 't1'
hbase> alter_status 'ns1:t1'
EOF
end
+
def command(table)
admin.alter_status(table)
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/append.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/append.rb b/hbase-shell/src/main/ruby/shell/commands/append.rb
index c2fb9c1..a7273ca 100644
--- a/hbase-shell/src/main/ruby/shell/commands/append.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/append.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Append < Command
def help
- return <<-EOF
+ <<-EOF
Appends a cell 'value' at specified table/row/column coordinates.
hbase> append 't1', 'r1', 'c1', 'value', ATTRIBUTES=>{'mykey'=>'myvalue'}
@@ -35,13 +35,13 @@ t to table 't1', the corresponding command would be:
EOF
end
- def command(table_name, row, column, value, args={})
+ def command(table_name, row, column, value, args = {})
table = table(table_name)
@start_time = Time.now
append(table, row, column, value, args)
end
- def append(table, row, column, value, args={})
+ def append(table, row, column, value, args = {})
if current_value = table._append_internal(row, column, value, args)
puts "CURRENT VALUE = #{current_value}"
end
@@ -50,5 +50,5 @@ EOF
end
end
-#add incr comamnd to Table
-::Hbase::Table.add_shell_command("append")
+# add incr comamnd to Table
+::Hbase::Table.add_shell_command('append')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/append_peer_namespaces.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/append_peer_namespaces.rb b/hbase-shell/src/main/ruby/shell/commands/append_peer_namespaces.rb
index 2585754..f48cd46 100644
--- a/hbase-shell/src/main/ruby/shell/commands/append_peer_namespaces.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/append_peer_namespaces.rb
@@ -20,9 +20,9 @@
module Shell
module Commands
- class AppendPeerNamespaces< Command
+ class AppendPeerNamespaces < Command
def help
- return <<-EOF
+ <<-EOF
Append some namespaces to be replicable for the specified peer.
Set a namespace in the peer config means that all tables in this
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/append_peer_tableCFs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/append_peer_tableCFs.rb b/hbase-shell/src/main/ruby/shell/commands/append_peer_tableCFs.rb
index fe34c5c..0dbf2d7 100644
--- a/hbase-shell/src/main/ruby/shell/commands/append_peer_tableCFs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/append_peer_tableCFs.rb
@@ -19,9 +19,9 @@
module Shell
module Commands
- class AppendPeerTableCFs< Command
+ class AppendPeerTableCFs < Command
def help
- return <<-EOF
+ <<-EOF
Append a replicable table-cf config for the specified peer
Examples:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/assign.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/assign.rb b/hbase-shell/src/main/ruby/shell/commands/assign.rb
index 1220bf1..da4fc69 100644
--- a/hbase-shell/src/main/ruby/shell/commands/assign.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/assign.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Assign < Command
def help
- return <<-EOF
+ <<-EOF
Assign a region. Use with caution. If region already assigned,
this command will do a force reassign. For experts only.
Examples:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/balance_rsgroup.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balance_rsgroup.rb b/hbase-shell/src/main/ruby/shell/commands/balance_rsgroup.rb
index 5f7e561..a223e05 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balance_rsgroup.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balance_rsgroup.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class BalanceRsgroup < Command
def help
- return <<-EOF
+ <<-EOF
Balance a RegionServer group
Example:
@@ -33,7 +33,7 @@ EOF
# Returns true if balancer was run, otherwise false.
ret = rsgroup_admin.balance_rs_group(group_name)
if ret
- puts "Ran the balancer."
+ puts 'Ran the balancer.'
else
puts "Couldn't run the balancer."
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
index 4076cf6..332ac3b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class BalanceSwitch < Command
def help
- return <<-EOF
+ <<-EOF
Enable/Disable balancer. Returns previous balancer state.
Examples:
@@ -31,7 +31,7 @@ EOF
end
def command(enableDisable)
- prev_state = admin.balance_switch(enableDisable)? "true" : "false"
+ prev_state = admin.balance_switch(enableDisable) ? 'true' : 'false'
formatter.row(["Previous balancer state : #{prev_state}"])
prev_state
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/balancer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balancer.rb b/hbase-shell/src/main/ruby/shell/commands/balancer.rb
index a7490a5..276a0a6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer.rb
@@ -21,9 +21,9 @@ module Shell
module Commands
class Balancer < Command
def help
- return <<-EOF
+ <<-EOF
Trigger the cluster balancer. Returns true if balancer ran and was able to
-tell the region servers to unassign all the regions to balance (the re-assignment itself is async).
+tell the region servers to unassign all the regions to balance (the re-assignment itself is async).
Otherwise false (Will not run if regions in transition).
Parameter tells master whether we should force balance even if there is region in transition.
@@ -37,14 +37,14 @@ Examples:
EOF
end
- def command(force=nil)
+ def command(force = nil)
force_balancer = 'false'
if force == 'force'
force_balancer = 'true'
elsif !force.nil?
raise ArgumentError, "Invalid argument #{force}."
end
- formatter.row([admin.balancer(force_balancer)? "true": "false"])
+ formatter.row([admin.balancer(force_balancer) ? 'true' : 'false'])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
index c3d7a2b..a2884c4 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class BalancerEnabled < Command
def help
- return <<-EOF
+ <<-EOF
Query the balancer's state.
Examples:
@@ -29,7 +29,7 @@ Examples:
EOF
end
- def command()
+ def command
state = admin.balancer_enabled?
formatter.row([state.to_s])
state
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
index fdeb67e..22e26e9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class CatalogjanitorEnabled < Command
def help
- return <<-EOF
+ <<-EOF
Query for the CatalogJanitor state (enabled/disabled?)
Examples:
@@ -28,8 +28,8 @@ Examples:
EOF
end
- def command()
- formatter.row([admin.catalogjanitor_enabled()? "true" : "false"])
+ def command
+ formatter.row([admin.catalogjanitor_enabled ? 'true' : 'false'])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
index 638a18f..32f9f6a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
@@ -20,15 +20,16 @@ module Shell
module Commands
class CatalogjanitorRun < Command
def help
- return <<-EOF
+ <<-EOF
Catalog janitor command to run the (garbage collection) scan from command line.
hbase> catalogjanitor_run
EOF
end
- def command()
- admin.catalogjanitor_run()
+
+ def command
+ admin.catalogjanitor_run
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
index d2d8e58..48fedc3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class CatalogjanitorSwitch < Command
def help
- return <<-EOF
+ <<-EOF
Enable/Disable CatalogJanitor. Returns previous CatalogJanitor state.
Examples:
@@ -30,7 +30,7 @@ EOF
end
def command(enableDisable)
- formatter.row([admin.catalogjanitor_switch(enableDisable)? "true" : "false"])
+ formatter.row([admin.catalogjanitor_switch(enableDisable) ? 'true' : 'false'])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_enabled.rb
index 6ae4a24..9fad7a0 100644
--- a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_enabled.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class CleanerChoreEnabled < Command
def help
- return <<-EOF
+ <<-EOF
Query for the Cleaner chore state (enabled/disabled?).
Examples:
@@ -28,9 +28,9 @@ Examples:
EOF
end
- def command()
- formatter.row([admin.cleaner_chore_enabled()? "true" : "false"])
+ def command
+ formatter.row([admin.cleaner_chore_enabled ? 'true' : 'false'])
end
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_run.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_run.rb b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_run.rb
index 9ade9c9..210f388 100644
--- a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_run.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_run.rb
@@ -20,16 +20,17 @@ module Shell
module Commands
class CleanerChoreRun < Command
def help
- return <<-EOF
+ <<-EOF
Cleaner chore command for garbage collection of HFiles and WAL files.
hbase> cleaner_chore_run
EOF
end
- def command()
- admin.cleaner_chore_run()
+
+ def command
+ admin.cleaner_chore_run
end
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_switch.rb b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_switch.rb
index 20241ec..609978d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/cleaner_chore_switch.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class CleanerChoreSwitch < Command
def help
- return <<-EOF
+ <<-EOF
Enable/Disable Cleaner chore. Returns previous Cleaner chore state.
Examples:
@@ -30,8 +30,8 @@ EOF
end
def command(enableDisable)
- formatter.row([admin.cleaner_chore_switch(enableDisable)? "true" : "false"])
+ formatter.row([admin.cleaner_chore_switch(enableDisable) ? 'true' : 'false'])
end
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb b/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
index be56d5d..9cd0a2b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class ClearAuths < Command
def help
- return <<-EOF
+ <<-EOF
Clear visibility labels from a user or group
Syntax : clear_auths 'user',[label1, label2]
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/clear_compaction_queues.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/clear_compaction_queues.rb b/hbase-shell/src/main/ruby/shell/commands/clear_compaction_queues.rb
index 21668d3..7a5c374 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clear_compaction_queues.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clear_compaction_queues.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ClearCompactionQueues < Command
def help
- return <<-EOF
+ <<-EOF
Clear compacting queues on a regionserver.
The queue_name contains short and long.
short is shortCompactions's queue,long is longCompactions's queue.
@@ -38,4 +38,4 @@ module Shell
end
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
index f95c652..6d9c5de 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
@@ -20,8 +20,8 @@ module Shell
module Commands
class CloneSnapshot < Command
def help
- return <<-EOF
-Create a new table by cloning the snapshot content.
+ <<-EOF
+Create a new table by cloning the snapshot content.
There're no copies of data involved.
And writing on the newly created table will not influence the snapshot data.
@@ -37,13 +37,13 @@ EOF
end
def command(snapshot_name, table, args = {})
- raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
+ raise(ArgumentError, 'Arguments should be a Hash') unless args.is_a?(Hash)
restore_acl = args.delete(RESTORE_ACL) || false
admin.clone_snapshot(snapshot_name, table, restore_acl)
end
def handle_exceptions(cause, *args)
- if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
+ if cause.is_a?(org.apache.hadoop.hbase.TableExistsException)
tableName = args[1]
raise "Table already exists: #{tableName}!"
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/close_region.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/close_region.rb b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
index 3d01911..e33dd79 100644
--- a/hbase-shell/src/main/ruby/shell/commands/close_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
@@ -21,20 +21,20 @@ module Shell
module Commands
class CloseRegion < Command
def help
- return <<-EOF
+ <<-EOF
Close a single region. Ask the master to close a region out on the cluster
or if 'SERVER_NAME' is supplied, ask the designated hosting regionserver to
close the region directly. Closing a region, the master expects 'REGIONNAME'
to be a fully qualified region name. When asking the hosting regionserver to
directly close a region, you pass the regions' encoded name only. A region
name looks like this:
-
+
TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
or
Namespace:TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
The trailing period is part of the regionserver name. A region's encoded name
-is the hash at the end of a region name; e.g. 527db22f95c8a9e0116f0cc13c680396
+is the hash at the end of a region name; e.g. 527db22f95c8a9e0116f0cc13c680396
(without the period). A 'SERVER_NAME' is its host, port plus startcode. For
example: host187.example.com,60020,1289493121758 (find servername in master ui
or when you do detailed status in shell). This command will end up running
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/compact.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/compact.rb b/hbase-shell/src/main/ruby/shell/commands/compact.rb
index 1607536..a1c44c3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Compact < Command
def help
- return <<-EOF
+ <<-EOF
Compact all regions in passed table or pass a region row
to compact an individual region. You can also compact a single column
family within a region.
@@ -43,7 +43,7 @@ module Shell
EOF
end
- def command(table_or_region_name, family = nil, type = "NORMAL")
+ def command(table_or_region_name, family = nil, type = 'NORMAL')
admin.compact(table_or_region_name, family, type)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb b/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
index 5f02944..f10230a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class CompactRs < Command
def help
- return <<-EOF
+ <<-EOF
Compact all regions on passed regionserver.
Examples:
Compact all regions on a regionserver:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/compaction_state.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/compaction_state.rb b/hbase-shell/src/main/ruby/shell/commands/compaction_state.rb
index fbcdc7e..91bd79d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compaction_state.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compaction_state.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class CompactionState < Command
def help
- return <<-EOF
+ <<-EOF
Gets compaction status for a table:
hbase> compaction_state 'ns1:t1'
hbase> compaction_state 't1'
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/count.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/count.rb b/hbase-shell/src/main/ruby/shell/commands/count.rb
index 2f2562b..03840d0 100644
--- a/hbase-shell/src/main/ruby/shell/commands/count.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/count.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Count < Command
def help
- return <<-EOF
+ <<-EOF
Count the number of rows in a table. Return value is the number of rows.
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
@@ -58,7 +58,7 @@ EOF
def count(table, params = {})
# If the second parameter is an integer, then it is the old command syntax
- params = { 'INTERVAL' => params } if params.kind_of?(Fixnum)
+ params = { 'INTERVAL' => params } if params.is_a?(Integer)
# Merge params with defaults
params = {
@@ -71,14 +71,14 @@ EOF
@start_time = Time.now
formatter.header
count = table._count_internal(params['INTERVAL'].to_i, scan) do |cnt, row|
- formatter.row([ "Current count: #{cnt}, row: #{row}" ])
+ formatter.row(["Current count: #{cnt}, row: #{row}"])
end
formatter.footer(count)
- return count
+ count
end
end
end
end
-#Add the method table.count that calls count.count
-::Hbase::Table.add_shell_command("count")
+# Add the method table.count that calls count.count
+::Hbase::Table.add_shell_command('count')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/create.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/create.rb b/hbase-shell/src/main/ruby/shell/commands/create.rb
index 4812048..14a3942 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Create < Command
def help
- return <<-EOF
+ <<-EOF
Creates a table. Pass a table name, and a set of column family
specifications (at least one), and, optionally, table configuration.
Column specification can be a simple string (name), or a dictionary
@@ -65,9 +65,9 @@ EOF
def command(table, *args)
admin.create(table, *args)
@end_time = Time.now
- puts "Created table " + table.to_s
+ puts 'Created table ' + table.to_s
- #and then return the table just created
+ # and then return the table just created
table(table)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb b/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
index d478fc1..62a3bc2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class CreateNamespace < Command
def help
- return <<-EOF
+ <<-EOF
Create namespace; pass namespace name,
and optionally a dictionary of namespace configuration.
Examples:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/delete.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/delete.rb b/hbase-shell/src/main/ruby/shell/commands/delete.rb
index bce6625..3e4447c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Delete < Command
def help
- return <<-EOF
+ <<-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
@@ -54,5 +54,5 @@ EOF
end
end
-#Add the method table.delete that calls delete.delete
-::Hbase::Table.add_shell_command("delete")
+# Add the method table.delete that calls delete.delete
+::Hbase::Table.add_shell_command('delete')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/delete_all_snapshot.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/delete_all_snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/delete_all_snapshot.rb
index 5a77f73..52276fc 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete_all_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete_all_snapshot.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class DeleteAllSnapshot < Command
def help
- return <<-EOF
+ <<-EOF
Delete all of the snapshots matching the given regex. Examples:
hbase> delete_all_snapshot 's.*'
@@ -29,17 +29,17 @@ EOF
end
def command(regex)
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
+ formatter.header(['SNAPSHOT', 'TABLE + CREATION TIME'])
list = admin.list_snapshot(regex)
count = list.size
list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
+ creation_time = Time.at(snapshot.getCreationTime / 1000).to_s
+ formatter.row([snapshot.getName, snapshot.getTable + ' (' + creation_time + ')'])
end
puts "\nDelete the above #{count} snapshots (y/n)?" unless count == 0
answer = 'n'
answer = gets.chomp unless count == 0
- puts "No snapshots matched the regex #{regex.to_s}" if count == 0
+ puts "No snapshots matched the regex #{regex}" if count == 0
return unless answer =~ /y.*/i
@start_time = Time.now
admin.delete_all_snapshot(regex)
@@ -50,10 +50,10 @@ EOF
puts "#{successfullyDeleted} snapshots successfully deleted." unless successfullyDeleted == 0
return if leftOverSnapshotCount == 0
puts "\nFailed to delete the below #{leftOverSnapshotCount} snapshots."
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
+ formatter.header(['SNAPSHOT', 'TABLE + CREATION TIME'])
list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
+ creation_time = Time.at(snapshot.getCreationTime / 1000).to_s
+ formatter.row([snapshot.getName, snapshot.getTable + ' (' + creation_time + ')'])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
index 48059b0..85c73fb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class DeleteSnapshot < Command
def help
- return <<-EOF
+ <<-EOF
Delete a specified snapshot. Examples:
hbase> delete_snapshot 'snapshotName',
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/delete_table_snapshots.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/delete_table_snapshots.rb b/hbase-shell/src/main/ruby/shell/commands/delete_table_snapshots.rb
index 89936f1..a7875f1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete_table_snapshots.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete_table_snapshots.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class DeleteTableSnapshots < Command
def help
- return <<-EOF
+ <<-EOF
Delete all of the snapshots matching the given table name regular expression
and snapshot name regular expression.
By default snapshot name regular expression will delete all the snapshots of the
@@ -37,18 +37,18 @@ Examples:
EOF
end
- def command(tableNameregex, snapshotNameRegex = ".*")
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
+ def command(tableNameregex, snapshotNameRegex = '.*')
+ formatter.header(['SNAPSHOT', 'TABLE + CREATION TIME'])
list = admin.list_table_snapshots(tableNameregex, snapshotNameRegex)
count = list.size
list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
+ creation_time = Time.at(snapshot.getCreationTime / 1000).to_s
+ formatter.row([snapshot.getName, snapshot.getTable + ' (' + creation_time + ')'])
end
puts "\nDelete the above #{count} snapshots (y/n)?" unless count == 0
answer = 'n'
answer = gets.chomp unless count == 0
- puts "No snapshots matched the table name regular expression #{tableNameregex.to_s} and the snapshot name regular expression #{snapshotNameRegex.to_s}" if count == 0
+ puts "No snapshots matched the table name regular expression #{tableNameregex} and the snapshot name regular expression #{snapshotNameRegex}" if count == 0
return unless answer =~ /y.*/i
@start_time = Time.now
@@ -58,7 +58,7 @@ EOF
puts "Successfully deleted snapshot: #{deleteSnapshot.getName}"
puts "\n"
rescue RuntimeError
- puts "Failed to delete snapshot: #{deleteSnapshot.getName}, due to below exception,\n" + $!
+ puts "Failed to delete snapshot: #{deleteSnapshot.getName}, due to below exception,\n" + $ERROR_INFO
puts "\n"
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
index 033ec67..f5444ae 100644
--- a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Deleteall < Command
def help
- return <<-EOF
+ <<-EOF
Delete all cells in a given row; pass a table name, row, and optionally
a column and timestamp. Deleteall also support deleting a row range using a
row key prefix. Examples:
@@ -64,5 +64,5 @@ EOF
end
end
-#Add the method table.deleteall that calls deleteall.deleteall
-::Hbase::Table.add_shell_command("deleteall")
+# Add the method table.deleteall that calls deleteall.deleteall
+::Hbase::Table.add_shell_command('deleteall')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/describe.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/describe.rb b/hbase-shell/src/main/ruby/shell/commands/describe.rb
index 37938a7..3268b2f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Describe < Command
def help
- return <<-EOF
+ <<-EOF
Describe the named table. For example:
hbase> describe 't1'
hbase> describe 'ns1:t1'
@@ -35,13 +35,13 @@ EOF
def command(table)
column_families = admin.get_column_families(table)
- formatter.header(["Table " + table.to_s + " is " + if admin.enabled?(table) then "ENABLED" else "DISABLED" end])
+ formatter.header(['Table ' + table.to_s + ' is ' + (admin.enabled?(table) ? 'ENABLED' : 'DISABLED')])
formatter.row([table.to_s + admin.get_table_attributes(table)], true)
- formatter.header(["COLUMN FAMILIES DESCRIPTION"])
+ formatter.header(['COLUMN FAMILIES DESCRIPTION'])
column_families.each do |column_family|
- formatter.row([ column_family.to_s ], true)
+ formatter.row([column_family.to_s], true)
end
- formatter.footer()
+ formatter.footer
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
index ebd9bd2..55261d6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class DescribeNamespace < Command
def help
- return <<-EOF
+ <<-EOF
Describe the named namespace. For example:
hbase> describe_namespace 'ns1'
EOF
@@ -30,8 +30,8 @@ EOF
def command(namespace)
desc = admin.describe_namespace(namespace)
- formatter.header([ "DESCRIPTION" ], [ 64 ])
- formatter.row([ desc ], true, [ 64 ])
+ formatter.header(['DESCRIPTION'], [64])
+ formatter.row([desc], true, [64])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/disable.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/disable.rb b/hbase-shell/src/main/ruby/shell/commands/disable.rb
index 6695002..79be0a2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Disable < Command
def help
- return <<-EOF
+ <<-EOF
Start disable of named table:
hbase> disable 't1'
hbase> disable 'ns1:t1'
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/disable_all.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/disable_all.rb b/hbase-shell/src/main/ruby/shell/commands/disable_all.rb
index 212db24..b4c5a39 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable_all.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable_all.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class DisableAll < Command
def help
- return <<-EOF
+ <<-EOF
Disable all of tables matching the given regex:
hbase> disable_all 't.*'
@@ -34,16 +34,16 @@ EOF
list = admin.list(regex)
count = list.size
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
puts "\nDisable the above #{count} tables (y/n)?" unless count == 0
answer = 'n'
answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
+ puts "No tables matched the regex #{regex}" if count == 0
return unless answer =~ /y.*/i
failed = admin.disable_all(regex)
puts "#{count - failed.size} tables successfully disabled"
- puts "#{failed.size} tables not disabled due to an exception: #{failed.join ','}" unless failed.size == 0
+ puts "#{failed.size} tables not disabled due to an exception: #{failed.join ','}" unless failed.empty?
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb b/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
index c193f13..1027316 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
@@ -19,9 +19,9 @@
module Shell
module Commands
- class DisablePeer< Command
+ class DisablePeer < Command
def help
- return <<-EOF
+ <<-EOF
Stops the replication stream to the specified cluster, but still
keeps track of new edits to replicate.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/disable_table_replication.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/disable_table_replication.rb b/hbase-shell/src/main/ruby/shell/commands/disable_table_replication.rb
index a020d81..0e903ac 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable_table_replication.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable_table_replication.rb
@@ -18,9 +18,9 @@
module Shell
module Commands
- class DisableTableReplication< Command
+ class DisableTableReplication < Command
def help
- return <<-EOF
+ <<-EOF
Disable a table's replication switch.
Examples:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/drop.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/drop.rb b/hbase-shell/src/main/ruby/shell/commands/drop.rb
index 3f7332c..063eb32 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Drop < Command
def help
- return <<-EOF
+ <<-EOF
Drop the named table. Table must first be disabled:
hbase> drop 't1'
hbase> drop 'ns1:t1'
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/drop_all.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/drop_all.rb b/hbase-shell/src/main/ruby/shell/commands/drop_all.rb
index 73398fb..5c40dfd 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop_all.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop_all.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class DropAll < Command
def help
- return <<-EOF
+ <<-EOF
Drop all of the tables matching the given regex:
hbase> drop_all 't.*'
@@ -34,16 +34,16 @@ EOF
list = admin.list(regex)
count = list.size
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
puts "\nDrop the above #{count} tables (y/n)?" unless count == 0
answer = 'n'
answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
+ puts "No tables matched the regex #{regex}" if count == 0
return unless answer =~ /y.*/i
failed = admin.drop_all(regex)
puts "#{count - failed.size} tables successfully dropped"
- puts "#{failed.size} tables not dropped due to an exception: #{failed.join ','}" unless failed.size == 0
+ puts "#{failed.size} tables not dropped due to an exception: #{failed.join ','}" unless failed.empty?
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb b/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
index 392f247..e667c2a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class DropNamespace < Command
def help
- return <<-EOF
+ <<-EOF
Drop the named namespace. The namespace must be empty.
EOF
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/enable.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/enable.rb b/hbase-shell/src/main/ruby/shell/commands/enable.rb
index 5d21219..13598ec 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Enable < Command
def help
- return <<-EOF
+ <<-EOF
Start enable of named table:
hbase> enable 't1'
hbase> enable 'ns1:t1'
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/enable_all.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/enable_all.rb b/hbase-shell/src/main/ruby/shell/commands/enable_all.rb
index 2b899f2..a58f118 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable_all.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable_all.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class EnableAll < Command
def help
- return <<-EOF
+ <<-EOF
Enable all of the tables matching the given regex:
hbase> enable_all 't.*'
@@ -34,16 +34,16 @@ EOF
list = admin.list(regex)
count = list.size
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
puts "\nEnable the above #{count} tables (y/n)?" unless count == 0
answer = 'n'
answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
+ puts "No tables matched the regex #{regex}" if count == 0
return unless answer =~ /y.*/i
failed = admin.enable_all(regex)
puts "#{count - failed.size} tables successfully enabled"
- puts "#{failed.size} tables not enabled due to an exception: #{failed.join ','}" unless failed.size == 0
+ puts "#{failed.size} tables not enabled due to an exception: #{failed.join ','}" unless failed.empty?
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb b/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
index 5f1a727..19cf7af 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
@@ -19,9 +19,9 @@
module Shell
module Commands
- class EnablePeer< Command
+ class EnablePeer < Command
def help
- return <<-EOF
+ <<-EOF
Restarts the replication to the specified peer cluster,
continuing from where it was disabled.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/enable_table_replication.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/enable_table_replication.rb b/hbase-shell/src/main/ruby/shell/commands/enable_table_replication.rb
index e4e2fc1..47eb649 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable_table_replication.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable_table_replication.rb
@@ -18,9 +18,9 @@
module Shell
module Commands
- class EnableTableReplication< Command
+ class EnableTableReplication < Command
def help
- return <<-EOF
+ <<-EOF
Enable a table's replication switch.
Examples:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/exists.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/exists.rb b/hbase-shell/src/main/ruby/shell/commands/exists.rb
index 4eb13a4..1471d4a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/exists.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/exists.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Exists < Command
def help
- return <<-EOF
+ <<-EOF
Does the named table exist?
hbase> exists 't1'
hbase> exists 'ns1:t1'
@@ -31,8 +31,8 @@ EOF
def command(table)
exists = admin.exists?(table.to_s)
formatter.row([
- "Table #{table} " + (exists ? "does exist" : "does not exist")
- ])
+ "Table #{table} " + (exists ? 'does exist' : 'does not exist')
+ ])
exists
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/flush.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/flush.rb b/hbase-shell/src/main/ruby/shell/commands/flush.rb
index 13963e1..4165b84 100644
--- a/hbase-shell/src/main/ruby/shell/commands/flush.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/flush.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Flush < Command
def help
- return <<-EOF
+ <<-EOF
Flush all regions in passed table or pass a region row to
flush an individual region. For example:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get.rb b/hbase-shell/src/main/ruby/shell/commands/get.rb
index 6b9ad42..cdf4299 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Get < Command
def help
- return <<-EOF
+ <<-EOF
Get row or cell contents; pass table name, row, and optionally
a dictionary of column(s), timestamp, timerange and versions. Examples:
@@ -44,14 +44,14 @@ a dictionary of column(s), timestamp, timerange and versions. Examples:
Besides the default 'toStringBinary' format, 'get' also supports custom formatting by
column. A user can define a FORMATTER by adding it to the column name in the get
-specification. The FORMATTER can be stipulated:
+specification. The FORMATTER can be stipulated:
1. either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
2. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'.
-Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
+Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
hbase> get 't1', 'r1' {COLUMN => ['cf:qualifier1:toInt',
- 'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
+ 'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
Note that you can specify a FORMATTER by column only (cf:qualifier). You can set a
formatter for all columns (including, all key parts) using the "FORMATTER"
@@ -60,7 +60,7 @@ and "FORMATTER_CLASS" options. The default "FORMATTER_CLASS" is
hbase> get 't1', 'r1', {FORMATTER => 'toString'}
hbase> get 't1', 'r1', {FORMATTER_CLASS => 'org.apache.hadoop.hbase.util.Bytes', FORMATTER => 'toString'}
-
+
The same commands also can be run on a reference to a table (obtained via get_table or
create_table). Suppose you had a reference t to table 't1', the corresponding commands
would be:
@@ -87,10 +87,10 @@ EOF
def get(table, row, *args)
@start_time = Time.now
- formatter.header(["COLUMN", "CELL"])
+ formatter.header(%w[COLUMN CELL])
count, is_stale = table._get_internal(row, *args) do |column, value|
- formatter.row([ column, value ])
+ formatter.row([column, value])
end
formatter.footer(count, is_stale)
@@ -99,5 +99,5 @@ EOF
end
end
-#add get command to table
+# add get command to table
::Hbase::Table.add_shell_command('get')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_auths.rb b/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
index 4ea1b2e..80e7aeb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class GetAuths < Command
def help
- return <<-EOF
+ <<-EOF
Get the visibility labels set for a particular user or group
Syntax : get_auths 'user'
@@ -33,7 +33,7 @@ EOF
def command(user)
list = visibility_labels_admin.get_auths(user)
list.each do |auths|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(auths.toByteArray)])
+ formatter.row([org.apache.hadoop.hbase.util.Bytes.toStringBinary(auths.toByteArray)])
end
list
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_counter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_counter.rb b/hbase-shell/src/main/ruby/shell/commands/get_counter.rb
index 6708c6a..12ab4b2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_counter.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_counter.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class GetCounter < Command
def help
- return <<-EOF
+ <<-EOF
Return a counter cell value at specified table/row/column coordinates.
A counter cell should be managed with atomic increment functions on HBase
and the data should be binary encoded (as long value). Example:
@@ -44,7 +44,7 @@ EOF
if cnt = table._get_counter_internal(row, column)
puts "COUNTER VALUE = #{cnt}"
else
- puts "No counter found at specified coordinates"
+ puts 'No counter found at specified coordinates'
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_peer_config.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_peer_config.rb b/hbase-shell/src/main/ruby/shell/commands/get_peer_config.rb
index 6417980..81f738e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_peer_config.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_peer_config.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class GetPeerConfig < Command
def help
- return <<-EOF
+ <<-EOF
Outputs the cluster key, replication endpoint class (if present), and any replication configuration parameters
EOF
end
@@ -35,19 +35,14 @@ module Shell
cluster_key = peer_config.get_cluster_key
endpoint = peer_config.get_replication_endpoint_impl
- unless cluster_key.nil?
- formatter.row(["Cluster Key", cluster_key])
- end
- unless endpoint.nil?
- formatter.row(["Replication Endpoint", endpoint])
- end
+ formatter.row(['Cluster Key', cluster_key]) unless cluster_key.nil?
+ formatter.row(['Replication Endpoint', endpoint]) unless endpoint.nil?
unless peer_config.get_configuration.nil?
peer_config.get_configuration.each do |config_entry|
formatter.row(config_entry)
end
end
-
end
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_rsgroup.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_rsgroup.rb b/hbase-shell/src/main/ruby/shell/commands/get_rsgroup.rb
index 15a363b..a18083f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_rsgroup.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_rsgroup.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class GetRsgroup < Command
def help
- return <<-EOF
+ <<-EOF
Get a RegionServer group's information.
Example:
@@ -34,7 +34,7 @@ EOF
rsgroup_admin.get_rsgroup(group_name) do |s|
formatter.row([s])
end
- formatter.footer()
+ formatter.footer
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_server_rsgroup.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_server_rsgroup.rb b/hbase-shell/src/main/ruby/shell/commands/get_server_rsgroup.rb
index 61c13a2..042af2d1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_server_rsgroup.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_server_rsgroup.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class GetServerRsgroup < Command
def help
- return <<-EOF
+ <<-EOF
Get the group name the given RegionServer is a member of.
Example:
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_splits.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_splits.rb b/hbase-shell/src/main/ruby/shell/commands/get_splits.rb
index 8b6ae82..91307c2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_splits.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_splits.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class GetSplits < Command
def help
- return <<-EOF
+ <<-EOF
Get the splits of the named table:
hbase> get_splits 't1'
hbase> get_splits 'ns1:t1'
@@ -37,10 +37,10 @@ EOF
end
def get_splits(table)
- table._get_splits_internal()
+ table._get_splits_internal
end
end
end
end
-::Hbase::Table.add_shell_command("get_splits")
\ No newline at end of file
+::Hbase::Table.add_shell_command('get_splits')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_table.rb b/hbase-shell/src/main/ruby/shell/commands/get_table.rb
index 2270f43..6ad4f33 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_table.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_table.rb
@@ -20,7 +20,7 @@ module Shell
module Commands
class GetTable < Command
def help
- return <<-EOF
+ <<-EOF
Get the given table name and return it as an actual object to
be manipulated by the user. See table.help for more information
on how to use the table.
@@ -37,7 +37,7 @@ which will then print the help for that table.
EOF
end
- def command(table, *args)
+ def command(table, *_args)
table(table)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/get_table_rsgroup.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get_table_rsgroup.rb b/hbase-shell/src/main/ruby/shell/commands/get_table_rsgroup.rb
index c03af1f..dd48ca9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_table_rsgroup.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_table_rsgroup.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class GetTableRsgroup < Command
def help
- return <<-EOF
+ <<-EOF
Get the RegionServer group name the given table is a member of.
Example:
@@ -31,7 +31,7 @@ EOF
def command(table)
group_name =
- rsgroup_admin.get_rsgroup_of_table(table).getName
+ rsgroup_admin.get_rsgroup_of_table(table).getName
formatter.row([group_name])
formatter.footer(1)
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/grant.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/grant.rb b/hbase-shell/src/main/ruby/shell/commands/grant.rb
index d6f848b..956489a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/grant.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/grant.rb
@@ -20,15 +20,15 @@ module Shell
module Commands
class Grant < Command
def help
- return <<-EOF
+ <<-EOF
Grant users specific rights.
Syntax : grant <user>, <permissions> [, <@namespace> [, <table> [, <column family> [, <column qualifier>]]]
permissions is either zero or more letters from the set "RWXCA".
READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A')
-Note: Groups and users are granted access in the same way, but groups are prefixed with an '@'
- character. In the same way, tables and namespaces are specified, but namespaces are
+Note: Groups and users are granted access in the same way, but groups are prefixed with an '@'
+ character. In the same way, tables and namespaces are specified, but namespaces are
prefixed with an '@' character.
For example:
@@ -42,12 +42,11 @@ EOF
end
def command(*args)
-
# command form is ambiguous at first argument
table_name = user = args[0]
- raise(ArgumentError, "First argument should be a String") unless user.kind_of?(String)
+ raise(ArgumentError, 'First argument should be a String') unless user.is_a?(String)
- if args[1].kind_of?(String)
+ if args[1].is_a?(String)
# Original form of the command
# user in args[0]
@@ -57,27 +56,30 @@ EOF
# qualifier in args[4] or nil
permissions = args[1]
- raise(ArgumentError, "Permissions are not of String type") unless permissions.kind_of?(
- String)
+ raise(ArgumentError, 'Permissions are not of String type') unless permissions.is_a?(
+ String
+ )
table_name = family = qualifier = nil
table_name = args[2] # will be nil if unset
- if not table_name.nil?
- raise(ArgumentError, "Table name is not of String type") unless table_name.kind_of?(
- String)
- family = args[3] # will be nil if unset
- if not family.nil?
- raise(ArgumentError, "Family is not of String type") unless family.kind_of?(String)
- qualifier = args[4] # will be nil if unset
- if not qualifier.nil?
- raise(ArgumentError, "Qualifier is not of String type") unless qualifier.kind_of?(
- String)
+ unless table_name.nil?
+ raise(ArgumentError, 'Table name is not of String type') unless table_name.is_a?(
+ String
+ )
+ family = args[3] # will be nil if unset
+ unless family.nil?
+ raise(ArgumentError, 'Family is not of String type') unless family.is_a?(String)
+ qualifier = args[4] # will be nil if unset
+ unless qualifier.nil?
+ raise(ArgumentError, 'Qualifier is not of String type') unless qualifier.is_a?(
+ String
+ )
end
end
end
@start_time = Time.now
security_admin.grant(user, permissions, table_name, family, qualifier)
- elsif args[1].kind_of?(Hash)
+ elsif args[1].is_a?(Hash)
# New form of the command, a cell ACL update
# table_name in args[0], a string
@@ -86,9 +88,9 @@ EOF
# Useful for feature testing and debugging.
permissions = args[1]
- raise(ArgumentError, "Permissions are not of Hash type") unless permissions.kind_of?(Hash)
+ raise(ArgumentError, 'Permissions are not of Hash type') unless permissions.is_a?(Hash)
scan = args[2]
- raise(ArgumentError, "Scanner specification is not a Hash") unless scan.kind_of?(Hash)
+ raise(ArgumentError, 'Scanner specification is not a Hash') unless scan.is_a?(Hash)
t = table(table_name)
@start_time = Time.now
@@ -108,9 +110,8 @@ EOF
formatter.footer(count)
else
- raise(ArgumentError, "Second argument should be a String or Hash")
+ raise(ArgumentError, 'Second argument should be a String or Hash')
end
-
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/incr.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/incr.rb b/hbase-shell/src/main/ruby/shell/commands/incr.rb
index 318fac3..f1c3121 100644
--- a/hbase-shell/src/main/ruby/shell/commands/incr.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/incr.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class Incr < Command
def help
- return <<-EOF
+ <<-EOF
Increments a cell 'value' at specified table/row/column coordinates.
To increment a cell value in table 'ns1:t1' or 't1' at row 'r1' under column
'c1' by 1 (can be omitted) or 10 do:
@@ -48,16 +48,16 @@ EOF
incr(table(table), row, column, value, args)
end
- def incr(table, row, column, value = nil, args={})
+ def incr(table, row, column, value = nil, args = {})
if cnt = table._incr_internal(row, column, value, args)
puts "COUNTER VALUE = #{cnt}"
else
- puts "No counter found at specified coordinates"
+ puts 'No counter found at specified coordinates'
end
end
end
end
end
-#add incr comamnd to Table
-::Hbase::Table.add_shell_command("incr")
+# add incr comamnd to Table
+::Hbase::Table.add_shell_command('incr')
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb b/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
index 6a914e3..20af00c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class IsDisabled < Command
def help
- return <<-EOF
+ <<-EOF
Is named table disabled? For example:
hbase> is_disabled 't1'
hbase> is_disabled 'ns1:t1'
@@ -29,7 +29,7 @@ EOF
end
def command(table)
- formatter.row([admin.disabled?(table)? "true" : "false"])
+ formatter.row([admin.disabled?(table) ? 'true' : 'false'])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
index da9c566..fa122db 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class IsEnabled < Command
def help
- return <<-EOF
+ <<-EOF
Is named table enabled? For example:
hbase> is_enabled 't1'
hbase> is_enabled 'ns1:t1'
@@ -30,7 +30,7 @@ EOF
def command(table)
enabled = admin.enabled?(table)
- formatter.row([enabled ? "true" : "false"])
+ formatter.row([enabled ? 'true' : 'false'])
enabled
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list.rb b/hbase-shell/src/main/ruby/shell/commands/list.rb
index dc3d168..676b5bf 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class List < Command
def help
- return <<-EOF
+ <<-EOF
List all user tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:
@@ -32,16 +32,16 @@ be used to filter the output. Examples:
EOF
end
- def command(regex = ".*")
- formatter.header([ "TABLE" ])
+ def command(regex = '.*')
+ formatter.header(['TABLE'])
list = admin.list(regex)
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
formatter.footer(list.size)
- return list
+ list
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
index 6b730b2..8619642 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class ListLabels < Command
def help
- return <<-EOF
+ <<-EOF
List the visibility labels defined in the system.
Optional regular expression parameter could be used to filter the labels being returned.
Syntax : list_labels
@@ -31,10 +31,10 @@ For example:
EOF
end
- def command(regex = ".*")
+ def command(regex = '.*')
list = visibility_labels_admin.list_labels(regex)
list.each do |label|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(label.toByteArray)])
+ formatter.row([org.apache.hadoop.hbase.util.Bytes.toStringBinary(label.toByteArray)])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_locks.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_locks.rb b/hbase-shell/src/main/ruby/shell/commands/list_locks.rb
index fca411b..a7f7b73 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_locks.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_locks.rb
@@ -21,15 +21,15 @@ module Shell
module Commands
class ListLocks < Command
def help
- return <<-EOF
+ <<-EOF
List all locks in hbase. Examples:
hbase> list_locks
EOF
end
- def command()
- list = admin.list_locks()
+ def command
+ list = admin.list_locks
list.each do |lock|
formatter.output_strln("#{lock.resourceType}(#{lock.resourceName})")
@@ -42,17 +42,17 @@ EOF
end
if lock.waitingProcedures.any?
- formatter.output_strln("Waiting procedures:")
- formatter.header([ "Lock type", "Procedure Id" ])
+ formatter.output_strln('Waiting procedures:')
+ formatter.header(['Lock type', 'Procedure Id'])
lock.waitingProcedures.each do |waitingProcedure|
- formatter.row([ waitingProcedure.lockType.to_s, waitingProcedure.procedure.procId.to_s ]);
+ formatter.row([waitingProcedure.lockType.to_s, waitingProcedure.procedure.procId.to_s])
end
formatter.footer(lock.waitingProcedures.size)
end
- formatter.output_strln("");
+ formatter.output_strln('')
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb b/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
index 63aeac1..131337f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ListNamespace < Command
def help
- return <<-EOF
+ <<-EOF
List all namespaces in hbase. Optional regular expression parameter could
be used to filter the output. Examples:
@@ -30,12 +30,12 @@ be used to filter the output. Examples:
EOF
end
- def command(regex = ".*")
- formatter.header([ "NAMESPACE" ])
+ def command(regex = '.*')
+ formatter.header(['NAMESPACE'])
list = admin.list_namespace(regex)
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
formatter.footer(list.size)
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_namespace_tables.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_namespace_tables.rb b/hbase-shell/src/main/ruby/shell/commands/list_namespace_tables.rb
index 30d4db0..ff08568 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_namespace_tables.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_namespace_tables.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ListNamespaceTables < Command
def help
- return <<-EOF
+ <<-EOF
List all tables that are members of the namespace.
Examples:
@@ -30,11 +30,11 @@ EOF
end
def command(namespace)
- formatter.header([ "TABLE" ])
+ formatter.header(['TABLE'])
list = admin.list_namespace_tables(namespace)
list.each do |table|
- formatter.row([ table ])
+ formatter.row([table])
end
formatter.footer(list.size)
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_peer_configs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_peer_configs.rb b/hbase-shell/src/main/ruby/shell/commands/list_peer_configs.rb
index 8946e39..12fb301 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_peer_configs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_peer_configs.rb
@@ -19,7 +19,7 @@ module Shell
module Commands
class ListPeerConfigs < Command
def help
- return <<-EOF
+ <<-EOF
No-argument method that outputs the replication peer configuration for each peer defined on this cluster.
EOF
end
@@ -30,9 +30,9 @@ module Shell
peer_configs.each do |peer_config_entry|
peer_id = peer_config_entry[0]
peer_config = peer_config_entry[1]
- formatter.row(["PeerId", peer_id])
+ formatter.row(['PeerId', peer_id])
GetPeerConfig.new(@shell).format_peer_config(peer_config)
- formatter.row([" "])
+ formatter.row([' '])
end
end
peer_configs
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_peers.rb b/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
index 2dd8483..04453c2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
@@ -20,33 +20,33 @@
module Shell
module Commands
- class ListPeers< Command
+ class ListPeers < Command
def help
- return <<-EOF
+ <<-EOF
List all replication peer clusters.
hbase> list_peers
EOF
end
- def command()
+ def command
peers = replication_admin.list_peers
- formatter.header(["PEER_ID", "CLUSTER_KEY", "ENDPOINT_CLASSNAME",
- "STATE", "NAMESPACES", "TABLE_CFS", "BANDWIDTH"])
+ formatter.header(%w[PEER_ID CLUSTER_KEY ENDPOINT_CLASSNAME
+ STATE NAMESPACES TABLE_CFS BANDWIDTH])
peers.each do |peer|
id = peer.getPeerId
- state = peer.isEnabled ? "ENABLED" : "DISABLED"
+ state = peer.isEnabled ? 'ENABLED' : 'DISABLED'
config = peer.getPeerConfig
namespaces = replication_admin.show_peer_namespaces(config)
tableCFs = replication_admin.show_peer_tableCFs(id)
- formatter.row([ id, config.getClusterKey,
- config.getReplicationEndpointImpl, state, namespaces, tableCFs,
- config.getBandwidth ])
+ formatter.row([id, config.getClusterKey,
+ config.getReplicationEndpointImpl, state, namespaces, tableCFs,
+ config.getBandwidth])
end
- formatter.footer()
+ formatter.footer
peers
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb b/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
index 64a3388..a2bec37 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
@@ -21,21 +21,21 @@ module Shell
module Commands
class ListProcedures < Command
def help
- return <<-EOF
+ <<-EOF
List all procedures in hbase. For example:
hbase> list_procedures
EOF
end
- def command()
- formatter.header([ "Id", "Name", "State", "Submitted_Time", "Last_Update" ])
+ def command
+ formatter.header(%w[Id Name State Submitted_Time Last_Update])
- list = admin.list_procedures()
+ list = admin.list_procedures
list.each do |proc|
submitted_time = Time.at(proc.getSubmittedTime / 1000).to_s
last_update = Time.at(proc.getLastUpdate / 1000).to_s
- formatter.row([ proc.getProcId, proc.getProcName, proc.getProcState, submitted_time, last_update ])
+ formatter.row([proc.getProcId, proc.getProcName, proc.getProcState, submitted_time, last_update])
end
formatter.footer(list.size)
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_quota_snapshots.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_quota_snapshots.rb b/hbase-shell/src/main/ruby/shell/commands/list_quota_snapshots.rb
index bec7f02..ff9d4f2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_quota_snapshots.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_quota_snapshots.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ListQuotaSnapshots < Command
def help
- return <<-EOF
+ <<-EOF
Lists the current space quota snapshots with optional selection criteria.
Snapshots encapsulate relevant information to space quotas such as space
use, configured limits, and quota violation details. This command is
@@ -48,15 +48,15 @@ EOF
desired_table = args[TABLE]
desired_namespace = args[NAMESPACE]
desired_regionserver = args[REGIONSERVER]
- formatter.header(["TABLE", "USAGE", "LIMIT", "IN_VIOLATION", "POLICY"])
+ formatter.header(%w[TABLE USAGE LIMIT IN_VIOLATION POLICY])
count = 0
- quotas_admin.get_quota_snapshots(desired_regionserver).each do |table_name,snapshot|
+ quotas_admin.get_quota_snapshots(desired_regionserver).each do |table_name, snapshot|
# Skip this snapshot if it's for a table/namespace the user did not ask for
next unless accept? table_name, desired_table, desired_namespace
- status = snapshot.getQuotaStatus()
+ status = snapshot.getQuotaStatus
policy = get_policy(status)
- formatter.row([table_name.to_s, snapshot.getUsage().to_s, snapshot.getLimit().to_s,
- status.isInViolation().to_s, policy])
+ formatter.row([table_name.to_s, snapshot.getUsage.to_s, snapshot.getLimit.to_s,
+ status.isInViolation.to_s, policy])
count += 1
end
formatter.footer(count)
@@ -64,20 +64,20 @@ EOF
def get_policy(status)
# Unwrap the violation policy if it exists
- if status.isInViolation()
- status.getPolicy().name()
+ if status.isInViolation
+ status.getPolicy.name
else
- "None"
+ 'None'
end
end
- def accept?(table_name, desired_table=nil, desired_namespace=nil)
+ def accept?(table_name, desired_table = nil, desired_namespace = nil)
# Check the table name if given one
- if desired_table and table_name.getQualifierAsString() != desired_table
+ if desired_table && table_name.getQualifierAsString != desired_table
return false
end
# Check the namespace if given one
- if desired_namespace and table_name.getNamespaceAsString() != desired_namespace
+ if desired_namespace && table_name.getNamespaceAsString != desired_namespace
return false
end
true
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_quota_table_sizes.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_quota_table_sizes.rb b/hbase-shell/src/main/ruby/shell/commands/list_quota_table_sizes.rb
index 5339543..ef7505e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_quota_table_sizes.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_quota_table_sizes.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ListQuotaTableSizes < Command
def help
- return <<-EOF
+ <<-EOF
Lists the computed size of each table in the cluster as computed by
all RegionServers. This is the raw information that the Master uses to
make decisions about space quotas. Most times, using `list_quota_snapshots`
@@ -33,10 +33,10 @@ For example:
EOF
end
- def command(args = {})
- formatter.header(["TABLE", "SIZE"])
+ def command(_args = {})
+ formatter.header(%w[TABLE SIZE])
count = 0
- quotas_admin.get_master_table_sizes().each do |tableName,size|
+ quotas_admin.get_master_table_sizes.each do |tableName, size|
formatter.row([tableName.to_s, size.to_s])
count += 1
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/2115d4b5/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb b/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
index 604d833..b20aae6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
@@ -21,7 +21,7 @@ module Shell
module Commands
class ListQuotas < Command
def help
- return <<-EOF
+ <<-EOF
List the quota settings added to the system.
You can filter the result based on USER, TABLE, or NAMESPACE.
@@ -37,11 +37,11 @@ EOF
end
def command(args = {})
- formatter.header(["OWNER", "QUOTAS"])
+ formatter.header(%w[OWNER QUOTAS])
- #actually do the scanning
+ # actually do the scanning
count = quotas_admin.list_quotas(args) do |row, cells|
- formatter.row([ row, cells ])
+ formatter.row([row, cells])
end
formatter.footer(count)