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

David Mollitor commented on HIVE-23266:
---------------------------------------

Exception handling in this class is pretty atrocious and convoluted.  It needs 
to be cleaned up a lot, but I can work on that in a separate ticket.

The ObjectStore should not be throwing {{MetaException}} at all.  This is an 
{{Exception}} generated for Thrift communication that is part of the API.  This 
class is way too low level to be throwing something specific to Thrift.  If for 
example, we wanted to use Protobufs at a future point, it will be a PITA to 
update all these exceptions.  These exceptions should only be generated in the 
service layer, immediately before the response is returned to the client.

This Exception type is pretty limited in its functionality.  At some point it 
is clear that developers wanted to pass the entire ERROR stack trace to the 
client.  There is no way to do this with the {{MetaException}} since it does 
not accept a 'cause' {{Exception}} in its arguments.  So, as a workaround, 
people were clearly just creating a String out of the stack trace and tacking 
it onto the message.

I would argue that this is not the right thing to do.  It's confusing as heck 
on the client end receiving a stack trace from the server.  To the client user, 
it's not clear to them where this stack trace is coming from (client side or 
server side) and also the server should not be leaking internal details about 
its own implementation (libraries, line numbers, etc.) to the client.  The 
client should just receive a clear and helpful message and the server side 
should print the detailed error message (with stack trace) to its own logs.

 

> Remove QueryWrapper from ObjectStore
> ------------------------------------
>
>                 Key: HIVE-23266
>                 URL: https://issues.apache.org/jira/browse/HIVE-23266
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Major
>         Attachments: HIVE-23266.1.patch, HIVE-23266.10.patch, 
> HIVE-23266.11.patch, HIVE-23266.2.patch, HIVE-23266.2.patch, 
> HIVE-23266.3.patch, HIVE-23266.4.patch, HIVE-23266.5.patch, 
> HIVE-23266.6.patch, HIVE-23266.7.patch, HIVE-23266.8.patch, HIVE-23266.9.patch
>
>
> There is currently a utility called {{QueryWrapper}} that makes a normal 
> {{Query}} auto-closable.  However, {{Query}} is now in fact already 
> auto-closing, so there is no need for this class.  In trying to remove it, I 
> realized that this wrapper was being passed around in pretty convoluted ways 
> and also it was sometimes being created in a {{try-with-resources}} block but 
> then never actually used in any way.
> Remove the {{QueryWrapper}} from the class and simplify some of the DB 
> interactions.
> https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L178



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to