LUCENE-3350: fix failure due to shared Term instance

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1152278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-07-29 15:45:40 +00:00
parent 15544c3088
commit b7e7683968
1 changed files with 8 additions and 3 deletions

View File

@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.index.DocumentsWriterDeleteQueue.DeleteSlice;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.ThreadInterruptedException;
@ -171,13 +172,17 @@ public class TestDocumentsWriterDeleteQueue extends LuceneTestCase {
assertEquals(uniqueValues, deletes.terms.keySet());
}
queue.tryApplyGlobalSlice();
HashSet<Term> frozenSet = new HashSet<Term>();
Set<Term> frozenSet = new HashSet<Term>();
for (Term t : queue.freezeGlobalBuffer(null).termsIterable()) {
frozenSet.add(t);
BytesRef bytesRef = new BytesRef();
bytesRef.copy(t.bytes);
frozenSet.add(new Term(t.field, bytesRef));
}
assertEquals(uniqueValues, frozenSet);
assertEquals("num deletes must be 0 after freeze", 0, queue
.numGlobalTermDeletes());
assertEquals(uniqueValues.size(), frozenSet.size());
assertEquals(uniqueValues, frozenSet);
}
private static class UpdateThread extends Thread {