You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Christian Danninger (JIRA)" <ji...@apache.org> on 2015/07/07 11:13:04 UTC
[jira] [Reopened] (LUCENE-6660) Assertion fails for
ToParentBlockJoinQuery$BlockJoinScorer.nextDoc
[ https://issues.apache.org/jira/browse/LUCENE-6660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Danninger reopened LUCENE-6660:
-----------------------------------------
I double checked it. And everything should be fine with the index.
The index is fresh without deletions and child documents are added to parents by the API:
{code}
SolrInputDocument child = new SolrInputDocument();
child.addField("parent", false);
child.addField("id", ++childId);
parent.addChildDocument(child);
{code}
I wrote an algorithm to check the index:
{code}
package test;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashSet;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.NRTCachingDirectory;
public class ParentChild {
public static void main(String[] args) throws IOException {
HashSet<String> unique = new HashSet<String>();
HashSet<String> parents = new HashSet<String>();
HashSet<String> children = new HashSet<String>();
HashSet<String> roots = new HashSet<String>();
Path path = Paths.get(args[0]);
FSDirectory directory = MMapDirectory.open(path);
NRTCachingDirectory nrtCachingDirectory = new NRTCachingDirectory(directory, 48.0, 48.0);
DirectoryReader reader = DirectoryReader.open(nrtCachingDirectory);
boolean wasChild = false;
String parentId = null;
for (int docID=0; docID<reader.maxDoc(); docID++) {
final Document document = reader.document(docID);
final String parent = document.get("parent");
final boolean isChild = parent.equals("F");
final boolean isParent = parent.equals("T");
final String root = document.get("_root_");
final String id = document.get("id");
// unique id ?
if (unique.contains(id)) {
throw new IllegalArgumentException();
}
if (root != null) {
roots.add(root);
}
if (isChild) {
// parent after its children?
if (parents.contains(root)) {
throw new IllegalArgumentException();
}
// correct parent ?
if (parentId != null && !parentId.equals(root)) {
throw new IllegalArgumentException();
}
children.add(id);
parentId = root;
} else {
if (wasChild) {
// children belong to parent ?
if (!id.equals(parentId)) {
throw new IllegalArgumentException();
}
// ids matching ?
if (!id.equals(root)) {
throw new IllegalArgumentException();
}
} else {
// parent without child
if (root != null) {
throw new IllegalArgumentException();
}
}
if (!isParent) {
throw new IllegalArgumentException();
}
parents.add(id);
parentId = null;
}
unique.add(id);
wasChild = isChild;
}
System.out.println("docs: " + reader.maxDoc());
System.out.println("total: " + unique.size());
System.out.println("children: " + children.size());
System.out.println("parents: " + parents.size());
System.out.println("roots: " + roots.size());
System.out.println(Collections.disjoint(children, parents));
System.out.println(Collections.disjoint(children, roots));
System.out.println(parents.containsAll(roots));
System.out.println(reader.hasDeletions());
System.out.println(reader.isCurrent());
reader.close();
directory.close();
}
}
{code}
Output:
{code}
docs: 573397
total: 573397
children: 485949
parents: 87448
roots: 40342
true
true
true
false
true
{code}
> Assertion fails for ToParentBlockJoinQuery$BlockJoinScorer.nextDoc
> ------------------------------------------------------------------
>
> Key: LUCENE-6660
> URL: https://issues.apache.org/jira/browse/LUCENE-6660
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Affects Versions: 5.2.1
> Environment: Running Solr 5.2.1 on Windows x64
> java version "1.7.0_51"
> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
> Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
> Reporter: Christian Danninger
>
> After I enable assertion with "-ea:org.apache..." I got the stack trace below. I checked that the parent filter only match parent documents and the child filter only match child documents. Field "id" is unique.
> 16:55:06,269 ERROR [org.apache.solr.servlet.SolrDispatchFilter] (http-127.0.0.1/127.0.0.1:8080-1) null:java.lang.RuntimeException: java.lang.AssertionError
> at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:593)
> at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:465)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
> at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:559)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.AssertionError
> at org.apache.lucene.search.join.ToParentBlockJoinQuery$BlockJoinScorer.nextDoc(ToParentBlockJoinQuery.java:278)
> at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:204)
> at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:176)
> at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:35)
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:771)
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485)
> at org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:202)
> at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1666)
> at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1485)
> at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:561)
> at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:518)
> at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:255)
> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:2064)
> at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654)
> at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:450)
> ... 16 more
> Without assertions enabled:
> 17:21:39,008 ERROR [org.apache.solr.servlet.SolrDispatchFilter] (http-127.0.0.1/127.0.0.1:8080-1) null:java.lang.IllegalStateException: child query must only match non-parent docs, but parent docID=2147483647 matched childScorer=class org.apache.lucene.search.ConjunctionScorer
> at org.apache.lucene.search.join.ToParentBlockJoinQuery$BlockJoinScorer.nextDoc(ToParentBlockJoinQuery.java:334)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org