Search in sources :

Example 1 with AbstractDatanodeStore

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());
}
Also used : DatanodeDBProfile(org.apache.hadoop.ozone.container.common.utils.db.DatanodeDBProfile) DatanodeStore(org.apache.hadoop.ozone.container.metadata.DatanodeStore) AbstractDatanodeStore(org.apache.hadoop.ozone.container.metadata.AbstractDatanodeStore) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) AbstractDatanodeStore(org.apache.hadoop.ozone.container.metadata.AbstractDatanodeStore) ReferenceCountedDB(org.apache.hadoop.ozone.container.common.utils.ReferenceCountedDB) Test(org.junit.Test)

Aggregations

OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)1 ReferenceCountedDB (org.apache.hadoop.ozone.container.common.utils.ReferenceCountedDB)1 DatanodeDBProfile (org.apache.hadoop.ozone.container.common.utils.db.DatanodeDBProfile)1 AbstractDatanodeStore (org.apache.hadoop.ozone.container.metadata.AbstractDatanodeStore)1 DatanodeStore (org.apache.hadoop.ozone.container.metadata.DatanodeStore)1 Test (org.junit.Test)1