[
https://issues.apache.org/jira/browse/OAK-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14506551#comment-14506551
]
Chetan Mehrotra commented on OAK-2569:
--------------------------------------
bq. if many documents were added and removed at the same time, some of them
might not be returned. That means the query result would be wrong (the result
could miss data that was there in both the old and the new revision).
With current flow that would not happen. What I was suggesting that if
exception occurs then perform search again without offset. This would lead to
duplicate results but then those would be filtered out due to {{seenPaths}}.
Query would still be performed again with newer index so there should not be a
possibility of wrong result.
bq. We would need to hold on to IndexSearcher from within Cursor
The problem with that would be that long running Cursor would prevent the
IndexNode to switch to newer version. Currently when a change in index is
detected then IndexNode waits for existing searchers to be retuned back so that
it can close the current directory and then open a new one. Now once a Cursor
is returned it would not be possible to enforce timely close of cursor and it
would hold up the switch to newer index. Hence it needs to be avoided
> LuceneIndex#loadDocs can throw IllegalArgumentException
> -------------------------------------------------------
>
> Key: OAK-2569
> URL: https://issues.apache.org/jira/browse/OAK-2569
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: lucene
> Affects Versions: 1.1.6, 1.2.1
> Reporter: Alex Parvulescu
> Fix For: 1.3.0, 1.2.2
>
>
> It looks like in some cases a IllegalArgumentException will be thrown if the
> _nextBatchSize_ passed to the _searchAfter_ method call is smaller than the
> current searcher limit (_lastDoc.doc_).
> Stack trace for the failure:
> {code}
> java.lang.IllegalArgumentException: after.doc exceeds the number of documents
> in the reader: after.doc=387045 limit=386661
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:442)
> at org.apache.lucene.search.IndexSearcher.searchAfter(IndexSearcher.java:243)
> at
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndex$1.loadDocs(LuceneIndex.java:352)
> at
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndex$1.computeNext(LuceneIndex.java:292)
> at
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndex$1.computeNext(LuceneIndex.java:283)
> at
> com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
> at
> com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
> at
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndex$LucenePathCursor$1.hasNext(LuceneIndex.java:1055)
> at com.google.common.collect.Iterators$7.computeNext(Iterators.java:645)
> at
> com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
> at
> com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$PathCursor.hasNext(Cursors.java:198)
> at
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndex$LucenePathCursor.hasNext(LuceneIndex.java:1076)
> at
> org.apache.jackrabbit.oak.plugins.index.aggregate.AggregationCursor.fetchNext(AggregationCursor.java:88)
> at
> org.apache.jackrabbit.oak.plugins.index.aggregate.AggregationCursor.hasNext(AggregationCursor.java:75)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.fetchNext(Cursors.java:389)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.hasNext(Cursors.java:381)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.fetchNext(Cursors.java:389)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.hasNext(Cursors.java:381)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.fetchNext(Cursors.java:389)
> at
> org.apache.jackrabbit.oak.spi.query.Cursors$IntersectionCursor.hasNext(Cursors.java:381)
> at
> org.apache.jackrabbit.oak.query.ast.SelectorImpl.next(SelectorImpl.java:401)
> at
> org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.fetchNext(QueryImpl.java:664)
> at
> org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.hasNext(QueryImpl.java:689)
> at
> org.apache.jackrabbit.oak.query.FilterIterators$SortIterator.init(FilterIterators.java:203)
> at
> org.apache.jackrabbit.oak.query.FilterIterators$SortIterator.hasNext(FilterIterators.java:237)
> at
> org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$1.fetch(QueryResultImpl.java:108)
> at
> org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$1.<init>(QueryResultImpl.java:104)
> at
> org.apache.jackrabbit.oak.jcr.query.QueryResultImpl.getRows(QueryResultImpl.java:91)
> at org.apache.jackrabbit.commons.query.GQL.executeJcrQuery(GQL.java:440)
> at org.apache.jackrabbit.commons.query.GQL.execute(GQL.java:434)
> at org.apache.jackrabbit.commons.query.GQL.execute(GQL.java:327)
> at org.apache.jackrabbit.commons.query.GQL.execute(GQL.java:310)
> at org.apache.jackrabbit.commons.query.GQL.execute(GQL.java:296)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)