LUCENE-6790: block commit while rollback runs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1702798 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-09-13 17:54:13 +00:00
parent 0c3b522d28
commit 690f6d6578
2 changed files with 12 additions and 4 deletions

View File

@ -131,6 +131,10 @@ Bug Fixes
too low (no highlight) or determine inOrder wrong.
(Tim Allison via David Smiley)
* LUCENE-6790: Fix IndexWriter thread safety when one thread is
handling a tragic exception but another is still committing (Mike
McCandless)
Other
* LUCENE-6174: Improve "ant eclipse" to select right JRE for building.

View File

@ -2014,15 +2014,19 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
// Ensure that only one thread actually gets to do the
// closing, and make sure no commit is also in progress:
synchronized(commitLock) {
if (shouldClose(true)) {
rollbackInternal();
}
if (shouldClose(true)) {
rollbackInternal();
}
}
private void rollbackInternal() throws IOException {
// Make sure no commit is running, else e.g. we can close while another thread is still fsync'ing:
synchronized(commitLock) {
rollbackInternalNoCommit();
}
}
private void rollbackInternalNoCommit() throws IOException {
boolean success = false;
if (infoStream.isEnabled("IW")) {