HBASE-6318 SplitLogWorker exited due to ConcurrentModificationException

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1358330 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2012-07-06 18:18:38 +00:00
parent edfbb77dc5
commit 2c48f28239
1 changed files with 29 additions and 16 deletions

View File

@ -1293,7 +1293,7 @@ public class HLogSplitter {
boolean progress_failed = false;
try {
for (int i = 0; i < logWriters.size(); i++) {
for (int i = 0, n = logWriters.size(); i < n; i++) {
Future<Void> future = completionService.take();
future.get();
if (!progress_failed && !reportProgressIfIsDistributedLogSplitting()) {
@ -1327,18 +1327,36 @@ public class HLogSplitter {
if (thrown == null) {
thrown = Lists.newArrayList();
}
for (WriterAndPath wap : logWriters.values()) {
try {
wap.w.close();
} catch (IOException ioe) {
LOG.error("Couldn't close log at " + wap.p, ioe);
thrown.add(ioe);
continue;
try {
for (WriterThread t : writerThreads) {
while (t.isAlive()) {
t.shouldStop = true;
t.interrupt();
try {
t.join(10);
} catch (InterruptedException e) {
IOException iie = new InterruptedIOException();
iie.initCause(e);
throw iie;
}
}
}
LOG.info("Closed path " + wap.p + " (wrote " + wap.editsWritten
+ " edits in " + (wap.nanosSpent / 1000 / 1000) + "ms)");
} finally {
synchronized (logWriters) {
for (WriterAndPath wap : logWriters.values()) {
try {
wap.w.close();
} catch (IOException ioe) {
LOG.error("Couldn't close log at " + wap.p, ioe);
thrown.add(ioe);
continue;
}
LOG.info("Closed path " + wap.p + " (wrote " + wap.editsWritten
+ " edits in " + (wap.nanosSpent / 1000 / 1000) + "ms)");
}
}
logWritersClosed = true;
}
logWritersClosed = true;
}
return thrown;
}
@ -1424,11 +1442,6 @@ public class HLogSplitter {
/* Number of nanos spent writing to this log */
long nanosSpent = 0;
/* To check whether a close has already been tried on the
* writer
*/
boolean writerClosed = false;
WriterAndPath(final Path p, final Writer w) {
this.p = p;
this.w = w;