hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1462361 - /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Date Fri, 29 Mar 2013 00:07:28 GMT
Author: jxiang
Date: Fri Mar 29 00:07:28 2013
New Revision: 1462361

URL: http://svn.apache.org/r1462361
Log:
HBASE-8215 Removing existing .regioninfo in writeRegioninfoOnFilesystem

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1462361&r1=1462360&r2=1462361&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri
Mar 29 00:07:28 2013
@@ -778,10 +778,17 @@ public class HRegion implements HeapSize
   public static void writeRegioninfoOnFilesystem(HRegionInfo regionInfo, Path regiondir,
       FileSystem fs, Configuration conf) throws IOException {
     Path regioninfoPath = new Path(regiondir, REGIONINFO_FILE);
-    if (fs.exists(regioninfoPath) &&
-        fs.getFileStatus(regioninfoPath).getLen() > 0) {
-      return;
+    if (fs.exists(regioninfoPath)) {
+      if (fs.getFileStatus(regioninfoPath).getLen() > 0) {
+        return;
+      }
+
+      LOG.info("Rewriting .regioninfo file at: " + regioninfoPath);
+      if (!fs.delete(regioninfoPath, false)) {
+        throw new IOException("Unable to remove existing " + regioninfoPath);
+      }
     }
+
     // Create in tmpdir and then move into place in case we crash after
     // create but before close.  If we don't successfully close the file,
     // subsequent region reopens will fail the below because create is



Mime
View raw message