abstractdog commented on code in PR #509:
URL: https://github.com/apache/tez/pull/509#discussion_r3452598156
##########
tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java:
##########
@@ -696,26 +696,23 @@ private void recoverState(Configuration conf) throws
IOException {
private void startStore(Path recoveryRoot) throws IOException {
Options options = new Options();
- options.createIfMissing(false);
options.logger(new LevelDBLogger());
Path dbPath = new Path(recoveryRoot, STATE_DB_NAME);
LOG.info("Using state database at " + dbPath + " for recovery");
File dbfile = new File(dbPath.toString());
+ boolean dbExists = dbfile.exists();
+ options.createIfMissing(!dbExists);
try {
- stateDb = JniDBFactory.factory.open(dbfile, options);
- } catch (NativeDB.DBException e) {
- if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
- LOG.info("Creating state database at " + dbfile);
- options.createIfMissing(true);
- try {
- stateDb = JniDBFactory.factory.open(dbfile, options);
- storeVersion();
- } catch (DBException dbExc) {
- throw new IOException("Unable to create state store", dbExc);
- }
- } else {
- throw e;
+ stateDb = DB_FACTORY.open(dbfile, options);
+ } catch (Exception e) {
+ if (e instanceof IOException) {
+ throw (IOException) e;
Review Comment:
what about simply skipping this check, the next line takes care of wrapping
it into an IOException anyway
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]