Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-4402: TestAddTaxonomy.testConcurrency failure (trunk)

Shai Ereraed5679d1f99d
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
index a7763511e82..418a2875223 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
@@ -856,13 +856,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
String value = te.term().utf8ToString();
cp.clear();
cp.add(value, Consts.DEFAULT_DELIMITER);
- int ordinal = findCategory(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);
- }
+ final int ordinal = addCategory(cp);
docs = te.docs(null, docs, 0);
ordinalMap.addMapping(docs.nextDoc() + base, ordinal);
}
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestAddTaxonomy.java b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestAddTaxonomy.java
index a257f806b6d..72987d3d957 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestAddTaxonomy.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestAddTaxonomy.java
@@ -191,7 +191,7 @@ public class TestAddTaxonomy extends LuceneTestCase {
public void testConcurrency() throws Exception {
// tests that addTaxonomy and addCategory work in parallel
- final int numCategories = atLeast(5000);
+ final int numCategories = atLeast(10000);
// build an input taxonomy index
Directory src = newDirectory();