org.fusesource.leveldbjni.internal.NativeDB Java Examples

The following examples show how to use org.fusesource.leveldbjni.internal.NativeDB. 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: ShuffleHandler.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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());
  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;
    }
  }
  checkVersion();
}
 
Example #3
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 #4
Source File: ShuffleHandler.java    From big-c with Apache License 2.0 6 votes vote down vote up
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());
  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;
    }
  }
  checkVersion();
}
 
Example #5
Source File: ShuffleHandler.java    From tez with Apache License 2.0 6 votes vote down vote up
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());
  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;
    }
  }
  checkVersion();
}
 
Example #6
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 #7
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 #8
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 #9
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();
}