Java Code Examples for org.iq80.leveldb.DBException#getMessage()

The following examples show how to use org.iq80.leveldb.DBException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LeveldbRMStateStore.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void startInternal() throws Exception {
  Path storeRoot = createStorageDir();
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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 {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
}
 
Example 2
Source File: LeveldbRMStateStore.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void startInternal() throws Exception {
  Path storeRoot = createStorageDir();
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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 {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
}
 
Example 3
Source File: NMLeveldbStateStoreService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected void initStorage(Configuration conf)
    throws IOException {
  Path storeRoot = createStorageDir(conf);
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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);
      isNewlyCreated = true;
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
Example 4
Source File: ShuffleHandler.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void storeSchemaVersion(Version version) throws IOException {
  String key = STATE_DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) version).getProto().toByteArray();
  try {
    stateDb.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e.getMessage(), e);
  }
}
 
Example 5
Source File: HistoryServerLeveldbStateStoreService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected void startStorage() throws IOException {
  Path storeRoot = createStorageDir(getConfig());
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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 {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
Example 6
Source File: NMLeveldbStateStoreService.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void initStorage(Configuration conf)
    throws IOException {
  Path storeRoot = createStorageDir(conf);
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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);
      isNewlyCreated = true;
      options.createIfMissing(true);
      try {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
Example 7
Source File: ShuffleHandler.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void storeSchemaVersion(Version version) throws IOException {
  String key = STATE_DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) version).getProto().toByteArray();
  try {
    stateDb.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e.getMessage(), e);
  }
}
 
Example 8
Source File: HistoryServerLeveldbStateStoreService.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void startStorage() throws IOException {
  Path storeRoot = createStorageDir(getConfig());
  Options options = new Options();
  options.createIfMissing(false);
  options.logger(new LeveldbLogger());
  LOG.info("Using state database at " + storeRoot + " for recovery");
  File dbfile = new File(storeRoot.toString());
  try {
    db = 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 {
        db = JniDBFactory.factory.open(dbfile, options);
        // store version
        storeVersion();
      } catch (DBException dbErr) {
        throw new IOException(dbErr.getMessage(), dbErr);
      }
    } else {
      throw e;
    }
  }
  checkVersion();
}
 
Example 9
Source File: ShuffleHandler.java    From tez with Apache License 2.0 5 votes vote down vote up
private void storeSchemaVersion(Version version) throws IOException {
  String key = STATE_DB_SCHEMA_VERSION_KEY;
  byte[] data =
      ((VersionPBImpl) version).getProto().toByteArray();
  try {
    stateDb.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e.getMessage(), e);
  }
}