jhungund commented on code in PR #5856:
URL: https://github.com/apache/hbase/pull/5856#discussion_r1584796011


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDataTieringManager.java:
##########
@@ -402,11 +408,74 @@ public void testBlockEvictionsHotBlocks() throws 
Exception {
     validateBlocks(bucketCache.getBackingMap().keySet(), 2, 2, 0);
   }
 
+  @Test
+  public void testFeatureKeyDisabled() throws Exception {
+    DataTieringManager.resetForTestingOnly();
+    defaultConf.setBoolean(DataTieringManager.GLOBAL_DATA_TIERING_ENABLED_KEY, 
false);
+    try {
+      assertFalse(DataTieringManager.instantiate(defaultConf, 
testOnlineRegions));
+      // Verify that the DataaTieringManager instance is not instantiated in 
the
+      // instantiate call above.
+      assertNull(DataTieringManager.getInstance());
+
+      // Also validate that data temperature is not honoured.
+      long capacitySize = 40 * 1024;
+      int writeThreads = 3;
+      int writerQLen = 64;
+      int[] bucketSizes = new int[] { 8 * 1024 + 1024 };
+
+      // Setup: Create a bucket cache with lower capacity
+      BucketCache bucketCache =
+        new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, 
8192, bucketSizes,
+          writeThreads, writerQLen, null, DEFAULT_ERROR_TOLERATION_DURATION, 
defaultConf);
+
+      // Create three Cache keys with two hot data blocks and one cold data 
block
+      // hStoreFiles.get(0) is a hot data file and hStoreFiles.get(3) is a 
cold data file.
+      List<BlockCacheKey> cacheKeys = new ArrayList<>();
+      cacheKeys.add(new BlockCacheKey(hStoreFiles.get(0).getPath(), 0, true, 
BlockType.DATA));
+      cacheKeys.add(new BlockCacheKey(hStoreFiles.get(0).getPath(), 8192, 
true, BlockType.DATA));
+      cacheKeys.add(new BlockCacheKey(hStoreFiles.get(3).getPath(), 0, true, 
BlockType.DATA));
+
+      // Create dummy data to be cached and fill the cache completely.
+      CacheTestUtils.HFileBlockPair[] blocks = 
CacheTestUtils.generateHFileBlocks(8192, 3);
+
+      int blocksIter = 0;
+      for (BlockCacheKey key : cacheKeys) {
+        LOG.info("Adding {}", key);

Review Comment:
   The test seems to work with the latest fixes. However, I am keeping these 
logs handy until the flakyness is fixed. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to