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:35:00 -08:00
parent 3464552bb0
commit ffb1e78c08
3 changed files with 20 additions and 7 deletions

View File

@ -579,7 +579,6 @@ public class HRegionFileSystem {
Path splitStoreFile(final HRegionInfo hri, final String familyName, final StoreFile f,
final byte[] splitRow, final boolean top, RegionSplitPolicy splitPolicy)
throws IOException {
if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck(familyName)) {
// Check whether the split row lies in the range of the store file
// If it is outside the range, return directly.
@ -608,7 +607,7 @@ public class HRegionFileSystem {
}
}
} finally {
f.closeReader(true);
f.closeReader(f.getCacheConf() != null ? f.getCacheConf().shouldEvictOnClose() : true);
}
}

View File

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

View File

@ -136,6 +136,10 @@ public class StoreFile {
private Comparator comparator;
CacheConfig getCacheConf() {
return cacheConf;
}
public Cell getFirstKey() {
return firstKey;
}
@ -515,7 +519,9 @@ public class StoreFile {
this.reader = open(canUseDropBehind);
} catch (IOException e) {
try {
this.closeReader(true);
boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
this.closeReader(evictOnClose);
} catch (IOException ee) {
}
throw e;
@ -550,7 +556,9 @@ public class StoreFile {
* @throws IOException
*/
public void deleteReader() throws IOException {
closeReader(true);
boolean evictOnClose =
cacheConf != null? cacheConf.shouldEvictOnClose(): true;
closeReader(evictOnClose);
this.fs.delete(getPath(), true);
}