mirror of https://github.com/apache/lucene.git
LUCNEE-1642: respect destination IW's CFS when copying tail segments in addIndexesNoOptimize
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@783748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd63593d66
commit
9dc231fb74
|
@ -3583,7 +3583,7 @@ public class IndexWriter {
|
|||
info = segmentInfos.info(i);
|
||||
if (info.dir != directory) {
|
||||
done = false;
|
||||
final MergePolicy.OneMerge newMerge = new MergePolicy.OneMerge(segmentInfos.range(i, 1+i), info.getUseCompoundFile());
|
||||
final MergePolicy.OneMerge newMerge = new MergePolicy.OneMerge(segmentInfos.range(i, 1+i), mergePolicy instanceof LogMergePolicy && getUseCompoundFile());
|
||||
|
||||
// Returns true if no running merge conflicts
|
||||
// with this one (and, records this merge as
|
||||
|
|
|
@ -537,4 +537,21 @@ public class TestAddIndexesNoOptimize extends LuceneTestCase {
|
|||
dir.close();
|
||||
dir2.close();
|
||||
}
|
||||
|
||||
// LUCENE-1642: make sure CFS of destination indexwriter
|
||||
// is respected when copying tail segments
|
||||
public void testTargetCFS() throws IOException {
|
||||
Directory dir = new RAMDirectory();
|
||||
IndexWriter writer = newWriter(dir, true);
|
||||
writer.setUseCompoundFile(false);
|
||||
addDocs(writer, 1);
|
||||
writer.close();
|
||||
|
||||
Directory other = new RAMDirectory();
|
||||
writer = newWriter(other, true);
|
||||
writer.setUseCompoundFile(true);
|
||||
writer.addIndexesNoOptimize(new Directory[] {dir});
|
||||
assertTrue(writer.newestSegment().getUseCompoundFile());
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue