You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2016/06/03 22:50:09 UTC
hbase git commit: HBASE-15849 Simplify the way we handle runtime of
commands. Functions format_simple_command and
format_and_return_simple_command are used to print runtimes right now. They
are called from within every single command and use Ruby's 'yiel
Repository: hbase
Updated Branches:
refs/heads/master de1b5ff77 -> 70762faa9
HBASE-15849 Simplify the way we handle runtime of commands.
Functions format_simple_command and format_and_return_simple_command are used to print runtimes right now. They are called from within every single command and use Ruby's 'yield' magic. Instead, we can simplify it using 'command_safe' function. Since command_safe wraps all commands, we can simply time before and after we call individual command.
If a command only wants to time a part of its logic, it can set instance variables start_time and end_time accordingly which is far more simpler to understand and work with than 'yield'.
Change-Id: Ibfacf3593175af22fc4f7d80896dd2f6d7c5dde3
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/70762faa
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/70762faa
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/70762faa
Branch: refs/heads/master
Commit: 70762faa98e6ad26f10fa8bd9ebc1824fdcb507c
Parents: de1b5ff
Author: Apekshit Sharma <ap...@apache.org>
Authored: Fri Jun 3 14:13:45 2016 -0700
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Fri Jun 3 15:50:03 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/shell.rb | 7 ++---
hbase-shell/src/main/ruby/shell/commands.rb | 27 +++++++-------------
.../main/ruby/shell/commands/abort_procedure.rb | 6 +----
.../src/main/ruby/shell/commands/add_labels.rb | 4 +--
.../src/main/ruby/shell/commands/add_peer.rb | 4 +--
.../src/main/ruby/shell/commands/alter.rb | 4 +--
.../src/main/ruby/shell/commands/alter_async.rb | 4 +--
.../main/ruby/shell/commands/alter_namespace.rb | 4 +--
.../src/main/ruby/shell/commands/append.rb | 10 ++++----
.../ruby/shell/commands/append_peer_tableCFs.rb | 4 +--
.../src/main/ruby/shell/commands/assign.rb | 4 +--
.../main/ruby/shell/commands/balance_switch.rb | 6 +----
.../src/main/ruby/shell/commands/balancer.rb | 14 +++++-----
.../ruby/shell/commands/balancer_enabled.rb | 6 +----
.../shell/commands/catalogjanitor_enabled.rb | 6 +----
.../ruby/shell/commands/catalogjanitor_run.rb | 4 +--
.../shell/commands/catalogjanitor_switch.rb | 6 +----
.../src/main/ruby/shell/commands/clear_auths.rb | 4 +--
.../main/ruby/shell/commands/clone_snapshot.rb | 4 +--
.../main/ruby/shell/commands/close_region.rb | 4 +--
.../src/main/ruby/shell/commands/compact.rb | 4 +--
.../src/main/ruby/shell/commands/compact_rs.rb | 4 +--
.../src/main/ruby/shell/commands/count.rb | 4 +--
.../src/main/ruby/shell/commands/create.rb | 7 +++--
.../ruby/shell/commands/create_namespace.rb | 4 +--
.../src/main/ruby/shell/commands/delete.rb | 13 +++++-----
.../ruby/shell/commands/delete_all_snapshot.rb | 6 ++---
.../main/ruby/shell/commands/delete_snapshot.rb | 4 +--
.../shell/commands/delete_table_snapshots.rb | 19 +++++++-------
.../src/main/ruby/shell/commands/deleteall.rb | 5 ++--
.../src/main/ruby/shell/commands/describe.rb | 4 +--
.../ruby/shell/commands/describe_namespace.rb | 3 ---
.../src/main/ruby/shell/commands/disable.rb | 4 +--
.../main/ruby/shell/commands/disable_peer.rb | 4 +--
.../shell/commands/disable_table_replication.rb | 6 ++---
.../src/main/ruby/shell/commands/drop.rb | 4 +--
.../main/ruby/shell/commands/drop_namespace.rb | 4 +--
.../src/main/ruby/shell/commands/enable.rb | 4 +--
.../src/main/ruby/shell/commands/enable_peer.rb | 4 +--
.../shell/commands/enable_table_replication.rb | 6 ++---
.../src/main/ruby/shell/commands/exists.rb | 4 +--
.../src/main/ruby/shell/commands/flush.rb | 4 +--
hbase-shell/src/main/ruby/shell/commands/get.rb | 4 +--
.../src/main/ruby/shell/commands/get_auths.rb | 8 +++---
.../main/ruby/shell/commands/get_peer_config.rb | 7 +++--
.../src/main/ruby/shell/commands/get_table.rb | 4 +--
.../src/main/ruby/shell/commands/grant.rb | 9 +++----
.../src/main/ruby/shell/commands/incr.rb | 12 ++++-----
.../src/main/ruby/shell/commands/is_disabled.rb | 8 ++----
.../src/main/ruby/shell/commands/is_enabled.rb | 6 +----
.../src/main/ruby/shell/commands/list.rb | 3 +--
.../src/main/ruby/shell/commands/list_labels.rb | 8 +++---
.../main/ruby/shell/commands/list_namespace.rb | 3 +--
.../shell/commands/list_namespace_tables.rb | 3 +--
.../ruby/shell/commands/list_peer_configs.rb | 18 ++++++-------
.../src/main/ruby/shell/commands/list_peers.rb | 3 +--
.../main/ruby/shell/commands/list_procedures.rb | 3 +--
.../src/main/ruby/shell/commands/list_quotas.rb | 3 +--
.../shell/commands/list_replicated_tables.rb | 4 +--
.../main/ruby/shell/commands/list_snapshots.rb | 3 +--
.../ruby/shell/commands/list_table_snapshots.rb | 3 +--
.../main/ruby/shell/commands/locate_region.rb | 4 +--
.../main/ruby/shell/commands/major_compact.rb | 4 +--
.../main/ruby/shell/commands/merge_region.rb | 4 +--
.../src/main/ruby/shell/commands/move.rb | 4 +--
.../src/main/ruby/shell/commands/normalize.rb | 6 +----
.../ruby/shell/commands/normalizer_enabled.rb | 6 +----
.../ruby/shell/commands/normalizer_switch.rb | 6 +----
hbase-shell/src/main/ruby/shell/commands/put.rb | 5 ++--
.../src/main/ruby/shell/commands/remove_peer.rb | 4 +--
.../ruby/shell/commands/remove_peer_tableCFs.rb | 4 +--
.../ruby/shell/commands/restore_snapshot.rb | 4 +--
.../src/main/ruby/shell/commands/revoke.rb | 4 +--
.../src/main/ruby/shell/commands/scan.rb | 5 ++--
.../src/main/ruby/shell/commands/set_auths.rb | 4 +--
.../ruby/shell/commands/set_peer_tableCFs.rb | 4 +--
.../main/ruby/shell/commands/set_visibility.rb | 4 +--
.../main/ruby/shell/commands/show_filters.rb | 1 -
.../src/main/ruby/shell/commands/snapshot.rb | 4 +--
.../src/main/ruby/shell/commands/split.rb | 4 +--
.../ruby/shell/commands/splitormerge_enabled.rb | 8 +++---
.../ruby/shell/commands/splitormerge_switch.rb | 8 +++---
.../src/main/ruby/shell/commands/trace.rb | 4 +--
.../src/main/ruby/shell/commands/truncate.rb | 6 ++---
.../ruby/shell/commands/truncate_preserve.rb | 6 ++---
.../src/main/ruby/shell/commands/unassign.rb | 4 +--
.../ruby/shell/commands/update_all_config.rb | 4 +--
.../main/ruby/shell/commands/update_config.rb | 4 +--
.../ruby/shell/commands/update_peer_config.rb | 4 +--
.../main/ruby/shell/commands/user_permission.rb | 4 +--
.../src/main/ruby/shell/commands/wal_roll.rb | 5 ++--
hbase-shell/src/main/ruby/shell/formatter.rb | 11 +++-----
.../src/test/ruby/shell/formatter_test.rb | 2 +-
hbase-shell/src/test/ruby/shell/shell_test.rb | 12 ++++++---
hbase-shell/src/test/ruby/test_helper.rb | 2 +-
95 files changed, 177 insertions(+), 353 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell.rb b/hbase-shell/src/main/ruby/shell.rb
index fa1f8b8..35626d9 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -81,8 +81,9 @@ module Shell
self.interactive = interactive
end
- def hbase_admin
- @hbase_admin ||= hbase.admin()
+ # Returns Admin class from admin.rb
+ def admin
+ @admin ||= hbase.admin()
end
def hbase_taskmonitor
@@ -143,7 +144,7 @@ module Shell
# method_name - name of the method on the command to call. Defaults to just 'command'
# args - to be passed to the named method
def internal_command(command, method_name= :command, *args)
- command_instance(command).command_safe(self.debug,method_name, *args)
+ command_instance(command).command_safe(self.debug, method_name, *args)
end
def print_banner
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb
index b9446dd..f86904c 100644
--- a/hbase-shell/src/main/ruby/shell/commands.rb
+++ b/hbase-shell/src/main/ruby/shell/commands.rb
@@ -29,9 +29,12 @@ module Shell
# cmd - command name to execute
# args - arguments to pass to the command
def command_safe(debug, cmd = :command, *args)
+ # Commands can overwrite start_time to skip time used in some kind of setup.
+ # See count.rb for example.
+ @start_time = Time.now
# send is internal ruby method to call 'cmd' with *args
#(everything is a message, so this is just the formal semantics to support that idiom)
- translate_hbase_exceptions(*args) { send(cmd,*args) }
+ translate_hbase_exceptions(*args) { send(cmd, *args) }
rescue => e
rootCause = e
while rootCause != nil && rootCause.respond_to?(:cause) && rootCause.cause != nil
@@ -48,13 +51,16 @@ module Shell
else
raise rootCause
end
+ ensure
+ # If end_time is not already set by the command, use current time.
+ @end_time ||= Time.now
+ formatter.output_str("Took %.4f seconds" % [@end_time - @start_time])
end
# Convenience functions to get different admins
-
# Returns HBase::Admin ruby class.
def admin
- @shell.hbase_admin
+ @shell.admin
end
def taskmonitor
@@ -91,21 +97,6 @@ module Shell
@formatter ||= ::Shell::Formatter::Console.new
end
- def format_simple_command
- now = Time.now
- yield
- formatter.header
- formatter.footer(now)
- end
-
- def format_and_return_simple_command
- now = Time.now
- ret = yield
- formatter.header
- formatter.footer(now)
- return ret
- end
-
def translate_hbase_exceptions(*args)
yield
rescue => e
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb b/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
index 6f77ab7..e69e133 100644
--- a/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
@@ -40,11 +40,7 @@ EOF
end
def command(proc_id, may_interrupt_if_running=nil)
- format_simple_command do
- formatter.row([
- admin.abort_procedure?(proc_id, may_interrupt_if_running).to_s
- ])
- end
+ formatter.row([admin.abort_procedure?(proc_id, may_interrupt_if_running).to_s])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/add_labels.rb b/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
index 65a1140..7bde5fb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
@@ -31,9 +31,7 @@ EOF
end
def command(*args)
- format_simple_command do
- visibility_labels_admin.add_labels(args)
- end
+ visibility_labels_admin.add_labels(args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 498f79f..558e86d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
@@ -58,9 +58,7 @@ EOF
end
def command(id, args = {}, peer_tableCFs = nil)
- format_simple_command do
- replication_admin.add_peer(id, args, peer_tableCFs)
- end
+ replication_admin.add_peer(id, args, peer_tableCFs)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 2c3aa6f..91b3e2e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter.rb
@@ -92,9 +92,7 @@ EOF
end
def command(table, *args)
- format_simple_command do
- admin.alter(table, true, *args)
- end
+ admin.alter(table, true, *args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 bddff01..e0f6deb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
@@ -56,9 +56,7 @@ EOF
end
def command(table, *args)
- format_simple_command do
- admin.alter(table, false, *args)
- end
+ admin.alter(table, false, *args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 a16e10d..0051c7f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
@@ -35,9 +35,7 @@ EOF
end
def command(namespace, *args)
- format_simple_command do
- admin.alter_namespace(namespace, *args)
- end
+ admin.alter_namespace(namespace, *args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 a0ef36d..93a4317 100644
--- a/hbase-shell/src/main/ruby/shell/commands/append.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/append.rb
@@ -35,14 +35,14 @@ t to table 't1', the corresponding command would be:
EOF
end
- def command(table, row, column, value, args={})
- append(table(table), 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={})
- format_simple_command do
- table._append_internal(row, column, value, args)
- end
+ table._append_internal(row, column, value, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 753067a..fe34c5c 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
@@ -32,9 +32,7 @@ EOF
end
def command(id, table_cfs)
- format_simple_command do
- replication_admin.append_peer_tableCFs(id, table_cfs)
- end
+ replication_admin.append_peer_tableCFs(id, table_cfs)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 448a546..1220bf1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/assign.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/assign.rb
@@ -32,9 +32,7 @@ EOF
end
def command(region_name)
- format_simple_command do
- admin.assign(region_name)
- end
+ admin.assign(region_name)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 4d7778d..107d267 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
@@ -31,11 +31,7 @@ EOF
end
def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.balance_switch(enableDisable)? "true" : "false"
- ])
- end
+ formatter.row([admin.balance_switch(enableDisable)? "true" : "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 ee53ca0..a7490a5 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer.rb
@@ -38,15 +38,13 @@ EOF
end
def command(force=nil)
- format_simple_command do
- formatter.row([
- if force.nil?
- admin.balancer("false")? "true": "false"
- elsif force == "force"
- admin.balancer("true")? "true": "false"
- end
- ])
+ 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"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 3b2f5c6..6a75ab5 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
@@ -30,11 +30,7 @@ EOF
end
def command()
- format_simple_command do
- formatter.row([
- admin.balancer_enabled?.to_s
- ])
- end
+ formatter.row([admin.balancer_enabled?.to_s])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 b310c3a..fdeb67e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
@@ -29,11 +29,7 @@ EOF
end
def command()
- format_simple_command do
- formatter.row([
- admin.catalogjanitor_enabled()? "true" : "false"
- ])
- end
+ formatter.row([admin.catalogjanitor_enabled()? "true" : "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 03426cb..638a18f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
@@ -28,9 +28,7 @@ Catalog janitor command to run the (garbage collection) scan from command line.
EOF
end
def command()
- format_simple_command do
- admin.catalogjanitor_run()
- end
+ admin.catalogjanitor_run()
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 fce1925..d2d8e58 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
@@ -30,11 +30,7 @@ EOF
end
def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.catalogjanitor_switch(enableDisable)? "true" : "false"
- ])
- end
+ formatter.row([admin.catalogjanitor_switch(enableDisable)? "true" : "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 8553fa6..be56d5d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
@@ -31,9 +31,7 @@ EOF
end
def command(user, *args)
- format_simple_command do
- visibility_labels_admin.clear_auths(user, args)
- end
+ visibility_labels_admin.clear_auths(user, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 0498c8e..c57e87f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
@@ -32,9 +32,7 @@ EOF
end
def command(snapshot_name, table)
- format_simple_command do
- admin.clone_snapshot(snapshot_name, table)
- end
+ admin.clone_snapshot(snapshot_name, table)
end
def handle_exceptions(cause, *args)
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 ef1c99c..3d01911 100644
--- a/hbase-shell/src/main/ruby/shell/commands/close_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
@@ -51,9 +51,7 @@ EOF
end
def command(region_name, server = nil)
- format_simple_command do
- admin.close_region(region_name, server)
- end
+ admin.close_region(region_name, server)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 e267821..1607536 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact.rb
@@ -44,9 +44,7 @@ module Shell
end
def command(table_or_region_name, family = nil, type = "NORMAL")
- format_simple_command do
- admin.compact(table_or_region_name, family, type)
- end
+ admin.compact(table_or_region_name, family, type)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 0ecdd21..588b6fe 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
@@ -34,9 +34,7 @@ module Shell
end
def command(regionserver, major = false)
- format_simple_command do
- admin.compact_regionserver(regionserver, major)
- end
+ admin.compactRegionserver(regionserver, major)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 225005e..36250a6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/count.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/count.rb
@@ -61,12 +61,12 @@ EOF
}.merge(params)
# Call the counter method
- now = Time.now
+ @start_time = Time.now
formatter.header
count = table._count_internal(params['INTERVAL'].to_i, params['CACHE'].to_i) do |cnt, row|
formatter.row([ "Current count: #{cnt}, row: #{row}" ])
end
- formatter.footer(now, count)
+ formatter.footer(count)
return count
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 ab149bf..c237ca9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create.rb
@@ -62,10 +62,9 @@ EOF
end
def command(table, *args)
- format_simple_command do
- ret = admin.create(table, *args)
- end
- #and then return the table you just created
+ admin.create(table, *args)
+ @end_time = Time.now
+ #and then return the table just created
table(table)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 adb6897..d478fc1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
@@ -32,9 +32,7 @@ EOF
end
def command(namespace, *args)
- format_simple_command do
- admin.create_namespace(namespace, *args)
- end
+ admin.create_namespace(namespace, *args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 dcb8341..bce6625 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete.rb
@@ -40,16 +40,15 @@ t to table 't1', the corresponding command would be:
EOF
end
- def command(table, row, column,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
+ def command(table, row, column,
+ timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
delete(table(table), row, column, timestamp, args)
end
- def delete(table, row, column,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- format_simple_command do
- table._delete_internal(row, column, timestamp, args)
- end
+ def delete(table, row, column,
+ timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
+ @start_time = Time.now
+ table._delete_internal(row, column, timestamp, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 bc07259..5a77f73 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
@@ -41,9 +41,9 @@ EOF
answer = gets.chomp unless count == 0
puts "No snapshots matched the regex #{regex.to_s}" if count == 0
return unless answer =~ /y.*/i
- format_simple_command do
- admin.delete_all_snapshot(regex)
- end
+ @start_time = Time.now
+ admin.delete_all_snapshot(regex)
+ @end_time = Time.now
list = admin.list_snapshot(regex)
leftOverSnapshotCount = list.size
successfullyDeleted = count - leftOverSnapshotCount
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 b8c3791..48059b0 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
@@ -28,9 +28,7 @@ EOF
end
def command(snapshot_name)
- format_simple_command do
- admin.delete_snapshot(snapshot_name)
- end
+ admin.delete_snapshot(snapshot_name)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 dc4e0a2..89936f1 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
@@ -51,16 +51,15 @@ EOF
puts "No snapshots matched the table name regular expression #{tableNameregex.to_s} and the snapshot name regular expression #{snapshotNameRegex.to_s}" if count == 0
return unless answer =~ /y.*/i
- format_simple_command do
- list.each do |deleteSnapshot|
- begin
- admin.delete_snapshot(deleteSnapshot.getName)
- puts "Successfully deleted snapshot: #{deleteSnapshot.getName}"
- puts "\n"
- rescue RuntimeError
- puts "Failed to delete snapshot: #{deleteSnapshot.getName}, due to below exception,\n" + $!
- puts "\n"
- end
+ @start_time = Time.now
+ list.each do |deleteSnapshot|
+ begin
+ admin.delete_snapshot(deleteSnapshot.getName)
+ puts "Successfully deleted snapshot: #{deleteSnapshot.getName}"
+ puts "\n"
+ rescue RuntimeError
+ puts "Failed to delete snapshot: #{deleteSnapshot.getName}, due to below exception,\n" + $!
+ puts "\n"
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 e6118c9..2965403 100644
--- a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
@@ -48,9 +48,8 @@ EOF
def deleteall(table, row, column = nil,
timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- format_simple_command do
- table._deleteall_internal(row, column, timestamp, args)
- end
+ @start_time = Time.now
+ table._deleteall_internal(row, column, timestamp, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 bfa16cd..37938a7 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe.rb
@@ -33,8 +33,6 @@ EOF
end
def command(table)
- now = Time.now
-
column_families = admin.get_column_families(table)
formatter.header(["Table " + table.to_s + " is " + if admin.enabled?(table) then "ENABLED" else "DISABLED" end])
@@ -43,7 +41,7 @@ EOF
column_families.each do |column_family|
formatter.row([ column_family.to_s ], true)
end
- formatter.footer(now)
+ formatter.footer()
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 cf135da..ebd9bd2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
@@ -28,13 +28,10 @@ EOF
end
def command(namespace)
- now = Time.now
-
desc = admin.describe_namespace(namespace)
formatter.header([ "DESCRIPTION" ], [ 64 ])
formatter.row([ desc ], true, [ 64 ])
- formatter.footer(now)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 79bcd86..6695002 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable.rb
@@ -29,9 +29,7 @@ EOF
end
def command(table)
- format_simple_command do
- admin.disable(table)
- end
+ admin.disable(table)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 416545b..c193f13 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
@@ -32,9 +32,7 @@ EOF
end
def command(id)
- format_simple_command do
- replication_admin.disable_peer(id)
- end
+ replication_admin.disable_peer(id)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 5bf9667..a020d81 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
@@ -30,10 +30,8 @@ EOF
end
def command(table_name)
- format_simple_command do
- replication_admin.disable_tablerep(table_name)
- end
- puts "The replication swith of table '#{table_name}' successfully disabled"
+ replication_admin.disable_tablerep(table_name)
+ puts "Replication of table '#{table_name}' successfully disabled."
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 fc7b134..3f7332c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop.rb
@@ -29,9 +29,7 @@ EOF
end
def command(table)
- format_simple_command do
- admin.drop(table)
- end
+ admin.drop(table)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 b030d27..392f247 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
@@ -27,9 +27,7 @@ EOF
end
def command(namespace)
- format_simple_command do
- admin.drop_namespace(namespace)
- end
+ admin.drop_namespace(namespace)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 deeb70c..5d21219 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable.rb
@@ -29,9 +29,7 @@ EOF
end
def command(table)
- format_simple_command do
- admin.enable(table)
- end
+ admin.enable(table)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 55136ff..5f1a727 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
@@ -32,9 +32,7 @@ EOF
end
def command(id)
- format_simple_command do
- replication_admin.enable_peer(id)
- end
+ replication_admin.enable_peer(id)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 15e3133..e4e2fc1 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
@@ -30,10 +30,8 @@ EOF
end
def command(table_name)
- format_simple_command do
- replication_admin.enable_tablerep(table_name)
- end
- puts "The replication swith of table '#{table_name}' successfully enabled"
+ replication_admin.enable_tablerep(table_name)
+ puts "The replication of table '#{table_name}' successfully enabled"
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 bacf6c9..7a64813 100644
--- a/hbase-shell/src/main/ruby/shell/commands/exists.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/exists.rb
@@ -29,11 +29,9 @@ EOF
end
def command(table)
- format_simple_command do
- formatter.row([
+ formatter.row([
"Table #{table} " + (admin.exists?(table.to_s) ? "does exist" : "does not exist")
])
- end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 2aefec5..13963e1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/flush.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/flush.rb
@@ -32,9 +32,7 @@ EOF
end
def command(table_or_region_name)
- format_simple_command do
- admin.flush(table_or_region_name)
- end
+ admin.flush(table_or_region_name)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 b8bfd52..8191c22 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get.rb
@@ -81,14 +81,14 @@ EOF
end
def get(table, row, *args)
- now = Time.now
+ @start_time = Time.now
formatter.header(["COLUMN", "CELL"])
count, is_stale = table._get_internal(row, *args) do |column, value|
formatter.row([ column, value ])
end
- formatter.footer(now, count, is_stale)
+ formatter.footer(count, is_stale)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 1b758ef..04b486b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_auths.rb
@@ -31,11 +31,9 @@ EOF
end
def command(user)
- format_simple_command do
- list = visibility_labels_admin.get_auths(user)
- list.each do |auths|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(auths.toByteArray)])
- end
+ list = visibility_labels_admin.get_auths(user)
+ list.each do |auths|
+ formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(auths.toByteArray)])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 ee02229..3da6bdf 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
@@ -25,10 +25,9 @@ module Shell
end
def command(id)
- peer_config = replication_admin.get_peer_config(id)
- format_simple_command do
- format_peer_config(peer_config)
- end
+ peer_config = replication_admin.get_peer_config(id)
+ @start_time = Time.now
+ format_peer_config(peer_config)
end
def format_peer_config(peer_config)
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 43e7c1a..2270f43 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_table.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_table.rb
@@ -38,9 +38,7 @@ EOF
end
def command(table, *args)
- format_and_return_simple_command do
- table(table)
- end
+ table(table)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 a4e4547..d6f848b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/grant.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/grant.rb
@@ -74,9 +74,8 @@ EOF
end
end
end
- format_simple_command do
- security_admin.grant(user, permissions, table_name, family, qualifier)
- end
+ @start_time = Time.now
+ security_admin.grant(user, permissions, table_name, family, qualifier)
elsif args[1].kind_of?(Hash)
@@ -92,7 +91,7 @@ EOF
raise(ArgumentError, "Scanner specification is not a Hash") unless scan.kind_of?(Hash)
t = table(table_name)
- now = Time.now
+ @start_time = Time.now
scanner = t._get_scanner(scan)
count = 0
iter = scanner.iterator
@@ -106,7 +105,7 @@ EOF
end
count += 1
end
- formatter.footer(now, count)
+ formatter.footer(count)
else
raise(ArgumentError, "Second argument should be a String or Hash")
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 d223a45..318fac3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/incr.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/incr.rb
@@ -49,13 +49,11 @@ EOF
end
def incr(table, row, column, value = nil, args={})
- format_simple_command do
- if cnt = table._incr_internal(row, column, value, args)
- puts "COUNTER VALUE = #{cnt}"
- else
- puts "No counter found at specified coordinates"
- end
- end
+ if cnt = table._incr_internal(row, column, value, args)
+ puts "COUNTER VALUE = #{cnt}"
+ else
+ puts "No counter found at specified coordinates"
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 6da7046..6a914e3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
@@ -29,12 +29,8 @@ EOF
end
def command(table)
- format_simple_command do
- formatter.row([
- admin.disabled?(table)? "true" : "false"
- ])
- end
- end
+ formatter.row([admin.disabled?(table)? "true" : "false"])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 960ade7..d8fb2ab 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
@@ -29,11 +29,7 @@ EOF
end
def command(table)
- format_simple_command do
- formatter.row([
- admin.enabled?(table)? "true" : "false"
- ])
- end
+ formatter.row([admin.enabled?(table)? "true" : "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 dce0ae2..f7a0987 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list.rb
@@ -33,7 +33,6 @@ EOF
end
def command(regex = ".*")
- now = Time.now
formatter.header([ "TABLE" ])
list = admin.list(regex)
@@ -41,7 +40,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
return list
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 6c7f991..6b730b2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
@@ -32,11 +32,9 @@ EOF
end
def command(regex = ".*")
- format_simple_command do
- list = visibility_labels_admin.list_labels(regex)
- list.each do |label|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(label.toByteArray)])
- end
+ list = visibility_labels_admin.list_labels(regex)
+ list.each do |label|
+ formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(label.toByteArray)])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 5d25604..63aeac1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
@@ -31,7 +31,6 @@ EOF
end
def command(regex = ".*")
- now = Time.now
formatter.header([ "NAMESPACE" ])
list = admin.list_namespace(regex)
@@ -39,7 +38,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 29e1812..9db090e 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
@@ -30,7 +30,6 @@ EOF
end
def command(namespace)
- now = Time.now
formatter.header([ "TABLE" ])
list = admin.list_namespace_tables(namespace)
@@ -38,7 +37,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 fc6e4a7..153e0ce 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
@@ -25,16 +25,14 @@ module Shell
end
def command
- format_simple_command do
- peer_configs = replication_admin.list_peer_configs
- unless peer_configs.nil?
- peer_configs.each do |peer_config_entry|
- peer_id = peer_config_entry[0]
- peer_config = peer_config_entry[1]
- formatter.row(["PeerId", peer_id])
- GetPeerConfig.new(@shell).format_peer_config(peer_config)
- formatter.row([" "])
- end
+ peer_configs = replication_admin.list_peer_configs
+ unless peer_configs.nil?
+ peer_configs.each do |peer_config_entry|
+ peer_id = peer_config_entry[0]
+ peer_config = peer_config_entry[1]
+ formatter.row(["PeerId", peer_id])
+ GetPeerConfig.new(@shell).format_peer_config(peer_config)
+ formatter.row([" "])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 cc1be04..c5c3397 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
@@ -30,7 +30,6 @@ EOF
end
def command()
- now = Time.now
peers = replication_admin.list_peers
formatter.header(["PEER_ID", "CLUSTER_KEY", "STATE", "TABLE_CFS"])
@@ -41,7 +40,7 @@ EOF
formatter.row([ e.key, e.value, state, tableCFs ])
end
- formatter.footer(now)
+ formatter.footer()
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 f407547..83e08c1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
@@ -29,7 +29,6 @@ EOF
end
def command()
- now = Time.now
formatter.header([ "Id", "Name", "State", "Start_Time", "Last_Update" ])
list = admin.list_procedures()
@@ -39,7 +38,7 @@ EOF
formatter.row([ proc.getProcId, proc.getProcName, proc.getProcState, start_time, last_update ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/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 682bb71..604d833 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
@@ -37,7 +37,6 @@ EOF
end
def command(args = {})
- now = Time.now
formatter.header(["OWNER", "QUOTAS"])
#actually do the scanning
@@ -45,7 +44,7 @@ EOF
formatter.row([ row, cells ])
end
- formatter.footer(now, count)
+ formatter.footer(count)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/list_replicated_tables.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_replicated_tables.rb b/hbase-shell/src/main/ruby/shell/commands/list_replicated_tables.rb
index 0db1d83..142adfc 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_replicated_tables.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_replicated_tables.rb
@@ -31,8 +31,6 @@ EOF
end
def command(regex = ".*")
- now = Time.now
-
formatter.header([ "TABLE:COLUMNFAMILY", "ReplicationType" ], [ 32 ])
list = replication_admin.list_replicated_tables(regex)
list.each do |e|
@@ -43,7 +41,7 @@ EOF
end
formatter.row([e.get(org.apache.hadoop.hbase.client.replication.ReplicationAdmin::TNAME) + ":" + e.get(org.apache.hadoop.hbase.client.replication.ReplicationAdmin::CFNAME), replicateType], true, [32])
end
- formatter.footer(now)
+ formatter.footer()
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb b/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
index 4e68802..bc91737 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
@@ -34,7 +34,6 @@ EOF
end
def command(regex = ".*")
- now = Time.now
formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
list = admin.list_snapshot(regex)
@@ -43,7 +42,7 @@ EOF
formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
return list.map { |s| s.getName() }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/list_table_snapshots.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_table_snapshots.rb b/hbase-shell/src/main/ruby/shell/commands/list_table_snapshots.rb
index 3a32e9e..1efcc17 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_table_snapshots.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_table_snapshots.rb
@@ -39,7 +39,6 @@ EOF
end
def command(tableNameRegex, snapshotNameRegex = ".*")
- now = Time.now
formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
list = admin.list_table_snapshots(tableNameRegex, snapshotNameRegex)
@@ -48,7 +47,7 @@ EOF
formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
end
- formatter.footer(now, list.size)
+ formatter.footer(list.size)
return list.map { |s| s.getName() }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/locate_region.rb b/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
index b1e8c7b..a2815d6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
@@ -30,14 +30,12 @@ EOF
end
def command(table, row_key)
- now = Time.now
-
region_location = admin.locate_region(table, row_key)
hri = region_location.getRegionInfo()
formatter.header([ "HOST", "REGION" ])
formatter.row([region_location.getHostnamePort(), hri.toString()])
- formatter.footer(now, 1)
+ formatter.footer(1)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/major_compact.rb b/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
index 5efd895..1af6c64 100644
--- a/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
@@ -44,9 +44,7 @@ module Shell
end
def command(table_or_region_name, family = nil, type = "NORMAL")
- format_simple_command do
- admin.major_compact(table_or_region_name, family, type)
- end
+ admin.majorCompact(table_or_region_name, family, type)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/merge_region.rb b/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
index 6afa2e5..63f7159 100644
--- a/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
@@ -40,9 +40,7 @@ EOF
end
def command(encoded_region_a_name, encoded_region_b_name, force = 'false')
- format_simple_command do
- admin.merge_region(encoded_region_a_name, encoded_region_b_name, force)
- end
+ admin.merge_region(encoded_region_a_name, encoded_region_b_name, force)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/move.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/move.rb b/hbase-shell/src/main/ruby/shell/commands/move.rb
index e6b2828..24816f3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/move.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/move.rb
@@ -38,9 +38,7 @@ EOF
end
def command(encoded_region_name, server_name = nil)
- format_simple_command do
- admin.move(encoded_region_name, server_name)
- end
+ admin.move(encoded_region_name, server_name)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/normalize.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/normalize.rb b/hbase-shell/src/main/ruby/shell/commands/normalize.rb
index 7e6302c..0a61227 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalize.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalize.rb
@@ -33,11 +33,7 @@ EOF
end
def command()
- format_simple_command do
- formatter.row([
- admin.normalize()? "true": "false"
- ])
- end
+ formatter.row([admin.normalize()? "true": "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
index 1121b25..d39b777 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
@@ -30,11 +30,7 @@ EOF
end
def command()
- format_simple_command do
- formatter.row([
- admin.normalizer_enabled?.to_s
- ])
- end
+ formatter.row([admin.normalizer_enabled?.to_s])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb b/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
index 6d959c4..7a12b71 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
@@ -32,11 +32,7 @@ EOF
end
def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.normalizer_switch(enableDisable)? "true" : "false"
- ])
- end
+ formatter.row([admin.normalizer_switch(enableDisable)? "true" : "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/put.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/put.rb b/hbase-shell/src/main/ruby/shell/commands/put.rb
index 2b47a4d..39f9fea 100644
--- a/hbase-shell/src/main/ruby/shell/commands/put.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/put.rb
@@ -45,9 +45,8 @@ EOF
end
def put(table, row, column, value, timestamp = nil, args = {})
- format_simple_command do
- table._put_internal(row, column, value, timestamp, args)
- end
+ @start_time = Time.now
+ table._put_internal(row, column, value, timestamp, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb b/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
index 5ae5786..bc9d6ab 100644
--- a/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
@@ -30,9 +30,7 @@ EOF
end
def command(id)
- format_simple_command do
- replication_admin.remove_peer(id)
- end
+ replication_admin.remove_peer(id)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/remove_peer_tableCFs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/remove_peer_tableCFs.rb b/hbase-shell/src/main/ruby/shell/commands/remove_peer_tableCFs.rb
index 70bc9b5..adfb85d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/remove_peer_tableCFs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/remove_peer_tableCFs.rb
@@ -33,9 +33,7 @@ EOF
end
def command(id, table_cfs)
- format_simple_command do
- replication_admin.remove_peer_tableCFs(id, table_cfs)
- end
+ replication_admin.remove_peer_tableCFs(id, table_cfs)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
index 4d53171..2471e1b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
@@ -32,9 +32,7 @@ EOF
end
def command(snapshot_name)
- format_simple_command do
- admin.restore_snapshot(snapshot_name)
- end
+ admin.restore_snapshot(snapshot_name)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/revoke.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/revoke.rb b/hbase-shell/src/main/ruby/shell/commands/revoke.rb
index 4a0d5ff..bcf60e9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/revoke.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/revoke.rb
@@ -39,9 +39,7 @@ EOF
end
def command(user, table_name=nil, family=nil, qualifier=nil)
- format_simple_command do
- security_admin.revoke(user, table_name, family, qualifier)
- end
+ security_admin.revoke(user, table_name, family, qualifier)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/scan.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/scan.rb b/hbase-shell/src/main/ruby/shell/commands/scan.rb
index 381acef..b3cc5c8 100644
--- a/hbase-shell/src/main/ruby/shell/commands/scan.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb
@@ -104,16 +104,17 @@ EOF
#internal command that actually does the scanning
def scan(table, args = {})
- now = Time.now
formatter.header(["ROW", "COLUMN+CELL"])
scan = table._hash_to_scan(args)
#actually do the scanning
+ @start_time = Time.now
count, is_stale = table._scan_internal(args, scan) do |row, cells|
formatter.row([ row, cells ])
end
+ @end_time = Time.now
- formatter.footer(now, count, is_stale)
+ formatter.footer(count, is_stale)
# if scan metrics were enabled, print them after the results
if (scan != nil && scan.isScanMetricsEnabled())
formatter.scan_metrics(scan.getScanMetrics(), args["METRICS"])
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/set_auths.rb b/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
index 4a52eb0..5663ec3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
@@ -31,9 +31,7 @@ EOF
end
def command(user, *args)
- format_simple_command do
- visibility_labels_admin.set_auths(user, args)
- end
+ visibility_labels_admin.set_auths(user, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/set_peer_tableCFs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/set_peer_tableCFs.rb b/hbase-shell/src/main/ruby/shell/commands/set_peer_tableCFs.rb
index fb7fae5..b2e823c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/set_peer_tableCFs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/set_peer_tableCFs.rb
@@ -41,9 +41,7 @@ module Shell
end
def command(id, peer_table_cfs = nil)
- format_simple_command do
- replication_admin.set_peer_tableCFs(id, peer_table_cfs)
- end
+ replication_admin.set_peer_tableCFs(id, peer_table_cfs)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/set_visibility.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/set_visibility.rb b/hbase-shell/src/main/ruby/shell/commands/set_visibility.rb
index 2c77d8b..058ccf2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/set_visibility.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/set_visibility.rb
@@ -51,7 +51,7 @@ EOF
def command(table, visibility, scan)
t = table(table)
- now = Time.now
+ @start_time = Time.now
scanner = t._get_scanner(scan)
count = 0
iter = scanner.iterator
@@ -65,7 +65,7 @@ EOF
end
count += 1
end
- formatter.footer(now, count)
+ formatter.footer(count)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/show_filters.rb b/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
index cdbd9ed..5ff0be4 100644
--- a/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
@@ -36,7 +36,6 @@ EOF
end
def command( )
- now = Time.now
parseFilter = ParseFilter.new
supportedFilters = parseFilter.getSupportedFilters
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/snapshot.rb b/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
index 15bf298..fd37d07 100644
--- a/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
@@ -29,9 +29,7 @@ EOF
end
def command(table, snapshot_name, *args)
- format_simple_command do
- admin.snapshot(table, snapshot_name, *args)
- end
+ admin.snapshot(table, snapshot_name, *args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/split.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/split.rb b/hbase-shell/src/main/ruby/shell/commands/split.rb
index 9dc424f..9e6ec6a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/split.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/split.rb
@@ -34,9 +34,7 @@ EOF
end
def command(table_or_region_name, split_point = nil)
- format_simple_command do
- admin.split(table_or_region_name, split_point)
- end
+ admin.split(table_or_region_name, split_point)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb b/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
index 7da7564..5a13871 100644
--- a/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
@@ -30,11 +30,9 @@ EOF
end
def command(switch_type)
- format_simple_command do
- formatter.row(
- [admin.splitormerge_enabled(switch_type) ? 'true' : 'false']
- )
- end
+ formatter.row(
+ [admin.splitormerge_enabled(switch_type) ? 'true' : 'false']
+ )
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb b/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
index f4c2858..73dc82d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
@@ -32,11 +32,9 @@ EOF
end
def command(switch_type, enabled)
- format_simple_command do
- formatter.row(
- [admin.splitormerge_switch(switch_type, enabled) ? 'true' : 'false']
- )
- end
+ formatter.row(
+ [admin.splitormerge_switch(switch_type, enabled) ? 'true' : 'false']
+ )
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/trace.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/trace.rb b/hbase-shell/src/main/ruby/shell/commands/trace.rb
index 5e00930..d838979 100644
--- a/hbase-shell/src/main/ruby/shell/commands/trace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/trace.rb
@@ -48,9 +48,7 @@ EOF
end
def command(startstop="status", spanname="HBaseShell")
- format_and_return_simple_command do
- trace(startstop, spanname)
- end
+ trace(startstop, spanname)
end
def trace(startstop, spanname)
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/truncate.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/truncate.rb b/hbase-shell/src/main/ruby/shell/commands/truncate.rb
index b7812fb..3f888c6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/truncate.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/truncate.rb
@@ -27,10 +27,8 @@ EOF
end
def command(table)
- format_simple_command do
- puts "Truncating '#{table}' table (it may take a while):"
- admin.truncate(table) { |log| puts " - #{log}" }
- end
+ puts "Truncating '#{table}' table (it may take a while):"
+ admin.truncate(table) { |log| puts " - #{log}" }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb b/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
index 918b232..fcce5e5 100644
--- a/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
@@ -27,10 +27,8 @@ EOF
end
def command(table)
- format_simple_command do
- puts "Truncating '#{table}' table (it may take a while):"
- admin.truncate_preserve(table) { |log| puts " - #{log}" }
- end
+ puts "Truncating '#{table}' table (it may take a while):"
+ admin.truncate_preserve(table) { |log| puts " - #{log}" }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/unassign.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/unassign.rb b/hbase-shell/src/main/ruby/shell/commands/unassign.rb
index 5eea71f..b69971f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/unassign.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/unassign.rb
@@ -36,9 +36,7 @@ EOF
end
def command(region_name, force = 'false')
- format_simple_command do
- admin.unassign(region_name, force)
- end
+ admin.unassign(region_name, force)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/update_all_config.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/update_all_config.rb b/hbase-shell/src/main/ruby/shell/commands/update_all_config.rb
index 05295b7..cb6852f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/update_all_config.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/update_all_config.rb
@@ -30,9 +30,7 @@ EOF
end
def command()
- format_simple_command do
- admin.update_all_config()
- end
+ admin.update_all_config()
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/update_config.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/update_config.rb b/hbase-shell/src/main/ruby/shell/commands/update_config.rb
index 9f65fdd..3617bb3 100644
--- a/hbase-shell/src/main/ruby/shell/commands/update_config.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/update_config.rb
@@ -31,9 +31,7 @@ EOF
end
def command(serverName)
- format_simple_command do
- admin.update_config(serverName)
- end
+ admin.update_config(serverName)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/update_peer_config.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/update_peer_config.rb b/hbase-shell/src/main/ruby/shell/commands/update_peer_config.rb
index 5d721fd..c09acc2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/update_peer_config.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/update_peer_config.rb
@@ -40,9 +40,7 @@ To update TABLE_CFs, see the append_peer_tableCFs and remove_peer_tableCFs comma
end
def command(id, args = {})
- format_simple_command do
- replication_admin.update_peer_config(id, args)
- end
+ replication_admin.update_peer_config(id, args)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/user_permission.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/user_permission.rb b/hbase-shell/src/main/ruby/shell/commands/user_permission.rb
index 71b98f3..4b5d3ff 100644
--- a/hbase-shell/src/main/ruby/shell/commands/user_permission.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/user_permission.rb
@@ -40,16 +40,14 @@ EOF
end
def command(table_regex=nil)
- #format_simple_command do
#admin.user_permission(table_regex)
- now = Time.now
formatter.header(["User", "Namespace,Table,Family,Qualifier:Permission"])
count = security_admin.user_permission(table_regex) do |user, permission|
formatter.row([ user, permission])
end
- formatter.footer(now, count)
+ formatter.footer(count)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/commands/wal_roll.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/wal_roll.rb b/hbase-shell/src/main/ruby/shell/commands/wal_roll.rb
index 0fe1870..a94e9e1 100644
--- a/hbase-shell/src/main/ruby/shell/commands/wal_roll.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/wal_roll.rb
@@ -30,11 +30,10 @@ EOF
end
def command(server_name)
- format_simple_command do
- admin.wal_roll(server_name)
- end
+ admin.wal_roll(server_name)
end
end
+
#TODO remove old HLog version
class HlogRoll < WalRoll
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/main/ruby/shell/formatter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/formatter.rb b/hbase-shell/src/main/ruby/shell/formatter.rb
index 6e598fb..2f800f6 100644
--- a/hbase-shell/src/main/ruby/shell/formatter.rb
+++ b/hbase-shell/src/main/ruby/shell/formatter.rb
@@ -64,7 +64,7 @@ module Shell
# Print a string
if args.is_a?(String)
- output(args)
+ output_str(args)
@out.puts
return
end
@@ -162,7 +162,7 @@ module Shell
return str
end
- def output(str)
+ def output_str(str)
output(@max_width, str)
end
@@ -177,15 +177,12 @@ module Shell
end
end
- def footer(start_time = nil, row_count = nil, is_stale = false)
- return unless start_time
+ def footer(row_count = nil, is_stale = false)
row_count ||= @row_count
# Only output elapsed time and row count if startTime passed
- @out.print("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ @out.puts("%d row(s)" % [row_count])
if is_stale == true
@out.puts(" (possible stale results) ")
- else
- @out.puts("")
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/test/ruby/shell/formatter_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/shell/formatter_test.rb b/hbase-shell/src/test/ruby/shell/formatter_test.rb
index 7010479..540dd09 100644
--- a/hbase-shell/src/test/ruby/shell/formatter_test.rb
+++ b/hbase-shell/src/test/ruby/shell/formatter_test.rb
@@ -63,6 +63,6 @@ class ShellFormatterTest < Test::Unit::TestCase
end
define_test "Froematter#footer should work" do
- formatter.footer(Time.now - 5)
+ formatter.footer()
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/test/ruby/shell/shell_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/shell/shell_test.rb b/hbase-shell/src/test/ruby/shell/shell_test.rb
index f37f60c..ab150a5 100644
--- a/hbase-shell/src/test/ruby/shell/shell_test.rb
+++ b/hbase-shell/src/test/ruby/shell/shell_test.rb
@@ -26,12 +26,12 @@ class ShellTest < Test::Unit::TestCase
@shell = Shell::Shell.new(@hbase)
end
- define_test "Shell::Shell#hbase_admin should return an admin instance" do
- assert_kind_of(Hbase::Admin, @shell.hbase_admin)
+ define_test "Shell::Shell#admin should return an admin instance" do
+ assert_kind_of(Hbase::Admin, @shell.admin)
end
- define_test "Shell::Shell#hbase_admin should cache admin instances" do
- assert_same(@shell.hbase_admin, @shell.hbase_admin)
+ define_test "Shell::Shell#admin should cache admin instances" do
+ assert_same(@shell.admin, @shell.admin)
end
#-------------------------------------------------------------------------------
@@ -44,6 +44,10 @@ class ShellTest < Test::Unit::TestCase
assert_not_same(@shell.hbase_table('hbase:meta'), @shell.hbase_table('hbase:meta'))
end
+ define_test "Shell::Shell#hbase attribute is a HBase instance" do
+ assert_kind_of(Hbase::Hbase, @shell.hbase)
+ end
+
#-------------------------------------------------------------------------------
define_test "Shell::Shell#export_commands should export command methods to specified object" do
http://git-wip-us.apache.org/repos/asf/hbase/blob/70762faa/hbase-shell/src/test/ruby/test_helper.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/test_helper.rb b/hbase-shell/src/test/ruby/test_helper.rb
index 11645d5..0b3c420 100644
--- a/hbase-shell/src/test/ruby/test_helper.rb
+++ b/hbase-shell/src/test/ruby/test_helper.rb
@@ -55,7 +55,7 @@ module Hbase
end
def admin
- @shell.hbase_admin
+ @shell.admin
end
def taskmonitor