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

Jason Lowe commented on YARN-1987:
----------------------------------

Thanks for the feedback, Ming!

bq.  LeveldbIterator.close rethrows IOException instead of DBException. Just 
wonder which is better, given JniDBFactory.factory.open throws DBException.

JniDBFactory.factory.open throws NativeDB.DBException which is an IOException 
rather than the runtime DBException.  Also since close() already declares that 
it can throw IOException which callers either have to handle or propagate it 
seemed better to leverage that declared exception than a runtime exception 
which callers can easily overlook.

bq. It seems "store open via JniDBFactory.factory.open" can also be useful to 
put into a wrapper class, to take care of "catch the exception if the store 
doesn't exist and create a new one".

If all one cares about is to make sure the database is created even if it 
doesn't exist then that's already covered by the leveldb interfaces by calling 
createIfMissing() on the options passed to the open call.  In the NM restart 
case I wanted to know when the database was being created so the code can 
either check the existing schema version or set the schema version, 
respectively.  If that's something that needs to be put in a utility method 
then I agree it's a separate JIRA.

> Wrapper for leveldb DBIterator to aid in handling database exceptions
> ---------------------------------------------------------------------
>
>                 Key: YARN-1987
>                 URL: https://issues.apache.org/jira/browse/YARN-1987
>             Project: Hadoop YARN
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Jason Lowe
>            Assignee: Jason Lowe
>         Attachments: YARN-1987.patch
>
>
> Per discussions in YARN-1984 and MAPREDUCE-5652, it would be nice to have a 
> utility wrapper around leveldb's DBIterator to translate the raw 
> RuntimeExceptions it can throw into DBExceptions to make it easier to handle 
> database errors while iterating.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to