// lets use all the default values.
Props props = new Props();
props.put("node.id", 1);
props.put("voldemort.home", "test/common/voldemort/config");
VoldemortConfig voldemortConfig = new VoldemortConfig(props);
voldemortConfig.setBdbCacheSize(totalCache);
voldemortConfig.setBdbOneEnvPerStore(true);
voldemortConfig.setBdbDataDirectory(bdbMasterDir.toURI().getPath());
voldemortConfig.setBdbMinimumSharedCache(15 * ByteUtils.BYTES_PER_MB);
voldemortConfig.setBdbPrefixKeysWithPartitionId(prefixPartitionId);
BdbStorageEngine storeA = null;
bdbStorage = new BdbStorageConfiguration(voldemortConfig);
assertEquals("Reserved cache size not zero", 0, bdbStorage.getReservedCacheSize());
try {
StoreDefinition defA = TestUtils.makeStoreDefinition("storeA", shareA
/ ByteUtils.BYTES_PER_MB);
storeA = (BdbStorageEngine) bdbStorage.getStore(defA,
TestUtils.makeSingleNodeRoutingStrategy());
fail("Should have thrown exception since minSharedCache will be violated");
} catch(StorageInitializationException sie) {
// should come here.
}
// failing operations should not alter reserved cache size
assertEquals("failure somehow altered the reservedCacheSize",
0,
bdbStorage.getReservedCacheSize());
voldemortConfig.setBdbMinimumSharedCache(10 * ByteUtils.BYTES_PER_MB);
bdbStorage = new BdbStorageConfiguration(voldemortConfig);
try {
StoreDefinition defA = TestUtils.makeStoreDefinition("storeA", shareA
/ ByteUtils.BYTES_PER_MB);
storeA = (BdbStorageEngine) bdbStorage.getStore(defA,