You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/08/14 18:56:55 UTC
svn commit: r1513962 -
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
Author: rmuir
Date: Wed Aug 14 16:56:55 2013
New Revision: 1513962
URL: http://svn.apache.org/r1513962
Log:
SOLR-5144: add test that failed on 4.4
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1513962&r1=1513961&r2=1513962&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java Wed Aug 14 16:56:55 2013
@@ -119,6 +119,49 @@ public class SolrIndexSplitterTest exten
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
+ }
+ }
@Test
public void testSplitByCores() throws Exception {