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:
parent
086b0ebcb6
commit
4970f6f3dd
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue