Apache Lucene open-source search software
SOLR-5144: add test that failed on 4.4
Robert Muir2ecb5843b0c3
diff --git a/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java b/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.javaindex 71b8922c7a2..6e0f38db90a 100644--- a/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java+++ b/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java@@ -119,6 +119,49 @@ public class SolrIndexSplitterTest extends SolrTestCaseJ4 {if (request != null) request.close(); // decrefs the searcher}}++ // SOLR-5144+ public void testSplitDeletes() throws Exception {+ LocalSolrQueryRequest request = null;+ try {+ // add two docs+ String id1 = "dorothy";+ assertU(adoc("id", id1));+ String id2 = "kansas";+ assertU(adoc("id", id2));+ assertU(commit());+ assertJQ(req("q", "*:*"), "/response/numFound==2");+ assertU(delI(id2)); // delete id2+ assertU(commit());+++ // find minHash/maxHash hash ranges+ List<DocRouter.Range> ranges = getRanges(id1, id2);++ request = lrf.makeRequest("q", "dummy");++ SplitIndexCommand command = new SplitIndexCommand(request,+ Lists.newArrayList(indexDir1.getAbsolutePath(), indexDir2.getAbsolutePath()), null, ranges, new PlainIdRouter());+ new SolrIndexSplitter(command).split();++ Directory directory = h.getCore().getDirectoryFactory().get(indexDir1.getAbsolutePath(),+ DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);+ DirectoryReader reader = DirectoryReader.open(directory);+ assertEquals("id:dorothy should be present in split index1", 1, reader.docFreq(new Term("id", "dorothy")));+ assertEquals("id:kansas should not be present in split index1", 0, reader.docFreq(new Term("id", "kansas")));+ assertEquals("split index1 should have only one document", 1, reader.numDocs());+ reader.close();+ h.getCore().getDirectoryFactory().release(directory);+ directory = h.getCore().getDirectoryFactory().get(indexDir2.getAbsolutePath(),+ DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);+ reader = DirectoryReader.open(directory);+ assertEquals(0, reader.numDocs()); // should be empty+ reader.close();+ h.getCore().getDirectoryFactory().release(directory);+ } finally {+ if (request != null) request.close(); // decrefs the searcher+ }+ }@Testpublic void testSplitByCores() throws Exception {