wchevreuil commented on code in PR #5471: URL: https://github.com/apache/hbase/pull/5471#discussion_r1366865774
########## hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestVerifyBucketCacheFile.java: ########## @@ -127,6 +127,7 @@ public void testRetrieveFromFile() throws Exception { bucketCache = new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, constructedBlockSize, constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence"); + Thread.sleep(100); Review Comment: Correct! Here's the detailed explanation: There's a trick in the BucketCache retrieveFromFile: We initialise the BucketAllocator based on the backing map state we recovered from the persistent cache. We need to do that to make the cache usable (see [here](https://github.com/apache/hbase/pull/5471/files#diff-b75abcdb76c582e16144df3a9bf2ddbc8fd0814c06190c33503a2c1cb365273cR1330)). That's alright because we also do the validation when reading individual blocks from the cache. So the now background validation thread needs to wait for the BucketAllocator to be instantiated as mentioned above (see [here](https://github.com/apache/hbase/pull/5471/files#diff-b75abcdb76c582e16144df3a9bf2ddbc8fd0814c06190c33503a2c1cb365273cR1410)). Only after that, it will start to validate the backing map against the cache and use evict for the invalid blocks (to update both backing map and the bucket allocator). And that causes the test check to fail if we reach the asserts before the background validation had evicted the invalid block. -- 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: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org