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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]