mirror of https://github.com/apache/lucene.git
- Changed the code so debug output for each merge is on a single line:
merging segments _b (1 docs) _c (1 docs) into _d (2 docs) merging segments _a (10 docs) _d (2 docs) into _e (12 docs) git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150251 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c513a55a59
commit
3a2871b740
|
@ -462,30 +462,29 @@ public class IndexWriter {
|
|||
for (int i = minSegment; i < segmentInfos.size(); i++) {
|
||||
SegmentInfo si = segmentInfos.info(i);
|
||||
if (infoStream != null)
|
||||
infoStream.print(" " + si.name + " (" + si.docCount + " docs)");
|
||||
infoStream.print(" " + si.name + " (" + si.docCount + " docs)");
|
||||
IndexReader reader = new SegmentReader(si);
|
||||
merger.add(reader);
|
||||
if ((reader.directory()==this.directory) || // if we own the directory
|
||||
(reader.directory()==this.ramDirectory))
|
||||
segmentsToDelete.addElement(reader); // queue segment for deletion
|
||||
if ((reader.directory() == this.directory) || // if we own the directory
|
||||
(reader.directory() == this.ramDirectory))
|
||||
segmentsToDelete.addElement(reader); // queue segment for deletion
|
||||
}
|
||||
|
||||
int mergedDocCount = merger.merge();
|
||||
|
||||
if (infoStream != null) {
|
||||
infoStream.println();
|
||||
infoStream.println(" into "+mergedName+" ("+mergedDocCount+" docs)");
|
||||
}
|
||||
|
||||
segmentInfos.setSize(minSegment); // pop old infos & add new
|
||||
segmentInfos.setSize(minSegment); // pop old infos & add new
|
||||
segmentInfos.addElement(new SegmentInfo(mergedName, mergedDocCount,
|
||||
directory));
|
||||
|
||||
synchronized (directory) { // in- & inter-process sync
|
||||
synchronized (directory) { // in- & inter-process sync
|
||||
new Lock.With(directory.makeLock(IndexWriter.COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT) {
|
||||
public Object doBody() throws IOException {
|
||||
segmentInfos.write(directory); // commit before deleting
|
||||
deleteSegments(segmentsToDelete); // delete now-unused segments
|
||||
segmentInfos.write(directory); // commit before deleting
|
||||
deleteSegments(segmentsToDelete); // delete now-unused segments
|
||||
return null;
|
||||
}
|
||||
}.run();
|
||||
|
|
Loading…
Reference in New Issue