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); } }
environmentConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, Long.toString(config.getBdbMaxLogFileSize())); environmentConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_BYTES_INTERVAL, Long.toString(config.getBdbCheckpointBytes())); environmentConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_WAKEUP_INTERVAL, Long.toString(config.getBdbCheckpointMs() * Time.US_PER_MS)); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MIN_FILE_UTILIZATION, Integer.toString(config.getBdbCleanerMinFileUtilization())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MIN_UTILIZATION, Integer.toString(config.getBdbCleanerMinUtilization())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, Integer.toString(config.getBdbCleanerThreads())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE, Integer.toString(config.getBdbCleanerLookAheadCacheSize())); environmentConfig.setConfigParam(EnvironmentConfig.LOCK_N_LOCK_TABLES, Integer.toString(config.getBdbLockNLockTables())); environmentConfig.setConfigParam(EnvironmentConfig.ENV_FAIR_LATCHES, Boolean.toString(config.getBdbFairLatches())); environmentConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_HIGH_PRIORITY, Boolean.toString(config.getBdbCheckpointerHighPriority())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, Integer.toString(config.getBdbCleanerMaxBatchFiles())); environmentConfig.setConfigParam(EnvironmentConfig.LOG_FAULT_READ_SIZE, Integer.toString(config.getBdbLogFaultReadSize())); environmentConfig.setConfigParam(EnvironmentConfig.LOG_ITERATOR_READ_SIZE, Integer.toString(config.getBdbLogIteratorReadSize())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION, Boolean.toString(config.getBdbCleanerLazyMigration())); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_BYTES_INTERVAL,
nLockTables--; config.setConfigParam("je.lock.nLockTables", Long.toString(nLockTables)); config.setConfigParam("je.log.faultReadSize", "6144"); config.setConfigParam("je.cleaner.expunge", "false");
environmentConfig.setCacheSize(cacheSize); environmentConfig.setDurability(Durability.COMMIT_NO_SYNC); environmentConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, "1000000000"); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, "100"); environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, "52428800"); environmentConfig.setAllowCreate(true); environmentConfig.setTransactional(true);
envConfig.setReadOnly(false); envConfig.setCacheSize(1024 * 1024 * 1024); envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, Long.toString(logFileSize * 1024L * 1024L)); envConfig.setDurability(Durability.COMMIT_NO_SYNC);
envConfig.setTxnTimeout(10, TimeUnit.SECONDS); envConfig.setLockTimeout(2000, TimeUnit.MILLISECONDS); envConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_HIGH_PRIORITY, "true"); envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, "5"); try { environment = new Environment(dataDir.toFile(), envConfig);
protected void openEnv(boolean doRecovery) throws EnvironmentNotFoundException, EnvironmentLockedException { if (env == null) { EnvironmentConfig envConfiguration = new EnvironmentConfig(); envConfiguration.setReadOnly(true); /* Don't run recovery. */ envConfiguration.setConfigParam (EnvironmentParams.ENV_RECOVERY.getName(), doRecovery ? "true" : "false"); /* Even without recovery, scavenger needs comparators. */ envConfiguration.setConfigParam (EnvironmentParams.ENV_COMPARATORS_REQUIRED.getName(), "true"); env = new Environment(envHome, envConfiguration); } }
private Environment openCalcEnvironment(final boolean createNew) { final EnvironmentConfig config = envConfig.clone(); if (offHeapCache) { config.setOffHeapCacheSize(1024 * 1024 * 1024); } else { config.setOffHeapCacheSize(0); } /* The amount of disk space needed is quite small. */ config.setConfigParam( EnvironmentConfig.FREE_DISK, String.valueOf(1L << 20)); return openEnvironment(config, createNew); }
/** * Create an environment configuration for subscription * * @return an environment configuration */ public EnvironmentConfig createEnvConfig() { /* Populate env. configuration parameters */ EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setReadOnly(true); envConfig.setTransactional(true); envConfig.setConfigParam( EnvironmentParams.ENV_RECOVERY.getName(), "false"); envConfig.setConfigParam( EnvironmentParams.ENV_SETUP_LOGGER.getName(), "true"); return envConfig; }
bdb_env.getConfig().setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false"); int totalLogFiles = 0; int logFiles;
private void initialize(int cachePercent) throws StorageException { 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 PermanentStorageException("Error during BerkeleyJE initialization: ", e); } }
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); } }
bdb_env.getConfig().setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false"); int totalLogFiles = 0; int logFiles;
/** * @param thePath Directory where BDBJE files are stored * @param theDbName Name of files in thePath * @throws IOException for usual reasons, plus as database exceptions */ public void initializeDB(final String thePath, final String theDbName) throws IOException { path = thePath; dbName = theDbName; EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setAllowCreate(true); environmentConfig.setTransactional(true); environmentConfig.setConfigParam("je.log.fileMax",JE_LOG_FILEMAX); File file = new File(path); if(!file.isDirectory()) { if(!file.mkdirs()) { throw new IOException("failed mkdirs(" + path + ")"); } } env = new Environment(file, environmentConfig); DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); databaseConfig.setTransactional(true); // perform other database configurations db = env.openDatabase(null, dbName, databaseConfig); }
@Override public PersistenceBackend createTransientBackend() { NeoLogger.debug("createTransientBackend()"); BerkeleyDbPersistenceBackend backend = null; try { File temporaryFolder = Files.createTempDirectory("neoemf").toFile(); EnvironmentConfig envConfig = new EnvironmentConfig(); envConfig.setAllowCreate(true); envConfig.setConfigParam(EnvironmentConfig.LOG_MEM_ONLY, "true"); File dir = new File(BerkeleyDbURI.createFileURI(temporaryFolder).toFileString()); backend = new BerkeleyDbPersistenceBackend(dir, envConfig); backend.open(); } catch (IOException e) { NeoLogger.error(e); } return backend; }
/** * @param thePath Directory where BDBJE files are stored * @param theDbName Name of files in thePath * @throws IOException for usual reasons, plus as database exceptions */ public void initializeDB(final String thePath, final String theDbName) throws IOException { path = thePath; dbName = theDbName; EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setAllowCreate(true); environmentConfig.setTransactional(true); environmentConfig.setConfigParam("je.log.fileMax",JE_LOG_FILEMAX); File file = new File(path); if(!file.isDirectory()) { if(!file.mkdirs()) { throw new IOException("failed mkdirs(" + path + ")"); } } env = new Environment(file, environmentConfig); DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setAllowCreate(true); databaseConfig.setTransactional(true); // perform other database configurations db = env.openDatabase(null, dbName, databaseConfig); }
/** * Create an environment suitable for utilities. Utilities should in * general send trace output to the console and not to the db log. */ public static EnvironmentImpl makeUtilityEnvironment(File envHome, boolean readOnly) throws EnvironmentNotFoundException, EnvironmentLockedException { EnvironmentConfig config = new EnvironmentConfig(); config.setReadOnly(readOnly); /* Don't debug log to the database log. */ config.setConfigParam(EnvironmentParams.JE_LOGGING_DBLOG.getName(), "false"); /* Don't run recovery. */ config.setConfigParam(EnvironmentParams.ENV_RECOVERY.getName(), "false"); /* Apply the configuration in the je.properties file. */ DbConfigManager.applyFileConfig (envHome, DbInternal.getProps(config), false); EnvironmentImpl envImpl = new EnvironmentImpl(envHome, config, null); envImpl.finishInit(config); return envImpl; }
protected EnvironmentConfig envConfigForStore(boolean allowCreate, boolean writeAccess) { EnvironmentConfig config = new EnvironmentConfig(); config.setAllowCreate(allowCreate); config.setReadOnly(!writeAccess); config.setTransactional(_bdbConfig.useTransactions); config.setSharedCache(false); config.setCacheSize(_bdbConfig.cacheSize.getNumberOfBytes()); // Default of 500 msec way too low; usually set to higher value: config.setLockTimeout(_bdbConfig.lockTimeoutMsecs, TimeUnit.MILLISECONDS); // Default of 1 for lock count is not good; let's see what to use instead: config.setConfigParam(EnvironmentConfig.LOCK_N_LOCK_TABLES, String.valueOf(_bdbConfig.lockTableCount)); return config; }
private Environment openMeasureEnvironment(final boolean createNew, final boolean setMainSize) { final EnvironmentConfig config = envConfig.clone(); if (setMainSize) { config.setCacheSize(mainCacheSize); /* * Normally the main cache size is left "unlimited", meaning that * log buffers will be maximum sized (1 MB each). Here we limit the * main cache size in order to use the off-heap cache. But with a * smaller main cache, the log buffers will be smaller. Use maximum * sized log buffers so we can compare totals with the case where * we don't set the cache size. */ config.setConfigParam( EnvironmentConfig.LOG_TOTAL_BUFFER_BYTES, String.valueOf(3 << 20)); } else { config.setCachePercent(90); } if (offHeapCache) { config.setOffHeapCacheSize(1024 * 1024 * 1024); } else { config.setOffHeapCacheSize(0); } return openEnvironment(config, createNew); }
nLockTables--; config.setConfigParam("je.lock.nLockTables", Long.toString(nLockTables)); config.setConfigParam("je.log.faultReadSize", "6144"); config.setConfigParam("je.cleaner.expunge", "false");