You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/02/04 23:55:23 UTC
svn commit: r1067322 - in /hbase/branches/0.90: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Author: stack
Date: Fri Feb 4 22:55:23 2011
New Revision: 1067322
URL: http://svn.apache.org/viewvc?rev=1067322&view=rev
Log:
HBASE-3502 Can't open region because can't open .regioninfo because AlreadyBeingCreatedException
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1067322&r1=1067321&r2=1067322&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Fri Feb 4 22:55:23 2011
@@ -17,6 +17,8 @@ Release 0.90.1 - Unreleased
HBASE-3416 For intra-row scanning, the update readers notification resets
the query matcher and can lead to incorrect behavior
HBASE-3495 Shell is failing on subsequent split calls
+ HBASE-3502 Can't open region because can't open .regioninfo because
+ AlreadyBeingCreatedException
IMPROVEMENTS
Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1067322&r1=1067321&r2=1067322&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri Feb 4 22:55:23 2011
@@ -403,16 +403,17 @@ public class HRegion implements HeapSize
* @throws IOException
*/
private void checkRegioninfoOnFilesystem() throws IOException {
- // Name of this file has two leading and trailing underscores so it doesn't
- // clash w/ a store/family name. There is possibility, but assumption is
- // that its slim (don't want to use control character in filename because
- //
- Path regioninfo = new Path(this.regiondir, REGIONINFO_FILE);
- if (this.fs.exists(regioninfo) &&
- this.fs.getFileStatus(regioninfo).getLen() > 0) {
+ Path regioninfoPath = new Path(this.regiondir, REGIONINFO_FILE);
+ if (this.fs.exists(regioninfoPath) &&
+ this.fs.getFileStatus(regioninfoPath).getLen() > 0) {
return;
}
- FSDataOutputStream out = this.fs.create(regioninfo, true);
+ // 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
+ // registered in NN.
+ Path tmpPath = new Path(getTmpDir(), REGIONINFO_FILE);
+ FSDataOutputStream out = this.fs.create(tmpPath, true);
try {
this.regionInfo.write(out);
out.write('\n');
@@ -421,6 +422,10 @@ public class HRegion implements HeapSize
} finally {
out.close();
}
+ if (!fs.rename(tmpPath, regioninfoPath)) {
+ throw new IOException("Unable to rename " + tmpPath + " to " +
+ regioninfoPath);
+ }
}
/** @return a HRegionInfo object for this region */