hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject svn commit: r1558041 - in /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver: HRegion.java HRegionFileSystem.java
Date Tue, 14 Jan 2014 14:14:48 GMT
Author: mbertozzi
Date: Tue Jan 14 14:14:48 2014
New Revision: 1558041

URL: http://svn.apache.org/r1558041
Log:
HBASE-10332 Missing .regioninfo file during daughter open processing

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1558041&r1=1558040&r2=1558041&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Tue Jan 14 14:14:48 2014
@@ -4156,11 +4156,14 @@ public class HRegion implements HeapSize
    * @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;
   }
 

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java?rev=1558041&r1=1558040&r2=1558041&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
Tue Jan 14 14:14:48 2014
@@ -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;
   }



Mime
View raw message