[
https://issues.apache.org/jira/browse/HBASE-14925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959491#comment-15959491
]
Karan Mehta commented on HBASE-14925:
-------------------------------------
bq. I could not find the start_time variable in the patch and also end_time
variable value not being used anywhere in the patch. What am I missing ? Can
you point me ?
Here is the code snippet from the {{commands.rb}} file. The method
{{command_safe()}} is a wrapper to the actual command call which initializes
the global variable {{start_time}}. It also automatically computes the value of
{{end_time}} and displays the total execution time. We can override these
values. Since I didn't want the output formatting and display time to be
included in the actual execution of the command, I provided a value to that
variable before the output stuff. Does that seem okay?
{code}
#wrap an execution of cmd to catch hbase exceptions
# 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) }
rescue => e
rootCause = e
while rootCause != nil && rootCause.respond_to?(:cause) &&
rootCause.cause != nil
rootCause = rootCause.cause
end
if @shell.interactive?
puts
puts "ERROR: #{rootCause}"
puts "Backtrace: #{rootCause.backtrace.join("\n ")}" if
debug
puts
puts help
puts
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])
{code}
> Develop HBase shell command/tool to list table's region info through command
> line
> ---------------------------------------------------------------------------------
>
> Key: HBASE-14925
> URL: https://issues.apache.org/jira/browse/HBASE-14925
> Project: HBase
> Issue Type: Improvement
> Components: shell
> Reporter: Romil Choksi
> Assignee: Karan Mehta
> Attachments: HBASE-14925.002.patch, HBASE-14925.003.patch,
> HBASE-14925.patch
>
>
> I am going through the hbase shell commands to see if there is anything I can
> use to get all the regions info just for a particular table. I don’t see any
> such command that provides me that information.
> It would be better to have a command that provides region info, start key,
> end key etc taking a table name as the input parameter. This is available
> through HBase UI on clicking on a particular table's link
> A tool/shell command to get a list of regions for a table or all tables in a
> tabular structured output (that is machine readable)
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)