[ 
https://issues.apache.org/jira/browse/HBASE-14925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15955753#comment-15955753
 ] 

Karan Mehta commented on HBASE-14925:
-------------------------------------

Thanks [~rstokes] for pointing out the use cases. The use cases typically 
suggest that the command will be not be used really often. We typically want 
the data to be fast, but no specific hard deadlines.

This code does consider the fact that if region server is not supplied, then 
information should be returned for all regions. {{start_with}} would match all 
the results if provided with an empty string.

This patch is actually optimized for queries that just want all the regions of 
a particular table. For the other part, if a typical table has many regions, 
then we will have to iterate through each of them and find the relevant ones, 
which may be expensive if a single table has plenty of regions. The approach is 
similar to the code that {{table.jsp}} uses to display the information in 
WEB-UI, the same API's are used. If WEB-UI seems appropriate in terms of 
latency, this one also should not be, I feel. Please suggest your comments on 
this one. 

Moreover, if the following approach is followed as previous patch 
{code}
   for server in cluster_status.getServers()
      for name,region in cluster_status.getLoad(server).getRegionsLoad()
          region_name = region.getNameAsString()
          regionStoreFileSize = region.getStorefileSizeMB()
          regionRequests = region.getRequestsCount()
          if region_name.start_with? tgtTable
              results << { "server" => server, "name" => region_name, "size" => 
regionStoreFileSize, "requests" => regionRequests }
          end
      end
{code}

It is difficult to retrieve the {{EndKey}} of a particular region since 
{{HRegionInfo}} is not present anywhere. {{StartKey}} is available if we call 
{{getLoad(ServerName).getRegionsLoad()}}, retrieve the region name and parse 
it. I believe {{EndKey}} is something that we are required to display as well. 
This patch can be used if we want to optimize the queries that filter by both 
tableName and regionServerName since that condition check can be done before 
the start of second loop. 

> 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.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)

Reply via email to