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, Path splitStoreFile(final HRegionInfo hri, final String familyName, final StoreFile f,
final byte[] splitRow, final boolean top, RegionSplitPolicy splitPolicy) final byte[] splitRow, final boolean top, RegionSplitPolicy splitPolicy)
throws IOException { throws IOException {
if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck(familyName)) { if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck(familyName)) {
// Check whether the split row lies in the range of the store file // Check whether the split row lies in the range of the store file
// If it is outside the range, return directly. // If it is outside the range, return directly.
@ -608,7 +607,7 @@ public class HRegionFileSystem {
} }
} }
} finally { } 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) { 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());
} }
@ -1244,10 +1246,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;
@ -1797,8 +1801,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

@ -136,6 +136,10 @@ public class StoreFile {
private Comparator comparator; private Comparator comparator;
CacheConfig getCacheConf() {
return cacheConf;
}
public Cell getFirstKey() { public Cell getFirstKey() {
return firstKey; return firstKey;
} }
@ -515,7 +519,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;
@ -550,7 +556,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);
} }