[ https://issues.apache.org/jira/browse/LUCENE-2680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Rutherglen updated LUCENE-2680: ------------------------------------- Attachment: LUCENE-2680.patch Here's a nice little checkpoint with more tests passing. * A last known segment is recorded, which is the last segment seen when adding a delete term/query per segment. This is for a applyDeletesAll check to ensure a given query/term has not already been applied to a segment. If a term/query exists in the per-segment deletes and is in deletesFlushed, we delete, unless we're beyond the last known segment, at which point we simply delete (adhering of course to the docid-upto). * In the interest of accuracy I nixed lastSegmentIndex in favor of lastSegmentInfo which is easier for debugging and implementation when segments are shuffled around and/or removed/added. There's not too much of a penalty in terms of performance. * org.apache.lucene.index tests pass * I need to address the applying deletes only on readers within the docid-upto per term/query, perhaps that's best left to a different Jira issue. * Still not committable as it needs cleaning up, complete unit tests, who knows what else. > Improve how IndexWriter flushes deletes against existing segments > ----------------------------------------------------------------- > > Key: LUCENE-2680 > URL: https://issues.apache.org/jira/browse/LUCENE-2680 > Project: Lucene - Java > Issue Type: Improvement > Reporter: Michael McCandless > Fix For: 4.0 > > Attachments: LUCENE-2680.patch, LUCENE-2680.patch, LUCENE-2680.patch, > LUCENE-2680.patch > > > IndexWriter buffers up all deletes (by Term and Query) and only > applies them if 1) commit or NRT getReader() is called, or 2) a merge > is about to kickoff. > We do this because, for a large index, it's very costly to open a > SegmentReader for every segment in the index. So we defer as long as > we can. We do it just before merge so that the merge can eliminate > the deleted docs. > But, most merges are small, yet in a big index we apply deletes to all > of the segments, which is really very wasteful. > Instead, we should only apply the buffered deletes to the segments > that are about to be merged, and keep the buffer around for the > remaining segments. > I think it's not so hard to do; we'd have to have generations of > pending deletions, because the newly merged segment doesn't need the > same buffered deletions applied again. So every time a merge kicks > off, we pinch off the current set of buffered deletions, open a new > set (the next generation), and record which segment was created as of > which generation. > This should be a very sizable gain for large indices that mix > deletes, though, less so in flex since opening the terms index is much > faster. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org