use of org.apache.hadoop.ozone.container.metadata.AbstractDatanodeStore in project ozone by apache.
the class TestKeyValueContainer method testDBProfileAffectsDBOptions.
@Test
public void testDBProfileAffectsDBOptions() throws Exception {
// Create Container 1
keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
DatanodeDBProfile outProfile1;
try (ReferenceCountedDB db1 = BlockUtils.getDB(keyValueContainer.getContainerData(), CONF)) {
DatanodeStore store1 = db1.getStore();
Assert.assertTrue(store1 instanceof AbstractDatanodeStore);
outProfile1 = ((AbstractDatanodeStore) store1).getDbProfile();
}
// Create Container 2 with different DBProfile in otherConf
OzoneConfiguration otherConf = new OzoneConfiguration();
// Use a dedicated profile for test
otherConf.setEnum(HDDS_DB_PROFILE, DBProfile.SSD);
keyValueContainerData = new KeyValueContainerData(2L, layout, (long) StorageUnit.GB.toBytes(5), UUID.randomUUID().toString(), datanodeId.toString());
keyValueContainer = new KeyValueContainer(keyValueContainerData, otherConf);
keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
DatanodeDBProfile outProfile2;
try (ReferenceCountedDB db2 = BlockUtils.getDB(keyValueContainer.getContainerData(), otherConf)) {
DatanodeStore store2 = db2.getStore();
Assert.assertTrue(store2 instanceof AbstractDatanodeStore);
outProfile2 = ((AbstractDatanodeStore) store2).getDbProfile();
}
// DBOtions should be different
Assert.assertNotEquals(outProfile1.getDBOptions().compactionReadaheadSize(), outProfile2.getDBOptions().compactionReadaheadSize());
}
Aggregations