private void startStore(Path recoveryRoot) throws IOException { Options options = new Options(); options.createIfMissing(false); 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(); }
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(); }
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(); }
protected DB openDatabase(Configuration conf) throws IOException { Path storeRoot = createStorageDir(conf); Options options = new Options(); options.createIfMissing(false); 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; } } return db; }
@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(); }
protected DB openDatabase() 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; } } return db; }
protected DB openDatabase() throws Exception { Path storeRoot = createStorageDir(); Options options = new Options(); options.createIfMissing(false); 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; } } return db; }
protected DB openDatabase() 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; } } return db; }
public byte[] get(byte[] key, ReadOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { return db.get(convert(options), key); } catch (NativeDB.DBException e) { if(e.isNotFound()) { return null; } throw new DBException(e.getMessage(), e); } }
public byte[] get(byte[] key, ReadOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { return db.get(convert(options), key); } catch (NativeDB.DBException e) { if(e.isNotFound()) { return null; } throw new DBException(e.getMessage(), e); } }
public Snapshot write(WriteBatch updates, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.write(convert(options), ((JniWriteBatch) updates).writeBatch()); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot put(byte[] key, byte[] value, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.put(convert(options), key, value); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public byte[] get(byte[] key, ReadOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { return db.get(convert(options), key); } catch (NativeDB.DBException e) { if(e.isNotFound()) { return null; } throw new DBException(e.getMessage(), e); } }
public Snapshot write(WriteBatch updates, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.write(convert(options), ((JniWriteBatch) updates).writeBatch()); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot put(byte[] key, byte[] value, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.put(convert(options), key, value); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot delete(byte[] key, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.delete(convert(options), key); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot delete(byte[] key, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.delete(convert(options), key); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot write(WriteBatch updates, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.write(convert(options), ((JniWriteBatch) updates).writeBatch()); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot put(byte[] key, byte[] value, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.put(convert(options), key, value); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }
public Snapshot delete(byte[] key, WriteOptions options) throws DBException { if( db==null ) { throw new DBException("Closed"); } try { db.delete(convert(options), key); return null; } catch (NativeDB.DBException e) { throw new DBException(e.getMessage(), e); } }