mirror of https://github.com/apache/lucene.git
Fix TestIndexWriterOnDiskFull.testAddDocumentOnDiskFull to handle IllegalStateException from startCommit() (#11757)
If ConcurrentMergeScheduler is used, and the merge hits fatal exception (such as disk full) after prepareCommit()'s ensureOpen() check, then startCommit() will throw IllegalStateException instead of AlreadyClosedException. The test is currently not prepared to handle this: the logic is only geared around exceptions coming from addDocument() Closes #11755
This commit is contained in:
parent
f8285fd0fe
commit
f4146a44e9
|
@ -77,8 +77,20 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
|
|||
if (VERBOSE) {
|
||||
System.out.println("TEST: done adding docs; now commit");
|
||||
}
|
||||
try {
|
||||
// when calling commit(), if the writer is asynchronously closed
|
||||
// by a fatal tragedy (e.g. from disk-full-on-merge with CMS),
|
||||
// then we may receive either AlreadyClosedException OR IllegalStateException,
|
||||
// depending on when it happens.
|
||||
writer.commit();
|
||||
indexExists = true;
|
||||
} catch (IOException | IllegalStateException e) {
|
||||
if (VERBOSE) {
|
||||
System.out.println("TEST: exception on commit");
|
||||
e.printStackTrace(System.out);
|
||||
}
|
||||
hitError = true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
if (VERBOSE) {
|
||||
System.out.println("TEST: exception on addDoc");
|
||||
|
|
Loading…
Reference in New Issue