You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/12/30 14:58:49 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #948: HBASE-23588 : Cache index & bloom blocks on write if CacheCompactedBl…

virajjasani commented on a change in pull request #948: HBASE-23588 : Cache index & bloom blocks on write if CacheCompactedBl…
URL: https://github.com/apache/hbase/pull/948#discussion_r359691101
 
 

 ##########
 File path: hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCacheOnWrite.java
 ##########
 @@ -462,22 +472,34 @@ private void testCachingDataBlocksDuringCompactionInternals(boolean useTags,
       LOG.debug("compactStores() returned");
 
       boolean dataBlockCached = false;
+      boolean bloomBlockCached = false;
+      boolean indexBlockCached = false;
       for (CachedBlock block : blockCache) {
-        if (BlockType.ENCODED_DATA.equals(block.getBlockType())
-            || BlockType.DATA.equals(block.getBlockType())) {
+        if (DATA_BLOCK_TYPES.contains(block.getBlockType())) {
           dataBlockCached = true;
-          break;
+        } else if (BLOOM_BLOCK_TYPES.contains(block.getBlockType())) {
+          bloomBlockCached = true;
+        } else if (INDEX_BLOCK_TYPES.contains(block.getBlockType())) {
+          indexBlockCached = true;
         }
       }
 
       // Data blocks should be cached in instances where we are caching blocks on write. In the case
       // of testing
       // BucketCache, we cannot verify block type as it is not stored in the cache.
-      assertTrue(
-        "\nTest description: " + testDescription + "\ncacheBlocksOnCompaction: "
-            + cacheBlocksOnCompaction + "\n",
-        (cacheBlocksOnCompaction && !(blockCache instanceof BucketCache)) == dataBlockCached);
 
+      boolean cacheOnCompactAndNonBucketCache = cacheBlocksOnCompaction
+        && !(blockCache instanceof BucketCache);
+
+      String assertErrorMessage = "\nTest description: " + testDescription +
+        "\ncacheBlocksOnCompaction: "
+        + cacheBlocksOnCompaction + "\n";
+
+      assertEquals(assertErrorMessage, cacheOnCompactAndNonBucketCache, dataBlockCached);
+      if (cacheOnCompactAndNonBucketCache) {
+        assertTrue(assertErrorMessage, bloomBlockCached);
 
 Review comment:
   ```
   [INFO] 
   [INFO] -------------------------------------------------------
   [INFO]  T E S T S
   [INFO] -------------------------------------------------------
   [INFO] Running org.apache.hadoop.hbase.io.hfile.TestCacheOnWrite
   [INFO] Tests run: 72, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 94.853 s - in org.apache.hadoop.hbase.io.hfile.TestCacheOnWrite
   [INFO] 
   [INFO] Results:
   [INFO] 
   [INFO] Tests run: 72, Failures: 0, Errors: 0, Skipped: 0
   [INFO] 
   [INFO] 
   [INFO] --- maven-surefire-plugin:2.22.2:test (secondPartTestsExecution) @ hbase-server ---
   [INFO] Tests are skipped.
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 01:58 min
   [INFO] Finished at: 2019-12-19T10:51:45+05:30
   [INFO] ------------------------------------------------------------------------
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services