HBASE-5009 Failure of creating split dir if it already exists prevents splits from happening further

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1225153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-12-28 10:07:31 +00:00
parent 2dcc010d36
commit 270122168b
3 changed files with 16 additions and 5 deletions

View File

@ -843,8 +843,9 @@ Release 0.90.6 - Unreleased
BUG FIXES BUG FIXES
HBASE-4970 Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao) HBASE-4970 Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)
HBASE-5060 HBase client is blocked forever (Jinchao) HBASE-5060 HBase client is blocked forever (Jinchao)
HBASE-5009 Failure of creating split dir if it already exists prevents splits from happening further
Release 0.90.5 - Unreleased Release 0.90.5 - Released
BUG FIXES BUG FIXES
HBASE-4160 HBase shell move and online may be unusable if region name HBASE-4160 HBase shell move and online may be unusable if region name

View File

@ -125,8 +125,7 @@ public class Reference implements Writable {
public Path write(final FileSystem fs, final Path p) public Path write(final FileSystem fs, final Path p)
throws IOException { throws IOException {
FSUtils.create(fs, p); FSDataOutputStream out = fs.create(p, false);
FSDataOutputStream out = fs.create(p);
try { try {
write(out); write(out);
} finally { } finally {
@ -153,4 +152,4 @@ public class Reference implements Writable {
in.close(); in.close();
} }
} }
} }

View File

@ -529,7 +529,14 @@ public class SplitTransaction {
*/ */
private static void createSplitDir(final FileSystem fs, final Path splitdir) private static void createSplitDir(final FileSystem fs, final Path splitdir)
throws IOException { throws IOException {
if (fs.exists(splitdir)) throw new IOException("Splitdir already exits? " + splitdir); if (fs.exists(splitdir)) {
LOG.info("The " + splitdir
+ " directory exists. Hence deleting it to recreate it");
if (!fs.delete(splitdir, true)) {
throw new IOException("Failed deletion of " + splitdir
+ " before creating them again.");
}
}
if (!fs.mkdirs(splitdir)) throw new IOException("Failed create of " + splitdir); if (!fs.mkdirs(splitdir)) throw new IOException("Failed create of " + splitdir);
} }
@ -589,6 +596,10 @@ public class SplitTransaction {
this.fileSplitTimeout, TimeUnit.MILLISECONDS); this.fileSplitTimeout, TimeUnit.MILLISECONDS);
if (stillRunning) { if (stillRunning) {
threadPool.shutdownNow(); threadPool.shutdownNow();
// wait for the thread to shutdown completely.
while (!threadPool.isTerminated()) {
Thread.sleep(50);
}
throw new IOException("Took too long to split the" + throw new IOException("Took too long to split the" +
" files and create the references, aborting split"); " files and create the references, aborting split");
} }