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 2022/12/02 00:51:31 UTC
[GitHub] [hbase] taklwu commented on a diff in pull request #3280: HBASE-25899 Improve efficiency of SnapshotHFileCleaner
taklwu commented on code in PR #3280:
URL: https://github.com/apache/hbase/pull/3280#discussion_r1037692412
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java:
##########
@@ -200,13 +200,17 @@ public synchronized Iterable<FileStatus> getUnreferencedFiles(Iterable<FileStatu
"skip to clean the HFiles this time");
return unReferencedFiles;
}
+ ImmutableSet<String> currentCache = cache;
for (FileStatus file : files) {
String fileName = file.getPath().getName();
- if (!refreshed && !cache.contains(fileName)) {
- refreshCache();
- refreshed = true;
+ if (!refreshed && !currentCache.contains(fileName)) {
+ synchronized (this) {
+ refreshCache();
+ currentCache = cache;
+ refreshed = true;
+ }
}
Review Comment:
I found this line is still blocking the delete tasks... basically I LOG.info/print the lock information before the line of `if (lock == null || lock.tryLock()) {` , I found it won't add any `unReferencedFiles` file because once a `synchronized` refresh cache in line 207 is being called e.g. `java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock@568e37c0[Locked by thread hfile_cleaner-dir-scan-pool-2] ` , then whatever files passing in will be skipped.
maybe I'm wondered, why do we need a write lock for refreshing snapshot file cache ?
--
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-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org