use of com.sleepycat.je.DatabaseConfig in project voldemort by voldemort.
the class BdbSplitStorageEngineTest method testUnsharedCache.
@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);
}
use of com.sleepycat.je.DatabaseConfig in project qpid-broker-j by apache.
the class AbstractBDBPreferenceStore method getPreferencesVersionDb.
private Database getPreferencesVersionDb() {
Database preferencesVersionDb;
try {
DatabaseConfig config = new DatabaseConfig().setTransactional(true).setAllowCreate(false);
preferencesVersionDb = getEnvironmentFacade().openDatabase(PREFERENCES_VERSION_DB_NAME, config);
} catch (DatabaseNotFoundException e) {
preferencesVersionDb = updateVersion(null, BrokerModel.MODEL_VERSION);
}
return preferencesVersionDb;
}
use of com.sleepycat.je.DatabaseConfig in project qpid-broker-j by apache.
the class UpgradeFrom8To9 method performUpgrade.
@Override
public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, final ConfiguredObject<?> parent) {
reportStarting(environment, 8);
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setTransactional(true);
dbConfig.setAllowCreate(true);
final Transaction transaction = environment.beginTransaction(null, null);
try {
Database userPreferencesDb = environment.openDatabase(transaction, "USER_PREFERENCES", dbConfig);
userPreferencesDb.close();
try (Database userPreferencesVersionDb = environment.openDatabase(transaction, "USER_PREFERENCES_VERSION", dbConfig)) {
if (userPreferencesVersionDb.count() == 0L) {
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry value = new DatabaseEntry();
StringBinding.stringToEntry(DEFAULT_VERSION, key);
LongBinding.longToEntry(System.currentTimeMillis(), value);
OperationStatus status = userPreferencesVersionDb.put(transaction, key, value);
if (status != OperationStatus.SUCCESS) {
throw new StoreException("Error initialising user preference version: " + status);
}
}
}
transaction.commit();
reportFinished(environment, 9);
} catch (RuntimeException e) {
try {
if (transaction.isValid()) {
transaction.abort();
}
} finally {
throw e;
}
}
}
use of com.sleepycat.je.DatabaseConfig in project sirix by sirixdb.
the class BerkeleyStorageFactory method generateDBConf.
/**
* Generate {@link DatabaseConfig} reference.
*
* @return transactional database configuration
*/
private static DatabaseConfig generateDBConf() {
final DatabaseConfig conf = new DatabaseConfig();
conf.setTransactional(true);
conf.setKeyPrefixing(true);
return conf;
}
use of com.sleepycat.je.DatabaseConfig in project vertigo by KleeGroup.
the class BerkeleyDatabase method clear.
/**
* Clear this database.
*/
public void clear() {
final String dataBaseName = database.getDatabaseName();
final DatabaseConfig databaseConfig = database.getConfig();
database.close();
database.getEnvironment().truncateDatabase(null, dataBaseName, false);
database = database.getEnvironment().openDatabase(null, dataBaseName, databaseConfig);
database.getEnvironment().cleanLog();
}
Aggregations