HBASE-13058 Hbase shell command 'scan' for non existent table shows unnecessary info for one unrelated existent table. (Abhishek Kumar)
This commit is contained in:
parent
22d9766aa7
commit
2392a3e437
|
@ -102,9 +102,13 @@ module Shell
|
|||
|
||||
# Get the special java exception which will be handled
|
||||
cause = e.cause
|
||||
# let individual command handle exceptions first
|
||||
if self.respond_to?(:handle_exceptions)
|
||||
self.handle_exceptions(cause, *args)
|
||||
end
|
||||
# Global HBase exception handling below if not handled by respective command above
|
||||
if cause.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then
|
||||
str = java.lang.String.new("#{cause}")
|
||||
raise "Unknown table #{str}!"
|
||||
raise "Unknown table #{args.first}!"
|
||||
end
|
||||
if cause.kind_of?(org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException) then
|
||||
exceptions = cause.getCauses
|
||||
|
@ -116,15 +120,7 @@ module Shell
|
|||
end
|
||||
end
|
||||
if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
|
||||
str = java.lang.String.new("#{cause}")
|
||||
strs = str.split("\n")
|
||||
if strs.size > 0 then
|
||||
s = strs[0].split(' ');
|
||||
if(s.size > 1)
|
||||
raise "Table already exists: #{s[1]}!"
|
||||
end
|
||||
raise "Table already exists: #{strs[0]}!"
|
||||
end
|
||||
raise "Table already exists: #{args.first}!"
|
||||
end
|
||||
# To be safe, here only AccessDeniedException is considered. In future
|
||||
# we might support more in more generic approach when possible.
|
||||
|
|
|
@ -36,6 +36,13 @@ EOF
|
|||
admin.clone_snapshot(snapshot_name, table)
|
||||
end
|
||||
end
|
||||
|
||||
def handle_exceptions(cause, *args)
|
||||
if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
|
||||
tableName = args[1]
|
||||
raise "Table already exists: #{tableName}!"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue