HBASE-3502 Can't open region because can't open .regioninfo because AlreadyBeingCreatedException
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1067323 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8f33fc4cc
commit
f0e8ab83fd
|
@ -42,6 +42,8 @@ Release 0.91.0 - Unreleased
|
||||||
HBASE-3495 Shell is failing on subsequent split calls
|
HBASE-3495 Shell is failing on subsequent split calls
|
||||||
HBASE-3400 Coprocessor Support for Generic Interfaces
|
HBASE-3400 Coprocessor Support for Generic Interfaces
|
||||||
(Ed Kohlwey via Gary Helmling)
|
(Ed Kohlwey via Gary Helmling)
|
||||||
|
HBASE-3502 Can't open region because can't open .regioninfo because
|
||||||
|
AlreadyBeingCreatedException
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
|
@ -424,16 +424,17 @@ public class HRegion implements HeapSize { // , Writable{
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void checkRegioninfoOnFilesystem() throws IOException {
|
private void checkRegioninfoOnFilesystem() throws IOException {
|
||||||
// Name of this file has two leading and trailing underscores so it doesn't
|
Path regioninfoPath = new Path(this.regiondir, REGIONINFO_FILE);
|
||||||
// clash w/ a store/family name. There is possibility, but assumption is
|
if (this.fs.exists(regioninfoPath) &&
|
||||||
// that its slim (don't want to use control character in filename because
|
this.fs.getFileStatus(regioninfoPath).getLen() > 0) {
|
||||||
//
|
|
||||||
Path regioninfo = new Path(this.regiondir, REGIONINFO_FILE);
|
|
||||||
if (this.fs.exists(regioninfo) &&
|
|
||||||
this.fs.getFileStatus(regioninfo).getLen() > 0) {
|
|
||||||
return;
|
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 {
|
try {
|
||||||
this.regionInfo.write(out);
|
this.regionInfo.write(out);
|
||||||
out.write('\n');
|
out.write('\n');
|
||||||
|
@ -442,6 +443,10 @@ public class HRegion implements HeapSize { // , Writable{
|
||||||
} finally {
|
} finally {
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
if (!fs.rename(tmpPath, regioninfoPath)) {
|
||||||
|
throw new IOException("Unable to rename " + tmpPath + " to " +
|
||||||
|
regioninfoPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return a HRegionInfo object for this region */
|
/** @return a HRegionInfo object for this region */
|
||||||
|
|
Loading…
Reference in New Issue