[
https://issues.apache.org/jira/browse/HBASE-13058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14339898#comment-14339898
]
Abhishek Kumar commented on HBASE-13058:
----------------------------------------
actually i was thinking of removing such exception message parsing from
'translate_hbase_exceptions' as we already have access to args that we need,
here is something i am thinking of:
> revert back to 'args.first' for both TableNotFound and TableExists
> exception(as large number of commands seems fine with this)
> add a call to command specific exception handling for commands so that
> individual commands can get a chance to deal with their exception before
> transferring control to a global handling, only small number of commands
> have table args which comes in after first argument and they can be handled
> in their respective command file with minimal changes.Also, some of these
> commands like grant seems to be already handling these TableNotFound
> exception as ArgumentError so not requiring any specific handling:-
------------------------------------------------------------------
{noformat}
def translate_hbase_exceptions(*args)
yield
rescue => e
raise e unless e.respond_to?(:cause) && e.cause != nil
# Get the special java exception which will be handled
cause = e.cause
# handle command specific exceptions in respective command if needed
if self.respond_to?(:handle_exceptions_locally)
self.handle_exceptions_locally(cause, *args);
end
# Global HBase exception handling below if not handled by respective
command
if cause.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then
raise "Unknown table #{args.first}!"
end
if
cause.kind_of?(org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException)
then
exceptions = cause.getCauses
exceptions.each do |exception|
if
exception.kind_of?(org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException)
then
valid_cols = table(args.first).get_all_columns.map { |c| c + '*' }
raise "Unknown column family! Valid column names:
#{valid_cols.join(", ")}"
end
if
exception.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then
raise "Unknown table #{args.first}!"
end
end
end
if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
raise "Table already exists: #{args.first}!"
end
.........................
.........................
{noformat}
------------------------------------------------------------------
pls let me know your views/suggestions on above mentioned approach.
> Hbase shell command 'scan' for non existent table shows unnecessary info for
> one unrelated existent table.
> ----------------------------------------------------------------------------------------------------------
>
> Key: HBASE-13058
> URL: https://issues.apache.org/jira/browse/HBASE-13058
> Project: HBase
> Issue Type: Bug
> Components: Client
> Reporter: Abhishek Kumar
> Assignee: Abhishek Kumar
> Priority: Trivial
> Fix For: 2.0.0, 1.1.0
>
> Attachments: 0001-HBASE-13058-Error-messages-in-scan-table.patch,
> 0001-HBASE-13058-shell-unknown-table-message-update.patch
>
>
> When scanning for a non existent table in hbase shell, error message in shell
> sometimes(based on META table content) displays completely unrelated table
> info , which seems to be unnecessary and inconsistent with other error
> messages:
> {noformat}
> hbase(main):016:0> scan 'noTable'
> ROW COLUMN+CELL
> ERROR: Unknown table Table 'noTable' was not found, got: hbase:namespace.!
> ---------------------------------------------------------------------------------------------
> hbase(main):017:0> scan '01_noTable'
> ROW COLUMN+CELL
> ERROR: Unknown table 01_noTable!
> --------------------------------------------------
> {noformat}
> Its happening when doing a META table scan (to locate input table ) and
> scanner stops at row of another table (beyond which table can not exist) in
> ConnectionManager.locateRegionInMeta:
> {noformat}
> private RegionLocations locateRegionInMeta(TableName tableName, byte[] row,
> boolean useCache, boolean retry, int replicaId) throws
> IOException {
> .................................
> ................................
> // possible we got a region of a different table...
> if (!regionInfo.getTable().equals(tableName)) {
> throw new TableNotFoundException(
> "Table '" + tableName + "' was not found, got: " +
> regionInfo.getTable() + ".");
> }
> ...............................
> ...............................
> {noformat}
> Here, we can simply put a debug message(if required) and just throw the
> TableNotFoundException(tableName) with only tableName instead of with
> scanner positioned row.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)