saintstack commented on a change in pull request #333: [HBASE-22606] :
BucketCache additional tests
URL: https://github.com/apache/hbase/pull/333#discussion_r296838043
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java
##########
@@ -277,28 +311,49 @@ public void testRetrieveFromFile() throws Exception {
}
usedSize = bucketCache.getAllocator().getUsedSize();
assertNotEquals(0, usedSize);
- // persist cache to file
bucketCache.shutdown();
assertTrue(new File(persistencePath).exists());
-
- // restore cache from file
bucketCache = new BucketCache(ioEngineName, capacitySize,
constructedBlockSize,
- constructedBlockSizes, writeThreads, writerQLen, persistencePath);
+ constructedBlockSizes, writeThreads, writerQLen, persistencePath);
assertFalse(new File(persistencePath).exists());
assertEquals(usedSize, bucketCache.getAllocator().getUsedSize());
- // persist cache to file
bucketCache.shutdown();
assertTrue(new File(persistencePath).exists());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testRetrieveFailure() throws Exception {
+ HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ Path testDir = TEST_UTIL.getDataTestDir();
+ TEST_UTIL.getTestFileSystem().mkdirs(testDir);
+ final String ioEngineName = testDir + "/bucket.cache";
+ testRetrievalUtils(testDir, ioEngineName);
+ }
- // reconfig buckets sizes, the biggest bucket is small than
constructedBlockSize (8k or 16k)
- // so it can't restore cache from file
- int[] smallBucketSizes = new int[] { 2 * 1024 + 1024, 4 * 1024 + 1024 };
+ @Test
+ public void testRetrieveFromFileWithoutPersistence() throws Exception {
+ HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
Review comment:
Or is it that we sometimes create a new HTU? Not always? If so, we should be
consistent... do one or the other...... but not a mix.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services