public static EnhancedEnvironment setupCopyEnvironment(File env, boolean readOnly) throws DatabaseException { EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setReadOnly(readOnly); try { return new EnhancedEnvironment(env, envConfig); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("problem with specified environment "+env+"; is it already open?", iae); } } }
/** * Create a temporary test environment in the given directory. * @param dir target directory * @return EnhancedEnvironment */ public static EnhancedEnvironment getTestEnvironment(File dir) { EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setTransactional(false); EnhancedEnvironment env; try { env = new EnhancedEnvironment(dir, envConfig); } catch (DatabaseException e) { throw new RuntimeException(e); } return env; } }
EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setTransactional(resumable);
private void initialize(int cachePercent) throws BackendException { try { EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setTransactional(transactional); envConfig.setCachePercent(cachePercent); if (batchLoading) { envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CHECKPOINTER, "false"); envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false"); } //Open the environment environment = new Environment(directory, envConfig); } catch (DatabaseException e) { throw new PermanentBackendException("Error during BerkeleyJE initialization: ", e); } }
super(); FileUtils.ensureWriteableDirectory(bdbEnv); EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); if (cacheSizePercentage > 0 && cacheSizePercentage < 100) {
EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setTransactional(true); envConfig.setAllowCreate(false); envConfig = new EnvironmentConfig(); envConfig.setTransactional(false); envConfig.setAllowCreate(true);
DatabaseConfig databaseConfig; environmentConfig = new EnvironmentConfig(); environmentConfig.setCacheSize(cacheSize); environmentConfig.setDurability(Durability.COMMIT_NO_SYNC);
@Override protected void init() throws FailStoreException{ try { envConfig = new EnvironmentConfig(); // 如果不存在则创建一个 envConfig.setAllowCreate(true); // 以只读方式打开,默认为false envConfig.setReadOnly(false); // 事务支持,如果为true,则表示当前环境支持事务处理,默认为false,不支持事务处理 envConfig.setTransactional(true); // Configures the durability associated with transactions. envConfig.setDurability(Durability.COMMIT_SYNC); dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(true); dbConfig.setSortedDuplicates(false); dbConfig.setTransactional(true); } catch (DatabaseException e) { throw new FailStoreException(e); } }
@Override protected void init() throws FailStoreException{ try { envConfig = new EnvironmentConfig(); // 如果不存在则创建一个 envConfig.setAllowCreate(true); // 以只读方式打开,默认为false envConfig.setReadOnly(false); // 事务支持,如果为true,则表示当前环境支持事务处理,默认为false,不支持事务处理 envConfig.setTransactional(true); // Configures the durability associated with transactions. envConfig.setDurability(Durability.COMMIT_SYNC); dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(true); dbConfig.setSortedDuplicates(false); dbConfig.setTransactional(true); } catch (DatabaseException e) { throw new FailStoreException(e); } }
public BdbStorageConfiguration(VoldemortConfig config) { this.voldemortConfig = config; environmentConfig = new EnvironmentConfig(); environmentConfig.setTransactional(true); if(config.isBdbWriteTransactionsEnabled() && config.isBdbFlushTransactionsEnabled()) {
protected void setup(File f, boolean create) throws DatabaseException, IOException { EnvironmentConfig config = new EnvironmentConfig(); config.setAllowCreate(create); config.setLockTimeout(75, TimeUnit.MINUTES); // set to max
EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setDurability(Durability.COMMIT_NO_SYNC); environmentConfig.setAllowCreate(true);
@Test public void testUnsharedCache() throws DatabaseException { EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setDurability(Durability.COMMIT_NO_SYNC); environmentConfig.setAllowCreate(true); environmentConfig.setTransactional(true); environmentConfig.setSharedCache(false); environmentConfig.setCacheSize(CACHE_SIZE); DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); databaseConfig.setTransactional(true); databaseConfig.setSortedDuplicates(true); long maxCacheSize = getMaxCacheUsage(environmentConfig, databaseConfig); assertEquals("MaxCacheSize > CACHE_SIZE", true, maxCacheSize > CACHE_SIZE); assertEquals("MaxCacheSize < 2 * CACHE_SIZE", true, maxCacheSize < 2 * CACHE_SIZE); }
@Test public void testSharedCache() throws DatabaseException { EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setDurability(Durability.COMMIT_NO_SYNC); environmentConfig.setAllowCreate(true); environmentConfig.setTransactional(true); environmentConfig.setSharedCache(true); environmentConfig.setCacheSize(CACHE_SIZE); DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); databaseConfig.setTransactional(true); databaseConfig.setSortedDuplicates(true); long maxCacheSize = getMaxCacheUsage(environmentConfig, databaseConfig); // Include a buffer of 1mb.. since the actual cache usage can be a few // bytes more assertEquals("MaxCacheSize" + maxCacheSize + " <= CACHE_SIZE:" + CACHE_SIZE, true, maxCacheSize <= (CACHE_SIZE + ByteUtils.BYTES_PER_MB)); }
@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); }
EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setCachePercent(50); envConfig.setAllowCreate(true);
void openEnv() throws Exception { if (env == null) { EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setReadOnly(true); env = new Environment(envHome, envConfig); } }
public PersistMqFilter(String storePath) { EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); File file = new File(storePath); if (!file.exists()) { file.mkdirs(); } environment = new Environment(file, envConfig); dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(true); }
public BerkeleyDBReader(String crawlPath) { this.crawlPath = crawlPath; File dir = new File(crawlPath); EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setAllowCreate(true); env = new Environment(dir, environmentConfig); crawldbDatabase = env.openDatabase(null, "crawldb", BerkeleyDBUtils.defaultDBConfig); cursor = crawldbDatabase.openCursor(null, CursorConfig.DEFAULT); }
protected Environment getEnvironment() throws DatabaseException { if (_environment == null) { EnvironmentConfig config = new EnvironmentConfig(); config.setAllowCreate(true); File targetDir = getTargetDir(); _environment = new Environment(targetDir, config); } return _environment; }