mirror of https://github.com/apache/lucene.git
LUCENE-2086: add assert to verify we flush deleted terms in term sort order
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@883685 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5a7989993
commit
55046c8d74
|
@ -962,6 +962,18 @@ final class DocumentsWriter {
|
|||
return any;
|
||||
}
|
||||
|
||||
// used only by assert
|
||||
private Term lastDeleteTerm;
|
||||
|
||||
// used only by assert
|
||||
private boolean checkDeleteTerm(Term term) {
|
||||
if (term != null) {
|
||||
assert lastDeleteTerm == null || term.compareTo(lastDeleteTerm) > 0: "lastTerm=" + lastDeleteTerm + " vs term=" + term;
|
||||
}
|
||||
lastDeleteTerm = term;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Apply buffered delete terms, queries and docIDs to the
|
||||
// provided reader
|
||||
private final synchronized boolean applyDeletes(IndexReader reader, int docIDStart)
|
||||
|
@ -970,11 +982,16 @@ final class DocumentsWriter {
|
|||
final int docEnd = docIDStart + reader.maxDoc();
|
||||
boolean any = false;
|
||||
|
||||
assert checkDeleteTerm(null);
|
||||
|
||||
// Delete by term
|
||||
TermDocs docs = reader.termDocs();
|
||||
try {
|
||||
for (Entry<Term, BufferedDeletes.Num> entry: deletesFlushed.terms.entrySet()) {
|
||||
Term term = entry.getKey();
|
||||
// LUCENE-2086: we should be iterating a TreeMap,
|
||||
// here, so terms better be in order:
|
||||
assert checkDeleteTerm(term);
|
||||
docs.seek(term);
|
||||
int limit = entry.getValue().getNum();
|
||||
while (docs.next()) {
|
||||
|
|
Loading…
Reference in New Issue