HBASE-25691 Test failure: TestVerifyBucketCacheFile.testRetrieveFromFile (#3081)
authorhuaxiangsun <huaxiangsun@apache.org>
Wed, 24 Mar 2021 16:01:17 +0000 (09:01 -0700)
committerGitHub <noreply@github.com>
Wed, 24 Mar 2021 16:01:17 +0000 (09:01 -0700)
commit1e3fe3ceac323925d895d5e24b323bd056fc4b8e
tree788891c565328a67a82ff9ad48ed6070256f9fa1
parent202b17f4fc3229e91d584837776d53ed3e2e8adb
HBASE-25691 Test failure: TestVerifyBucketCacheFile.testRetrieveFromFile (#3081)

The issue is that FileInputStream is created with try-with-resources, so its close() is called right after the try sentence.
FileInputStream is a finalize class, when this object is garbage collected, its close() is called again.
To avoid this double-free resources, add guard against it.

Signed-off-by: stack <stack@apache.org>
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java