@Override public void open() throws FailStoreException { try { environment = new Environment(dbPath, envConfig); db = environment.openDatabase(null, "lts", dbConfig); } catch (Exception e) { throw new FailStoreException(e); } }
@Override public void open() throws FailStoreException { try { environment = new Environment(dbPath, envConfig); db = environment.openDatabase(null, "lts", dbConfig); } catch (Exception e) { throw new FailStoreException(e); } }
@Override public BerkeleyJEKeyValueStore openDatabase(String name) throws BackendException { Preconditions.checkNotNull(name); if (stores.containsKey(name)) { BerkeleyJEKeyValueStore store = stores.get(name); return store; } try { DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setReadOnly(false); dbConfig.setAllowCreate(true); dbConfig.setTransactional(transactional); dbConfig.setKeyPrefixing(true); if (batchLoading) { dbConfig.setDeferredWrite(true); } Database db = environment.openDatabase(null, name, dbConfig); log.debug("Opened database {}", name, new Throwable()); BerkeleyJEKeyValueStore store = new BerkeleyJEKeyValueStore(name, db, this); stores.put(name, store); return store; } catch (DatabaseException e) { throw new PermanentBackendException("Could not open BerkeleyJE data store", e); } }
protected Database openDatabase(final Environment environment, final String dbName) throws DatabaseException { DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(false); dbConfig.setAllowCreate(true); dbConfig.setDeferredWrite(true); return environment.openDatabase(null, dbName, dbConfig); }
protected Database openDatabase(final Environment environment, final String dbName) throws DatabaseException { DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(false); dbConfig.setAllowCreate(true); dbConfig.setDeferredWrite(true); return environment.openDatabase(null, dbName, dbConfig); }
public WorkQueues(Environment env, String dbName, boolean resumable) { this.env = env; this.resumable = resumable; DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(true); dbConfig.setTransactional(resumable); dbConfig.setDeferredWrite(!resumable); urlsDB = env.openDatabase(null, dbName, dbConfig); webURLBinding = new WebURLTupleBinding(); }
/** * Reopens the bdb Database after a successful truncate operation. */ private boolean reopenBdbDatabase() { try { bdbDatabase = environment.openDatabase(null, this.getName(), this.bdbDatabase.getConfig()); return true; } catch(DatabaseException e) { this.bdbEnvironmentStats.reportException(e); throw new StorageInitializationException("Failed to reinitialize BdbStorageEngine for store:" + getName() + " after truncation.", e); } }
public DocIDServer(Environment env, CrawlConfig config) { this.config = config; DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(true); dbConfig.setTransactional(config.isResumableCrawling()); dbConfig.setDeferredWrite(!config.isResumableCrawling()); lastDocID = 0; docIDsDB = env.openDatabase(null, DATABASE_NAME, dbConfig); if (config.isResumableCrawling()) { int docCount = getDocCount(); if (docCount > 0) { logger.info("Loaded {} URLs that had been detected in previous crawl.", docCount); lastDocID = docCount; } } }
Database db = env.openDatabase(null, DB_NAME, config.toDatabaseConfig()); initialize(db); } catch (DatabaseException e) {
srcDB = srcEnv.openDatabase(null, storeName, dbConfig); dstDB = dstEnv.openDatabase(null, storeName, dbConfig);
dbConfig.setTransactional(true); dbConfig.setDeferredWrite(false); statisticsDB = env.openDatabase(null, DATABASE_NAME, dbConfig);
final Database db = environment.openDatabase(null, "test", databaseConfig);
@Test public void testPersistence() throws Exception { this.store.put(new ByteArray("abc".getBytes()), new Versioned<byte[]>("cdef".getBytes()), null); this.store.close(); this.environment.close(); this.environment = new Environment(this.tempDir, envConfig); this.database = environment.openDatabase(null, "test", databaseConfig); this.store = makeBdbStorageEngine("test", this.environment, this.database, runtimeConfig, this.prefixPartitionId); List<Versioned<byte[]>> vals = store.get(new ByteArray("abc".getBytes()), null); assertEquals(1, vals.size()); TestUtils.bytesEqual("cdef".getBytes(), vals.get(0).getValue()); }
String storeName = storeDef.getName(); Environment environment = getEnvironment(storeDef); Database db = environment.openDatabase(null, storeName, databaseConfig); BdbRuntimeConfig runtimeConfig = new BdbRuntimeConfig(voldemortConfig); BdbStorageEngine engine = null;
Database databaseA = environmentA.openDatabase(null, "storeA", databaseConfig); BdbStorageEngine storeA = BdbStorageEngineTest.makeBdbStorageEngine("storeA", environmentA, Database databaseB = environmentB.openDatabase(null, "storeB", databaseConfig); BdbStorageEngine storeB = BdbStorageEngineTest.makeBdbStorageEngine("storeB", environmentB,
databaseConfig.setTransactional(config.isBdbWriteTransactionsEnabled()); databaseConfig.setSortedDuplicates(false); Database database = environment.openDatabase(null, storeName, databaseConfig);
@Override @Before public void setUp() throws Exception { super.setUp(); this.envConfig = new EnvironmentConfig(); this.envConfig.setDurability(Durability.COMMIT_NO_SYNC); this.envConfig.setAllowCreate(true); this.envConfig.setTransactional(true); this.tempDir = TestUtils.createTempDir(); this.environment = new Environment(this.tempDir, envConfig); this.databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); databaseConfig.setTransactional(true); databaseConfig.setSortedDuplicates(false); this.database = environment.openDatabase(null, "test", databaseConfig); this.runtimeConfig = new BdbRuntimeConfig(); runtimeConfig.setLockMode(LOCK_MODE); this.store = makeBdbStorageEngine("test", this.environment, this.database, runtimeConfig, this.prefixPartitionId); }
public boolean createTable(String tableName, DatabaseSession databaseSession, boolean transactional) throws BimserverDatabaseException { if (tables.containsKey(tableName)) { throw new BimserverDatabaseException("Table " + tableName + " already created"); } DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); boolean finalTransactional = transactional && useTransactions; databaseConfig.setDeferredWrite(!finalTransactional); // if (!transactional) { // databaseConfig.setCacheMode(CacheMode.EVICT_BIN); // } databaseConfig.setTransactional(finalTransactional); databaseConfig.setSortedDuplicates(false); Database database = environment.openDatabase(null, tableName, databaseConfig); if (database == null) { return false; } tables.put(tableName, new TableWrapper(database, finalTransactional)); return true; }
public void openIndexTable(DatabaseSession databaseSession, String tableName, boolean transactional) throws BimserverDatabaseException { if (tables.containsKey(tableName)) { throw new BimserverDatabaseException("Table " + tableName + " already opened"); } DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(false); boolean finalTransactional = transactional && useTransactions; // if (!transactional) { // databaseConfig.setCacheMode(CacheMode.EVICT_BIN); // } databaseConfig.setDeferredWrite(!finalTransactional); databaseConfig.setTransactional(finalTransactional); databaseConfig.setSortedDuplicates(true); Database database = environment.openDatabase(null, tableName, databaseConfig); if (database == null) { throw new BimserverDatabaseException("Table " + tableName + " not found in database"); } tables.put(tableName, new TableWrapper(database, finalTransactional)); }
public boolean openTable(DatabaseSession databaseSession, String tableName, boolean transactional) throws BimserverDatabaseException { if (tables.containsKey(tableName)) { throw new BimserverDatabaseException("Table " + tableName + " already opened"); } DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(false); boolean finalTransactional = transactional && useTransactions; // if (!transactional) { // databaseConfig.setCacheMode(CacheMode.EVICT_BIN); // } databaseConfig.setDeferredWrite(!finalTransactional); databaseConfig.setTransactional(finalTransactional); databaseConfig.setSortedDuplicates(false); Database database = environment.openDatabase(null, tableName, databaseConfig); if (database == null) { throw new BimserverDatabaseException("Table " + tableName + " not found in database"); } tables.put(tableName, new TableWrapper(database, finalTransactional)); return true; }