HBASE-10332 Missing .regioninfo file during daughter open processing

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1558033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mbertozzi 2014-01-14 13:26:54 +00:00
parent 086b0ebcb6
commit 4970f6f3dd
2 changed files with 14 additions and 3 deletions

View File

@ -4385,11 +4385,14 @@ public class HRegion implements HeapSize { // , Writable{
* @throws IOException
*/
HRegion createDaughterRegionFromSplits(final HRegionInfo hri) throws IOException {
// Move the files from the temporary .splits to the final /table/region directory
fs.commitDaughterRegion(hri);
// Create the daughter HRegion instance
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), this.getLog(), fs.getFileSystem(),
this.getBaseConf(), hri, this.getTableDesc(), rsServices);
r.readRequestsCount.set(this.getReadRequestsCount() / 2);
r.writeRequestsCount.set(this.getWriteRequestsCount() / 2);
fs.commitDaughterRegion(hri);
return r;
}

View File

@ -483,8 +483,16 @@ public class HRegionFileSystem {
Path commitDaughterRegion(final HRegionInfo regionInfo) throws IOException {
Path regionDir = new Path(this.tableDir, regionInfo.getEncodedName());
Path daughterTmpDir = this.getSplitsDir(regionInfo);
if (fs.exists(daughterTmpDir) && !rename(daughterTmpDir, regionDir)) {
throw new IOException("Unable to rename " + daughterTmpDir + " to " + regionDir);
if (fs.exists(daughterTmpDir)) {
// Write HRI to a file in case we need to recover hbase:meta
Path regionInfoFile = new Path(daughterTmpDir, REGION_INFO_FILE);
byte[] regionInfoContent = getRegionInfoFileContent(regionInfo);
writeRegionInfoFileContent(conf, fs, regionInfoFile, regionInfoContent);
// Move the daughter temp dir to the table dir
if (!rename(daughterTmpDir, regionDir)) {
throw new IOException("Unable to rename " + daughterTmpDir + " to " + regionDir);
}
}
return regionDir;
}