LUCENE-4402: TestAddTaxonomy.testConcurrency failure (trunk)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1387542 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2012-09-19 12:15:20 +00:00
parent 909bd0a60d
commit ed5679d1f9
2 changed files with 2 additions and 8 deletions

View File

@ -856,13 +856,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
String value = te.term().utf8ToString(); String value = te.term().utf8ToString();
cp.clear(); cp.clear();
cp.add(value, Consts.DEFAULT_DELIMITER); cp.add(value, Consts.DEFAULT_DELIMITER);
int ordinal = findCategory(cp); final int ordinal = addCategory(cp);
if (ordinal < 0) {
// NOTE: call addCategory so that it works well in a multi-threaded
// environment, in case e.g. a thread just added the category, after
// the findCategory() call above failed to find it.
ordinal = addCategory(cp);
}
docs = te.docs(null, docs, 0); docs = te.docs(null, docs, 0);
ordinalMap.addMapping(docs.nextDoc() + base, ordinal); ordinalMap.addMapping(docs.nextDoc() + base, ordinal);
} }

View File

@ -191,7 +191,7 @@ public class TestAddTaxonomy extends LuceneTestCase {
public void testConcurrency() throws Exception { public void testConcurrency() throws Exception {
// tests that addTaxonomy and addCategory work in parallel // tests that addTaxonomy and addCategory work in parallel
final int numCategories = atLeast(5000); final int numCategories = atLeast(10000);
// build an input taxonomy index // build an input taxonomy index
Directory src = newDirectory(); Directory src = newDirectory();