mirror of https://github.com/apache/lucene.git
MDW's assertNoUnreferencedFilesOnClose should still run even if checkIndexOnClose is turned off
This commit is contained in:
parent
53597e8f8e
commit
8e8aa0869e
|
@ -722,20 +722,22 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
|||
throw new RuntimeException("MockDirectoryWrapper: cannot close: there are still open locks: " + openLocks, cause);
|
||||
}
|
||||
|
||||
if (getCheckIndexOnClose()) {
|
||||
randomIOExceptionRate = 0.0;
|
||||
randomIOExceptionRateOnOpen = 0.0;
|
||||
|
||||
if (DirectoryReader.indexExists(this)) {
|
||||
if ((getCheckIndexOnClose() || assertNoUnreferencedFilesOnClose) && DirectoryReader.indexExists(this)) {
|
||||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("\nNOTE: MockDirectoryWrapper: now crush");
|
||||
}
|
||||
if (getCheckIndexOnClose()) {
|
||||
|
||||
crash(); // corrupt any unsynced-files
|
||||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("\nNOTE: MockDirectoryWrapper: now run CheckIndex");
|
||||
}
|
||||
|
||||
TestUtil.checkIndex(this, getCrossCheckTermVectorsOnClose(), true);
|
||||
}
|
||||
|
||||
// TODO: factor this out / share w/ TestIW.assertNoUnreferencedFiles
|
||||
if (assertNoUnreferencedFilesOnClose) {
|
||||
|
@ -797,7 +799,6 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
|||
assert numDocs1 == numDocs2 : "numDocs changed after opening/closing IW: before=" + numDocs1 + " after=" + numDocs2;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
} finally {
|
||||
if (success) {
|
||||
|
|
Loading…
Reference in New Issue