LUCENE-2610: addIndexes(Directory...) should not trigger merge on flush()

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@988084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2010-08-23 11:39:09 +00:00
parent 6a4bfc796f
commit d526694314
2 changed files with 3 additions and 1 deletions

View File

@ -2870,7 +2870,7 @@ public class IndexWriter implements Closeable {
try { try {
if (infoStream != null) if (infoStream != null)
message("flush at addIndexes(Directory...)"); message("flush at addIndexes(Directory...)");
flush(true, false, true); flush(false, false, true);
int docCount = 0; int docCount = 0;
List<SegmentInfo> infos = new ArrayList<SegmentInfo>(); List<SegmentInfo> infos = new ArrayList<SegmentInfo>();

View File

@ -327,6 +327,7 @@ public class TestSnapshotDeletionPolicy extends LuceneTestCaseJ4 {
writer.commit(); writer.commit();
writer.deleteUnusedFiles(); writer.deleteUnusedFiles();
assertSnapshotExists(dir, sdp, numSnapshots - 1); assertSnapshotExists(dir, sdp, numSnapshots - 1);
writer.close();
// but 'snapshot1' files will still exist (need to release snapshot before they can be deleted). // but 'snapshot1' files will still exist (need to release snapshot before they can be deleted).
String segFileName = sdp.getSnapshot("snapshot1").getSegmentsFileName(); String segFileName = sdp.getSnapshot("snapshot1").getSegmentsFileName();
@ -358,6 +359,7 @@ public class TestSnapshotDeletionPolicy extends LuceneTestCaseJ4 {
} }
assertNull(sdp.getSnapshots().get(snapId)); assertNull(sdp.getSnapshots().get(snapId));
writer.deleteUnusedFiles(); writer.deleteUnusedFiles();
writer.close();
assertFalse("segments file should not be found in dirctory: " + segFileName, dir.fileExists(segFileName)); assertFalse("segments file should not be found in dirctory: " + segFileName, dir.fileExists(segFileName));
dir.close(); dir.close();
} }