HBASE-14788 Splitting a region does not support the hbase.rs.evictblocksonclose config when closing source region

This commit is contained in:
tedyu 2015-11-10 18:38:32 -08:00
parent f782cab421
commit 37815cac9e
3 changed files with 20 additions and 6 deletions

View File

@ -608,7 +608,7 @@ public class HRegionFileSystem {
} }
} }
} finally { } finally {
f.closeReader(true); f.closeReader(f.getCacheConf() != null ? f.getCacheConf().shouldEvictOnClose() : true);
} }
} }

View File

@ -550,9 +550,11 @@ public class HStore implements Store {
} }
if (ioe != null) { if (ioe != null) {
// close StoreFile readers // close StoreFile readers
boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
for (StoreFile file : results) { for (StoreFile file : results) {
try { try {
if (file != null) file.closeReader(true); if (file != null) file.closeReader(evictOnClose);
} catch (IOException e) { } catch (IOException e) {
LOG.warn(e.getMessage()); LOG.warn(e.getMessage());
} }
@ -1224,10 +1226,12 @@ public class HStore implements Store {
if (!this.conf.getBoolean("hbase.hstore.compaction.complete", true)) { if (!this.conf.getBoolean("hbase.hstore.compaction.complete", true)) {
LOG.warn("hbase.hstore.compaction.complete is set to false"); LOG.warn("hbase.hstore.compaction.complete is set to false");
sfs = new ArrayList<StoreFile>(newFiles.size()); sfs = new ArrayList<StoreFile>(newFiles.size());
final boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
for (Path newFile : newFiles) { for (Path newFile : newFiles) {
// Create storefile around what we wrote with a reader on it. // Create storefile around what we wrote with a reader on it.
StoreFile sf = createStoreFileAndReader(newFile); StoreFile sf = createStoreFileAndReader(newFile);
sf.closeReader(true); sf.closeReader(evictOnClose);
sfs.add(sf); sfs.add(sf);
} }
return sfs; return sfs;
@ -1777,8 +1781,10 @@ public class HStore implements Store {
// let the archive util decide if we should archive or delete the files // let the archive util decide if we should archive or delete the files
LOG.debug("Removing store files after compaction..."); LOG.debug("Removing store files after compaction...");
boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
for (StoreFile compactedFile : compactedFiles) { for (StoreFile compactedFile : compactedFiles) {
compactedFile.closeReader(true); compactedFile.closeReader(evictOnClose);
} }
if (removeFiles) { if (removeFiles) {
this.fs.removeStoreFiles(this.getColumnFamilyName(), compactedFiles); this.fs.removeStoreFiles(this.getColumnFamilyName(), compactedFiles);

View File

@ -133,6 +133,10 @@ public class StoreFile {
private KVComparator comparator; private KVComparator comparator;
CacheConfig getCacheConf() {
return cacheConf;
}
public byte[] getFirstKey() { public byte[] getFirstKey() {
return firstKey; return firstKey;
} }
@ -499,7 +503,9 @@ public class StoreFile {
this.reader = open(canUseDropBehind); this.reader = open(canUseDropBehind);
} catch (IOException e) { } catch (IOException e) {
try { try {
this.closeReader(true); boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
this.closeReader(evictOnClose);
} catch (IOException ee) { } catch (IOException ee) {
} }
throw e; throw e;
@ -534,7 +540,9 @@ public class StoreFile {
* @throws IOException * @throws IOException
*/ */
public void deleteReader() throws IOException { public void deleteReader() throws IOException {
closeReader(true); boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
closeReader(evictOnClose);
this.fs.delete(getPath(), true); this.fs.delete(getPath(), true);
} }