HBASE-24529 hbase.rs.evictblocksonclose is not honored when removing compacted files and closing the storefiles (#1881)
Signed-off-by: Anoop Sam John <anoop.hbase@gmail.com>
This commit is contained in:
parent
42a82df3af
commit
6b7a93d10c
|
@ -622,7 +622,8 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
for (HStoreFile storeFile : results) {
|
for (HStoreFile storeFile : results) {
|
||||||
if (compactedStoreFiles.contains(storeFile.getPath().getName())) {
|
if (compactedStoreFiles.contains(storeFile.getPath().getName())) {
|
||||||
LOG.warn("Clearing the compacted storefile {} from {}", storeFile, this);
|
LOG.warn("Clearing the compacted storefile {} from {}", storeFile, this);
|
||||||
storeFile.getReader().close(true);
|
storeFile.getReader().close(storeFile.getCacheConf() != null ?
|
||||||
|
storeFile.getCacheConf().shouldEvictOnClose() : true);
|
||||||
filesToRemove.add(storeFile);
|
filesToRemove.add(storeFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -956,7 +957,8 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
storeEngine.getStoreFileManager().clearCompactedFiles();
|
storeEngine.getStoreFileManager().clearCompactedFiles();
|
||||||
// clear the compacted files
|
// clear the compacted files
|
||||||
if (CollectionUtils.isNotEmpty(compactedfiles)) {
|
if (CollectionUtils.isNotEmpty(compactedfiles)) {
|
||||||
removeCompactedfiles(compactedfiles);
|
removeCompactedfiles(compactedfiles, cacheConf != null ?
|
||||||
|
cacheConf.shouldEvictOnClose() : true);
|
||||||
}
|
}
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
// initialize the thread pool for closing store files in parallel.
|
// initialize the thread pool for closing store files in parallel.
|
||||||
|
@ -2705,7 +2707,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
lock.readLock().unlock();
|
lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(copyCompactedfiles)) {
|
if (CollectionUtils.isNotEmpty(copyCompactedfiles)) {
|
||||||
removeCompactedfiles(copyCompactedfiles);
|
removeCompactedfiles(copyCompactedfiles, true);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
archiveLock.unlock();
|
archiveLock.unlock();
|
||||||
|
@ -2715,8 +2717,10 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
/**
|
/**
|
||||||
* Archives and removes the compacted files
|
* Archives and removes the compacted files
|
||||||
* @param compactedfiles The compacted files in this store that are not active in reads
|
* @param compactedfiles The compacted files in this store that are not active in reads
|
||||||
|
* @param evictOnClose true if blocks should be evicted from the cache when an HFile reader is
|
||||||
|
* closed, false if not
|
||||||
*/
|
*/
|
||||||
private void removeCompactedfiles(Collection<HStoreFile> compactedfiles)
|
private void removeCompactedfiles(Collection<HStoreFile> compactedfiles, boolean evictOnClose)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final List<HStoreFile> filesToRemove = new ArrayList<>(compactedfiles.size());
|
final List<HStoreFile> filesToRemove = new ArrayList<>(compactedfiles.size());
|
||||||
final List<Long> storeFileSizes = new ArrayList<>(compactedfiles.size());
|
final List<Long> storeFileSizes = new ArrayList<>(compactedfiles.size());
|
||||||
|
@ -2741,7 +2745,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
LOG.trace("Closing and archiving the file {}", file);
|
LOG.trace("Closing and archiving the file {}", file);
|
||||||
// Copy the file size before closing the reader
|
// Copy the file size before closing the reader
|
||||||
final long length = r.length();
|
final long length = r.length();
|
||||||
r.close(true);
|
r.close(evictOnClose);
|
||||||
// Just close and return
|
// Just close and return
|
||||||
filesToRemove.add(file);
|
filesToRemove.add(file);
|
||||||
// Only add the length if we successfully added the file to `filesToRemove`
|
// Only add the length if we successfully added the file to `filesToRemove`
|
||||||
|
|
Loading…
Reference in New Issue