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/29 00:58:41 UTC
[2/2] hbase git commit: Revert HBASE-15965 and HBASE-15849. While
it's fine to introduce these format changes in minor version,
reverting it from branch-1 after discussion on HBASE-16044.
Revert HBASE-15965 and HBASE-15849.
While it's fine to introduce these format changes in minor version, reverting it from branch-1 after discussion on HBASE-16044.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f4038735
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f4038735
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f4038735
Branch: refs/heads/apache-1
Commit: f40387351be0e269c832e03a248d3bf715fc772f
Parents: 7a78d87
Author: Apekshit Sharma <ap...@apache.org>
Authored: Tue Jun 28 17:30:23 2016 -0700
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Tue Jun 28 17:57:17 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/hbase/admin.rb | 40 ++--
hbase-shell/src/main/ruby/hbase/table.rb | 1 -
hbase-shell/src/main/ruby/shell.rb | 19 +-
hbase-shell/src/main/ruby/shell/commands.rb | 29 ++-
.../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 | 9 +-
.../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 | 8 +-
.../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 | 9 +-
.../main/ruby/shell/commands/get_peer_config.rb | 8 +-
.../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 | 8 +-
.../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 | 4 +-
.../ruby/shell/commands/list_peer_configs.rb | 19 +-
.../src/main/ruby/shell/commands/list_peers.rb | 4 +-
.../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 | 5 +-
.../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 +
.../ruby/shell/commands/show_peer_tableCFs.rb | 4 +-
.../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 | 5 +-
.../ruby/shell/commands/truncate_preserve.rb | 5 +-
.../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 +-
.../hbase/client/TestReplicationShell.java | 2 +-
hbase-shell/src/test/ruby/hbase/admin_test.rb | 221 ++++++++++---------
.../test/ruby/hbase/replication_admin_test.rb | 120 +++++-----
.../ruby/hbase/visibility_labels_admin_test.rb | 20 +-
.../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 | 25 +--
102 files changed, 564 insertions(+), 423 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index db2edd1..21e0652 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -423,26 +423,25 @@ module Hbase
#----------------------------------------------------------------------------------------------
# Truncates table (deletes all records by recreating the table)
- def truncate(table_name_str)
- puts "Truncating '#{table_name_str}' table (it may take a while):"
- table_name = TableName.valueOf(table_name_str)
- table_description = @admin.getTableDescriptor(table_name)
+ def truncate(table_name, conf = @conf)
+ table_description = @admin.getTableDescriptor(TableName.valueOf(table_name))
raise ArgumentError, "Table #{table_name} is not enabled. Enable it first." unless enabled?(table_name)
- puts 'Disabling table...'
+ yield 'Disabling table...' if block_given?
@admin.disableTable(table_name)
+
begin
- puts 'Truncating table...'
- @admin.truncateTable(table_name, false)
+ yield 'Truncating table...' if block_given?
+ @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), false)
rescue => e
# Handle the compatibility case, where the truncate method doesn't exists on the Master
raise e unless e.respond_to?(:cause) && e.cause != nil
rootCause = e.cause
if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then
# Handle the compatibility case, where the truncate method doesn't exists on the Master
- puts 'Dropping table...'
- @admin.deleteTable(table_name)
+ yield 'Dropping table...' if block_given?
+ @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name))
- puts 'Creating table...'
+ yield 'Creating table...' if block_given?
@admin.createTable(table_description)
else
raise e
@@ -452,10 +451,9 @@ module Hbase
#----------------------------------------------------------------------------------------------
# Truncates table while maintaing region boundaries (deletes all records by recreating the table)
- def truncate_preserve(table_name_str)
- puts "Truncating '#{table_name_str}' table (it may take a while):"
- table_name = TableName.valueOf(table_name_str)
- locator = @connection.getRegionLocator(table_name)
+ def truncate_preserve(table_name, conf = @conf)
+ h_table = @connection.getTable(TableName.valueOf(table_name))
+ locator = @connection.getRegionLocator(TableName.valueOf(table_name))
begin
splits = locator.getAllRegionLocations().
map{|i| Bytes.toString(i.getRegionInfo().getStartKey)}.
@@ -464,23 +462,23 @@ module Hbase
locator.close()
end
- table_description = @admin.getTableDescriptor(table_name)
- puts 'Disabling table...'
+ table_description = @admin.getTableDescriptor(TableName.valueOf(table_name))
+ yield 'Disabling table...' if block_given?
disable(table_name)
begin
- puts 'Truncating table...'
- @admin.truncateTable(table_name, true)
+ yield 'Truncating table...' if block_given?
+ @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), true)
rescue => e
# Handle the compatibility case, where the truncate method doesn't exists on the Master
raise e unless e.respond_to?(:cause) && e.cause != nil
rootCause = e.cause
if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then
# Handle the compatibility case, where the truncate method doesn't exists on the Master
- puts 'Dropping table...'
- @admin.deleteTable(table_name)
+ yield 'Dropping table...' if block_given?
+ @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name))
- puts 'Creating table with region boundaries...'
+ yield 'Creating table with region boundaries...' if block_given?
@admin.createTable(table_description, splits)
else
raise e
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 8ea1706..7c47dc4 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -710,7 +710,6 @@ EOF
map{|i| Bytes.toStringBinary(i.getRegionInfo().getStartKey)}.delete_if{|k| k == ""}
locator.close()
puts("Total number of splits = %s" % [splits.size + 1])
- puts splits
return splits
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 415e989..a39b617 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -81,9 +81,8 @@ module Shell
self.interactive = interactive
end
- # Returns Admin class from admin.rb
- def admin
- @admin ||= hbase.admin()
+ def hbase_admin
+ @hbase_admin ||= hbase.admin()
end
def hbase_taskmonitor
@@ -130,17 +129,9 @@ module Shell
::Shell.commands[command.to_s].new(self)
end
- # call the method 'command' on the specified command
- # If interactive is enabled, then we suppress the return value. The command should have
- # printed relevant output.
- # Return value is only useful in non-interactive mode, for e.g. tests.
+ #call the method 'command' on the specified command
def command(command, *args)
- ret = internal_command(command, :command, *args)
- if self.interactive
- return nil
- else
- return ret
- end
+ internal_command(command, :command, *args)
end
# call a specific internal method in the command instance
@@ -148,7 +139,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/f4038735/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 e4c029e..d580f5e 100644
--- a/hbase-shell/src/main/ruby/shell/commands.rb
+++ b/hbase-shell/src/main/ruby/shell/commands.rb
@@ -17,8 +17,6 @@
# limitations under the License.
#
-require 'shell/formatter'
-
module Shell
module Commands
class Command
@@ -31,12 +29,9 @@ 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
@@ -53,16 +48,13 @@ 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.admin
+ @shell.hbase_admin
end
def taskmonitor
@@ -95,6 +87,21 @@ 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/f4038735/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 e69e133..6f77ab7 100644
--- a/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/abort_procedure.rb
@@ -40,7 +40,11 @@ EOF
end
def command(proc_id, may_interrupt_if_running=nil)
- formatter.row([admin.abort_procedure?(proc_id, may_interrupt_if_running).to_s])
+ format_simple_command do
+ formatter.row([
+ admin.abort_procedure?(proc_id, may_interrupt_if_running).to_s
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 7bde5fb..65a1140 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_labels.rb
@@ -31,7 +31,9 @@ EOF
end
def command(*args)
- visibility_labels_admin.add_labels(args)
+ format_simple_command do
+ visibility_labels_admin.add_labels(args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 b8e8bb2..0fcdd3d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
@@ -58,7 +58,9 @@ EOF
end
def command(id, args = {}, peer_tableCFs = nil)
- replication_admin.add_peer(id, args, peer_tableCFs)
+ format_simple_command do
+ replication_admin.add_peer(id, args, peer_tableCFs)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 91b3e2e..2c3aa6f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter.rb
@@ -92,7 +92,9 @@ EOF
end
def command(table, *args)
- admin.alter(table, true, *args)
+ format_simple_command do
+ admin.alter(table, true, *args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 e0f6deb..bddff01 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_async.rb
@@ -56,7 +56,9 @@ EOF
end
def command(table, *args)
- admin.alter(table, false, *args)
+ format_simple_command do
+ admin.alter(table, false, *args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..a16e10d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/alter_namespace.rb
@@ -35,7 +35,9 @@ EOF
end
def command(namespace, *args)
- admin.alter_namespace(namespace, *args)
+ format_simple_command do
+ admin.alter_namespace(namespace, *args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 93a4317..a0ef36d 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_name, row, column, value, args={})
- table = table(table_name)
- @start_time = Time.now
- append(table, row, column, value, args)
+ def command(table, row, column, value, args={})
+ append(table(table), row, column, value, args)
end
def append(table, row, column, value, args={})
- table._append_internal(row, column, value, args)
+ format_simple_command do
+ table._append_internal(row, column, value, args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 3fe5bef..3919b20 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,7 +32,9 @@ EOF
end
def command(id, table_cfs)
- replication_admin.append_peer_tableCFs(id, table_cfs)
+ format_simple_command do
+ replication_admin.append_peer_tableCFs(id, table_cfs)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..448a546 100644
--- a/hbase-shell/src/main/ruby/shell/commands/assign.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/assign.rb
@@ -32,7 +32,9 @@ EOF
end
def command(region_name)
- admin.assign(region_name)
+ format_simple_command do
+ admin.assign(region_name)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 107d267..4d7778d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balance_switch.rb
@@ -31,7 +31,11 @@ EOF
end
def command(enableDisable)
- formatter.row([admin.balance_switch(enableDisable)? "true" : "false"])
+ format_simple_command do
+ formatter.row([
+ admin.balance_switch(enableDisable)? "true" : "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..ee53ca0 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer.rb
@@ -38,13 +38,15 @@ EOF
end
def command(force=nil)
- force_balancer = 'false'
- if force == 'force'
- force_balancer = 'true'
- elsif !force.nil?
- raise ArgumentError, "Invalid argument #{force}."
+ format_simple_command do
+ formatter.row([
+ if force.nil?
+ admin.balancer("false")? "true": "false"
+ elsif force == "force"
+ admin.balancer("true")? "true": "false"
+ end
+ ])
end
- formatter.row([admin.balancer(force_balancer)? "true": "false"])
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 6a75ab5..3b2f5c6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/balancer_enabled.rb
@@ -30,7 +30,11 @@ EOF
end
def command()
- formatter.row([admin.balancer_enabled?.to_s])
+ format_simple_command do
+ formatter.row([
+ admin.balancer_enabled?.to_s
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..b310c3a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
@@ -29,7 +29,11 @@ EOF
end
def command()
- formatter.row([admin.catalogjanitor_enabled()? "true" : "false"])
+ format_simple_command do
+ formatter.row([
+ admin.catalogjanitor_enabled()? "true" : "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..03426cb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_run.rb
@@ -28,7 +28,9 @@ Catalog janitor command to run the (garbage collection) scan from command line.
EOF
end
def command()
- admin.catalogjanitor_run()
+ format_simple_command do
+ admin.catalogjanitor_run()
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..fce1925 100644
--- a/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/catalogjanitor_switch.rb
@@ -30,7 +30,11 @@ EOF
end
def command(enableDisable)
- formatter.row([admin.catalogjanitor_switch(enableDisable)? "true" : "false"])
+ format_simple_command do
+ formatter.row([
+ admin.catalogjanitor_switch(enableDisable)? "true" : "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..8553fa6 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clear_auths.rb
@@ -31,7 +31,9 @@ EOF
end
def command(user, *args)
- visibility_labels_admin.clear_auths(user, args)
+ format_simple_command do
+ visibility_labels_admin.clear_auths(user, args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 c57e87f..0498c8e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/clone_snapshot.rb
@@ -32,7 +32,9 @@ EOF
end
def command(snapshot_name, table)
- admin.clone_snapshot(snapshot_name, table)
+ format_simple_command do
+ admin.clone_snapshot(snapshot_name, table)
+ end
end
def handle_exceptions(cause, *args)
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 368a250..9e2900c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/close_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/close_region.rb
@@ -52,7 +52,9 @@ EOF
end
def command(region_name, server = nil)
- admin.close_region(region_name, server)
+ format_simple_command do
+ admin.close_region(region_name, server)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 d59e3b3..adeffa2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact.rb
@@ -39,7 +39,9 @@ module Shell
end
def command(table_or_region_name, family = nil)
- admin.compact(table_or_region_name, family)
+ format_simple_command do
+ admin.compact(table_or_region_name, family)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 588b6fe..0ecdd21 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compact_rs.rb
@@ -34,7 +34,9 @@ module Shell
end
def command(regionserver, major = false)
- admin.compactRegionserver(regionserver, major)
+ format_simple_command do
+ admin.compact_regionserver(regionserver, major)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 36250a6..225005e 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
- @start_time = Time.now
+ now = 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(count)
+ formatter.footer(now, count)
return count
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 7857c2d..a5a125e 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create.rb
@@ -62,11 +62,10 @@ EOF
end
def command(table, *args)
- admin.create(table, *args)
- @end_time = Time.now
- puts "Created table " + table.to_s
-
- #and then return the table just created
+ format_simple_command do
+ ret = admin.create(table, *args)
+ end
+ #and then return the table you just created
table(table)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..adb6897 100644
--- a/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/create_namespace.rb
@@ -32,7 +32,9 @@ EOF
end
def command(namespace, *args)
- admin.create_namespace(namespace, *args)
+ format_simple_command do
+ admin.create_namespace(namespace, *args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..dcb8341 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete.rb
@@ -40,15 +40,16 @@ 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 = {})
- @start_time = Time.now
- table._delete_internal(row, column, timestamp, args)
+ 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
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..bc07259 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
- @start_time = Time.now
- admin.delete_all_snapshot(regex)
- @end_time = Time.now
+ format_simple_command do
+ admin.delete_all_snapshot(regex)
+ end
list = admin.list_snapshot(regex)
leftOverSnapshotCount = list.size
successfullyDeleted = count - leftOverSnapshotCount
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..b8c3791 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete_snapshot.rb
@@ -28,7 +28,9 @@ EOF
end
def command(snapshot_name)
- admin.delete_snapshot(snapshot_name)
+ format_simple_command do
+ admin.delete_snapshot(snapshot_name)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..dc4e0a2 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,15 +51,16 @@ 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
- @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"
+ 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
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 2965403..e6118c9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
@@ -48,8 +48,9 @@ EOF
def deleteall(table, row, column = nil,
timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- @start_time = Time.now
- table._deleteall_internal(row, column, timestamp, args)
+ format_simple_command do
+ table._deleteall_internal(row, column, timestamp, args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..bfa16cd 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe.rb
@@ -33,6 +33,8 @@ 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])
@@ -41,7 +43,7 @@ EOF
column_families.each do |column_family|
formatter.row([ column_family.to_s ], true)
end
- formatter.footer()
+ formatter.footer(now)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..cf135da 100644
--- a/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/describe_namespace.rb
@@ -28,10 +28,13 @@ 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/f4038735/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..79bcd86 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable.rb
@@ -29,7 +29,9 @@ EOF
end
def command(table)
- admin.disable(table)
+ format_simple_command do
+ admin.disable(table)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..416545b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/disable_peer.rb
@@ -32,7 +32,9 @@ EOF
end
def command(id)
- replication_admin.disable_peer(id)
+ format_simple_command do
+ replication_admin.disable_peer(id)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..5bf9667 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,8 +30,10 @@ EOF
end
def command(table_name)
- replication_admin.disable_tablerep(table_name)
- puts "Replication of table '#{table_name}' successfully disabled."
+ format_simple_command do
+ replication_admin.disable_tablerep(table_name)
+ end
+ puts "The replication swith of table '#{table_name}' successfully disabled"
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..fc7b134 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop.rb
@@ -29,7 +29,9 @@ EOF
end
def command(table)
- admin.drop(table)
+ format_simple_command do
+ admin.drop(table)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..b030d27 100644
--- a/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/drop_namespace.rb
@@ -27,7 +27,9 @@ EOF
end
def command(namespace)
- admin.drop_namespace(namespace)
+ format_simple_command do
+ admin.drop_namespace(namespace)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..deeb70c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable.rb
@@ -29,7 +29,9 @@ EOF
end
def command(table)
- admin.enable(table)
+ format_simple_command do
+ admin.enable(table)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..55136ff 100644
--- a/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/enable_peer.rb
@@ -32,7 +32,9 @@ EOF
end
def command(id)
- replication_admin.enable_peer(id)
+ format_simple_command do
+ replication_admin.enable_peer(id)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..15e3133 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,8 +30,10 @@ EOF
end
def command(table_name)
- replication_admin.enable_tablerep(table_name)
- puts "The replication of table '#{table_name}' successfully enabled"
+ format_simple_command do
+ replication_admin.enable_tablerep(table_name)
+ end
+ puts "The replication swith of table '#{table_name}' successfully enabled"
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..bacf6c9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/exists.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/exists.rb
@@ -29,11 +29,11 @@ EOF
end
def command(table)
- exists = admin.exists?(table.to_s)
- formatter.row([
- "Table #{table} " + (exists ? "does exist" : "does not exist")
+ format_simple_command do
+ formatter.row([
+ "Table #{table} " + (admin.exists?(table.to_s) ? "does exist" : "does not exist")
])
- exists
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..2aefec5 100644
--- a/hbase-shell/src/main/ruby/shell/commands/flush.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/flush.rb
@@ -32,7 +32,9 @@ EOF
end
def command(table_or_region_name)
- admin.flush(table_or_region_name)
+ format_simple_command do
+ admin.flush(table_or_region_name)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 8191c22..b8bfd52 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)
- @start_time = Time.now
+ now = Time.now
formatter.header(["COLUMN", "CELL"])
count, is_stale = table._get_internal(row, *args) do |column, value|
formatter.row([ column, value ])
end
- formatter.footer(count, is_stale)
+ formatter.footer(now, count, is_stale)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..1b758ef 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,12 @@ EOF
end
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)])
+ 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
end
- list
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..ee02229 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,10 @@ module Shell
end
def command(id)
- peer_config = replication_admin.get_peer_config(id)
- @start_time = Time.now
- format_peer_config(peer_config)
- peer_config
+ peer_config = replication_admin.get_peer_config(id)
+ format_simple_command do
+ format_peer_config(peer_config)
+ end
end
def format_peer_config(peer_config)
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..43e7c1a 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get_table.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get_table.rb
@@ -38,7 +38,9 @@ EOF
end
def command(table, *args)
- table(table)
+ format_and_return_simple_command do
+ table(table)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 12feb58..7880026 100644
--- a/hbase-shell/src/main/ruby/shell/commands/grant.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/grant.rb
@@ -74,8 +74,9 @@ EOF
end
end
end
- @start_time = Time.now
- security_admin.grant(user, permissions, table_name, family, qualifier)
+ format_simple_command do
+ security_admin.grant(user, permissions, table_name, family, qualifier)
+ end
elsif args[1].kind_of?(Hash)
@@ -91,7 +92,7 @@ EOF
raise(ArgumentError, "Scanner specification is not a Hash") unless scan.kind_of?(Hash)
t = table(table_name)
- @start_time = Time.now
+ now = Time.now
scanner = t._get_scanner(scan)
count = 0
iter = scanner.iterator
@@ -105,7 +106,7 @@ EOF
end
count += 1
end
- formatter.footer(count)
+ formatter.footer(now, count)
else
raise(ArgumentError, "Second argument should be a String or Hash")
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..d223a45 100644
--- a/hbase-shell/src/main/ruby/shell/commands/incr.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/incr.rb
@@ -49,11 +49,13 @@ EOF
end
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"
- end
+ 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
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..6da7046 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_disabled.rb
@@ -29,8 +29,12 @@ EOF
end
def command(table)
- formatter.row([admin.disabled?(table)? "true" : "false"])
- end
+ format_simple_command do
+ formatter.row([
+ admin.disabled?(table)? "true" : "false"
+ ])
+ end
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..960ade7 100644
--- a/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/is_enabled.rb
@@ -29,9 +29,11 @@ EOF
end
def command(table)
- enabled = admin.enabled?(table)
- formatter.row([enabled ? "true" : "false"])
- enabled
+ format_simple_command do
+ formatter.row([
+ admin.enabled?(table)? "true" : "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 f7a0987..dce0ae2 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list.rb
@@ -33,6 +33,7 @@ EOF
end
def command(regex = ".*")
+ now = Time.now
formatter.header([ "TABLE" ])
list = admin.list(regex)
@@ -40,7 +41,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(list.size)
+ formatter.footer(now, list.size)
return list
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..6c7f991 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
@@ -32,9 +32,11 @@ EOF
end
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)])
+ 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
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..5d25604 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_namespace.rb
@@ -31,6 +31,7 @@ EOF
end
def command(regex = ".*")
+ now = Time.now
formatter.header([ "NAMESPACE" ])
list = admin.list_namespace(regex)
@@ -38,7 +39,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(list.size)
+ formatter.footer(now, list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..29e1812 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,6 +30,7 @@ EOF
end
def command(namespace)
+ now = Time.now
formatter.header([ "TABLE" ])
list = admin.list_namespace_tables(namespace)
@@ -37,8 +38,7 @@ EOF
formatter.row([ table ])
end
- formatter.footer(list.size)
- list
+ formatter.footer(now, list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..fc6e4a7 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,17 +25,18 @@ module Shell
end
def command
- 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([" "])
+ 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
end
end
- peer_configs
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 72a0704..cc1be04 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_peers.rb
@@ -30,6 +30,7 @@ EOF
end
def command()
+ now = Time.now
peers = replication_admin.list_peers
formatter.header(["PEER_ID", "CLUSTER_KEY", "STATE", "TABLE_CFS"])
@@ -40,8 +41,7 @@ EOF
formatter.row([ e.key, e.value, state, tableCFs ])
end
- formatter.footer()
- peers
+ formatter.footer(now)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 83e08c1..f407547 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_procedures.rb
@@ -29,6 +29,7 @@ EOF
end
def command()
+ now = Time.now
formatter.header([ "Id", "Name", "State", "Start_Time", "Last_Update" ])
list = admin.list_procedures()
@@ -38,7 +39,7 @@ EOF
formatter.row([ proc.getProcId, proc.getProcName, proc.getProcState, start_time, last_update ])
end
- formatter.footer(list.size)
+ formatter.footer(now, list.size)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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..682bb71 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_quotas.rb
@@ -37,6 +37,7 @@ EOF
end
def command(args = {})
+ now = Time.now
formatter.header(["OWNER", "QUOTAS"])
#actually do the scanning
@@ -44,7 +45,7 @@ EOF
formatter.row([ row, cells ])
end
- formatter.footer(count)
+ formatter.footer(now, count)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 142adfc..0db1d83 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,6 +31,8 @@ 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|
@@ -41,7 +43,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()
+ formatter.footer(now)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 bc91737..4e68802 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_snapshots.rb
@@ -34,6 +34,7 @@ EOF
end
def command(regex = ".*")
+ now = Time.now
formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
list = admin.list_snapshot(regex)
@@ -42,7 +43,7 @@ EOF
formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
end
- formatter.footer(list.size)
+ formatter.footer(now, list.size)
return list.map { |s| s.getName() }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 1efcc17..3a32e9e 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,6 +39,7 @@ EOF
end
def command(tableNameRegex, snapshotNameRegex = ".*")
+ now = Time.now
formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
list = admin.list_table_snapshots(tableNameRegex, snapshotNameRegex)
@@ -47,7 +48,7 @@ EOF
formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
end
- formatter.footer(list.size)
+ formatter.footer(now, list.size)
return list.map { |s| s.getName() }
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 e2487c1..b1e8c7b 100644
--- a/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/locate_region.rb
@@ -30,13 +30,14 @@ 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(1)
- region_location
+ formatter.footer(now, 1)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 f42af67..8257483 100644
--- a/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/major_compact.rb
@@ -40,7 +40,9 @@ module Shell
end
def command(table_or_region_name, family = nil)
- admin.major_compact(table_or_region_name, family)
+ format_simple_command do
+ admin.major_compact(table_or_region_name, family)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 63f7159..6afa2e5 100644
--- a/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/merge_region.rb
@@ -40,7 +40,9 @@ EOF
end
def command(encoded_region_a_name, encoded_region_b_name, force = 'false')
- admin.merge_region(encoded_region_a_name, encoded_region_b_name, force)
+ format_simple_command do
+ admin.merge_region(encoded_region_a_name, encoded_region_b_name, force)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 24816f3..e6b2828 100644
--- a/hbase-shell/src/main/ruby/shell/commands/move.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/move.rb
@@ -38,7 +38,9 @@ EOF
end
def command(encoded_region_name, server_name = nil)
- admin.move(encoded_region_name, server_name)
+ format_simple_command do
+ admin.move(encoded_region_name, server_name)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 0a61227..7e6302c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalize.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalize.rb
@@ -33,7 +33,11 @@ EOF
end
def command()
- formatter.row([admin.normalize()? "true": "false"])
+ format_simple_command do
+ formatter.row([
+ admin.normalize()? "true": "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 d39b777..1121b25 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalizer_enabled.rb
@@ -30,7 +30,11 @@ EOF
end
def command()
- formatter.row([admin.normalizer_enabled?.to_s])
+ format_simple_command do
+ formatter.row([
+ admin.normalizer_enabled?.to_s
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 7a12b71..6d959c4 100644
--- a/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
@@ -32,7 +32,11 @@ EOF
end
def command(enableDisable)
- formatter.row([admin.normalizer_switch(enableDisable)? "true" : "false"])
+ format_simple_command do
+ formatter.row([
+ admin.normalizer_switch(enableDisable)? "true" : "false"
+ ])
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 39f9fea..2b47a4d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/put.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/put.rb
@@ -45,8 +45,9 @@ EOF
end
def put(table, row, column, value, timestamp = nil, args = {})
- @start_time = Time.now
- table._put_internal(row, column, value, timestamp, args)
+ format_simple_command do
+ table._put_internal(row, column, value, timestamp, args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 bc9d6ab..5ae5786 100644
--- a/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/remove_peer.rb
@@ -30,7 +30,9 @@ EOF
end
def command(id)
- replication_admin.remove_peer(id)
+ format_simple_command do
+ replication_admin.remove_peer(id)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 c1bd5d0..5b15b52 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,7 +33,9 @@ EOF
end
def command(id, table_cfs)
- replication_admin.remove_peer_tableCFs(id, table_cfs)
+ format_simple_command do
+ replication_admin.remove_peer_tableCFs(id, table_cfs)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 2471e1b..4d53171 100644
--- a/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/restore_snapshot.rb
@@ -32,7 +32,9 @@ EOF
end
def command(snapshot_name)
- admin.restore_snapshot(snapshot_name)
+ format_simple_command do
+ admin.restore_snapshot(snapshot_name)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 bcf60e9..4a0d5ff 100644
--- a/hbase-shell/src/main/ruby/shell/commands/revoke.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/revoke.rb
@@ -39,7 +39,9 @@ EOF
end
def command(user, table_name=nil, family=nil, qualifier=nil)
- security_admin.revoke(user, table_name, family, qualifier)
+ format_simple_command do
+ security_admin.revoke(user, table_name, family, qualifier)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 e7b5d82..106eccf 100644
--- a/hbase-shell/src/main/ruby/shell/commands/scan.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb
@@ -104,17 +104,16 @@ 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(count, is_stale)
+ formatter.footer(now, 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/f4038735/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 5663ec3..4a52eb0 100644
--- a/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/set_auths.rb
@@ -31,7 +31,9 @@ EOF
end
def command(user, *args)
- visibility_labels_admin.set_auths(user, args)
+ format_simple_command do
+ visibility_labels_admin.set_auths(user, args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 b901cf0..3a88dbb 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
@@ -38,7 +38,9 @@ module Shell
end
def command(id, peer_table_cfs = nil)
- replication_admin.set_peer_tableCFs(id, peer_table_cfs)
+ format_simple_command do
+ replication_admin.set_peer_tableCFs(id, peer_table_cfs)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 962d8cd..59779fb 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)
- @start_time = Time.now
+ now = Time.now
scanner = t._get_scanner(scan)
count = 0
iter = scanner.iterator
@@ -65,7 +65,7 @@ EOF
end
count += 1
end
- formatter.footer(count)
+ formatter.footer(now, count)
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 5ff0be4..cdbd9ed 100644
--- a/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/show_filters.rb
@@ -36,6 +36,7 @@ EOF
end
def command( )
+ now = Time.now
parseFilter = ParseFilter.new
supportedFilters = parseFilter.getSupportedFilters
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/hbase-shell/src/main/ruby/shell/commands/show_peer_tableCFs.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/show_peer_tableCFs.rb b/hbase-shell/src/main/ruby/shell/commands/show_peer_tableCFs.rb
index b6b6956..3ce3d06 100644
--- a/hbase-shell/src/main/ruby/shell/commands/show_peer_tableCFs.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/show_peer_tableCFs.rb
@@ -30,9 +30,7 @@ module Shell
end
def command(id)
- peer_table_cfs = replication_admin.show_peer_tableCFs(id)
- puts peer_table_cfs
- peer_table_cfs
+ puts replication_admin.show_peer_tableCFs(id)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 fd37d07..15bf298 100644
--- a/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/snapshot.rb
@@ -29,7 +29,9 @@ EOF
end
def command(table, snapshot_name, *args)
- admin.snapshot(table, snapshot_name, *args)
+ format_simple_command do
+ admin.snapshot(table, snapshot_name, *args)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 9e6ec6a..9dc424f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/split.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/split.rb
@@ -34,7 +34,9 @@ EOF
end
def command(table_or_region_name, split_point = nil)
- admin.split(table_or_region_name, split_point)
+ format_simple_command do
+ admin.split(table_or_region_name, split_point)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 5a13871..7da7564 100644
--- a/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/splitormerge_enabled.rb
@@ -30,9 +30,11 @@ EOF
end
def command(switch_type)
- formatter.row(
- [admin.splitormerge_enabled(switch_type) ? 'true' : 'false']
- )
+ format_simple_command do
+ formatter.row(
+ [admin.splitormerge_enabled(switch_type) ? 'true' : 'false']
+ )
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 73dc82d..f4c2858 100644
--- a/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/splitormerge_switch.rb
@@ -32,9 +32,11 @@ EOF
end
def command(switch_type, enabled)
- formatter.row(
- [admin.splitormerge_switch(switch_type, enabled) ? 'true' : 'false']
- )
+ format_simple_command do
+ formatter.row(
+ [admin.splitormerge_switch(switch_type, enabled) ? 'true' : 'false']
+ )
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 d838979..5e00930 100644
--- a/hbase-shell/src/main/ruby/shell/commands/trace.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/trace.rb
@@ -48,7 +48,9 @@ EOF
end
def command(startstop="status", spanname="HBaseShell")
- trace(startstop, spanname)
+ format_and_return_simple_command do
+ trace(startstop, spanname)
+ end
end
def trace(startstop, spanname)
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 aff51ac..b7812fb 100644
--- a/hbase-shell/src/main/ruby/shell/commands/truncate.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/truncate.rb
@@ -27,7 +27,10 @@ EOF
end
def command(table)
- admin.truncate(table)
+ format_simple_command do
+ puts "Truncating '#{table}' table (it may take a while):"
+ admin.truncate(table) { |log| puts " - #{log}" }
+ end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 8bb3131..918b232 100644
--- a/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/truncate_preserve.rb
@@ -27,7 +27,10 @@ EOF
end
def command(table)
- admin.truncate_preserve(table)
+ format_simple_command do
+ puts "Truncating '#{table}' table (it may take a while):"
+ admin.truncate_preserve(table) { |log| puts " - #{log}" }
+ end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 b69971f..5eea71f 100644
--- a/hbase-shell/src/main/ruby/shell/commands/unassign.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/unassign.rb
@@ -36,7 +36,9 @@ EOF
end
def command(region_name, force = 'false')
- admin.unassign(region_name, force)
+ format_simple_command do
+ admin.unassign(region_name, force)
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 cb6852f..05295b7 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,7 +30,9 @@ EOF
end
def command()
- admin.update_all_config()
+ format_simple_command do
+ admin.update_all_config()
+ end
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/f4038735/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 3617bb3..9f65fdd 100644
--- a/hbase-shell/src/main/ruby/shell/commands/update_config.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/update_config.rb
@@ -31,7 +31,9 @@ EOF
end
def command(serverName)
- admin.update_config(serverName)
+ format_simple_command do
+ admin.update_config(serverName)
+ end
end
end
end