mirror of
https://github.com/apache/lucene.git
synced 2025-03-07 17:12:46 +00:00
LUCENE-2010: don't assert no unref'd files in TIR.testDiskFull; fix rollback on exc during commit to put back any pruned segs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1063882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
471c0ced82
commit
e54599568d
lucene/src
@ -715,12 +715,16 @@ class DirectoryReader extends IndexReader implements Cloneable {
|
||||
// case we have to roll back:
|
||||
startCommit();
|
||||
|
||||
final SegmentInfos rollbackSegmentInfos = new SegmentInfos();
|
||||
rollbackSegmentInfos.addAll(segmentInfos);
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
for (int i = 0; i < subReaders.length; i++)
|
||||
subReaders[i].commit();
|
||||
|
||||
// Remove segments that contain only 100% deleted docs:
|
||||
// Remove segments that contain only 100% deleted
|
||||
// docs:
|
||||
segmentInfos.pruneDeletedSegments();
|
||||
|
||||
// Sync all files we just wrote
|
||||
@ -742,6 +746,10 @@ class DirectoryReader extends IndexReader implements Cloneable {
|
||||
// partially written .del files, etc, are
|
||||
// removed):
|
||||
deleter.refresh();
|
||||
|
||||
// Restore all SegmentInfos (in case we pruned some)
|
||||
segmentInfos.clear();
|
||||
segmentInfos.addAll(rollbackSegmentInfos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -996,15 +996,6 @@ public class TestIndexReader extends LuceneTestCase
|
||||
}
|
||||
}
|
||||
|
||||
// Whether we succeeded or failed, check that all
|
||||
// un-referenced files were in fact deleted (ie,
|
||||
// we did not create garbage). Just create a
|
||||
// new IndexFileDeleter, have it delete
|
||||
// unreferenced files, then verify that in fact
|
||||
// no files were deleted:
|
||||
IndexWriter.unlock(dir);
|
||||
TestIndexWriter.assertNoUnreferencedFiles(dir, "reader.close() failed to delete unreferenced files");
|
||||
|
||||
// Finally, verify index is not corrupt, and, if
|
||||
// we succeeded, we see all docs changed, and if
|
||||
// we failed, we see either all docs or no docs
|
||||
|
Loading…
x
Reference in New Issue
Block a user