|
@@ -84,7 +84,6 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
private static DistributedFileSystem fs;
|
|
private static DistributedFileSystem fs;
|
|
private static DataNode dn;
|
|
private static DataNode dn;
|
|
private static FsDatasetCache cacheManager;
|
|
private static FsDatasetCache cacheManager;
|
|
- private static PmemMappableBlockLoader cacheLoader;
|
|
|
|
/**
|
|
/**
|
|
* Used to pause DN BPServiceActor threads. BPSA threads acquire the
|
|
* Used to pause DN BPServiceActor threads. BPSA threads acquire the
|
|
* shared read lock. The test acquires the write lock for exclusive access.
|
|
* shared read lock. The test acquires the write lock for exclusive access.
|
|
@@ -131,8 +130,6 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
DFSConfigKeys.DFS_NAMENODE_PATH_BASED_CACHE_REFRESH_INTERVAL_MS, 100);
|
|
DFSConfigKeys.DFS_NAMENODE_PATH_BASED_CACHE_REFRESH_INTERVAL_MS, 100);
|
|
conf.setLong(DFSConfigKeys.DFS_CACHEREPORT_INTERVAL_MSEC_KEY, 500);
|
|
conf.setLong(DFSConfigKeys.DFS_CACHEREPORT_INTERVAL_MSEC_KEY, 500);
|
|
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE);
|
|
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE);
|
|
- conf.setLong(DFSConfigKeys.DFS_DATANODE_MAX_LOCKED_MEMORY_KEY,
|
|
|
|
- CACHE_CAPACITY);
|
|
|
|
conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
|
|
conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
|
|
conf.setInt(DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_KEY, 10);
|
|
conf.setInt(DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_KEY, 10);
|
|
|
|
|
|
@@ -153,7 +150,6 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
fs = cluster.getFileSystem();
|
|
fs = cluster.getFileSystem();
|
|
dn = cluster.getDataNodes().get(0);
|
|
dn = cluster.getDataNodes().get(0);
|
|
cacheManager = ((FsDatasetImpl) dn.getFSDataset()).cacheManager;
|
|
cacheManager = ((FsDatasetImpl) dn.getFSDataset()).cacheManager;
|
|
- cacheLoader = (PmemMappableBlockLoader) cacheManager.getCacheLoader();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@After
|
|
@After
|
|
@@ -216,7 +212,9 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
Ints.checkedCast(CACHE_CAPACITY / BLOCK_SIZE);
|
|
Ints.checkedCast(CACHE_CAPACITY / BLOCK_SIZE);
|
|
BlockReaderTestUtil.enableHdfsCachingTracing();
|
|
BlockReaderTestUtil.enableHdfsCachingTracing();
|
|
Assert.assertEquals(0, CACHE_CAPACITY % BLOCK_SIZE);
|
|
Assert.assertEquals(0, CACHE_CAPACITY % BLOCK_SIZE);
|
|
- assertEquals(CACHE_CAPACITY, cacheManager.getPmemCacheCapacity());
|
|
|
|
|
|
+ assertEquals(CACHE_CAPACITY, cacheManager.getCacheCapacity());
|
|
|
|
+ // DRAM cache is expected to be disabled.
|
|
|
|
+ assertEquals(0L, cacheManager.getMemCacheCapacity());
|
|
|
|
|
|
final Path testFile = new Path("/testFile");
|
|
final Path testFile = new Path("/testFile");
|
|
final long testFileLen = maxCacheBlocksNum * BLOCK_SIZE;
|
|
final long testFileLen = maxCacheBlocksNum * BLOCK_SIZE;
|
|
@@ -246,7 +244,9 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
}, 1000, 30000);
|
|
}, 1000, 30000);
|
|
|
|
|
|
// The pmem cache space is expected to have been used up.
|
|
// The pmem cache space is expected to have been used up.
|
|
- assertEquals(CACHE_CAPACITY, cacheManager.getPmemCacheUsed());
|
|
|
|
|
|
+ assertEquals(CACHE_CAPACITY, cacheManager.getCacheUsed());
|
|
|
|
+ // There should be no cache used on DRAM.
|
|
|
|
+ assertEquals(0L, cacheManager.getMemCacheUsed());
|
|
Map<ExtendedBlockId, Byte> blockKeyToVolume =
|
|
Map<ExtendedBlockId, Byte> blockKeyToVolume =
|
|
PmemVolumeManager.getInstance().getBlockKeyToVolume();
|
|
PmemVolumeManager.getInstance().getBlockKeyToVolume();
|
|
// All block keys should be kept in blockKeyToVolume
|
|
// All block keys should be kept in blockKeyToVolume
|
|
@@ -318,7 +318,7 @@ public class TestCacheByPmemMappableBlockLoader {
|
|
}, 1000, 30000);
|
|
}, 1000, 30000);
|
|
|
|
|
|
// It is expected that no pmem cache space is used.
|
|
// It is expected that no pmem cache space is used.
|
|
- assertEquals(0, cacheManager.getPmemCacheUsed());
|
|
|
|
|
|
+ assertEquals(0, cacheManager.getCacheUsed());
|
|
// No record should be kept by blockKeyToVolume after testFile is uncached.
|
|
// No record should be kept by blockKeyToVolume after testFile is uncached.
|
|
assertEquals(blockKeyToVolume.size(), 0);
|
|
assertEquals(blockKeyToVolume.size(), 0);
|
|
}
|
|
}
|