You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Robert Munteanu <ro...@apache.org> on 2017/10/05 14:49:57 UTC

Waiting for an async index to be updated

Hi,

In Sling we have some tests which validate that full text search is
working. Occasionaly this test times out because the full-text lucene
index is not updated and a traversal query is used. More details at
[1].

We should probably add a way of waiting for the index to be updated, so
my question is - what would be the way to do that? Ideally we would do
this from outside the Oak/Sling process, but can also deploy an OSGi
bundle if needed.

Thanks,

Robert


[1]: https://issues.apache.org/jira/browse/SLING-7169

Re: Waiting for an async index to be updated

Posted by Vikas Saurabh <vi...@gmail.com>.
Hi

On Fri, Oct 6, 2017 at 2:33 PM, Alex Deparvu <al...@pfalabs.com> wrote:
> Hi Robert,
>
> You could use the IndexStatsMBean [0] to poll for the indexing status,
> waiting until indexing is completed.
>
Alex, while this would most likely work in simple test scenarios - but
there's a bit of lag between indexing cycle commits updated indexed
data and when the readers(tracker) updates itself to this new index.

> [0]
> https://github.com/stillalex/jackrabbit-oak/blob/trunk/oak-api/src/main/java/org/apache/jackrabbit/oak/api/jmx/IndexStatsMBean.java#L26
>
> On Thu, Oct 5, 2017 at 4:49 PM, Robert Munteanu <ro...@apache.org> wrote:
>
>> In Sling we have some tests which validate that full text search is
>> working. Occasionaly this test times out because the full-text lucene
>> index is not updated and a traversal query is used. More details at
>> [1].
>>
While, I agree, oak doesn't currently have a fool proof way of
providing this data. As a work-around though, what can be done is
commit a simple data and then query (in a loop with some sleep... and
maybe some timeout) until this new data is available. Availability of
indexed data on reader side, while asynchronous, would still follow
chronological order.

>>
>> [1]: https://issues.apache.org/jira/browse/SLING-7169
>>

Thanks,
Vikas

Re: Waiting for an async index to be updated

Posted by Alex Deparvu <al...@pfalabs.com>.
Hi Robert,

You could use the IndexStatsMBean [0] to poll for the indexing status,
waiting until indexing is completed.

hope this helps,
alex


[0]
https://github.com/stillalex/jackrabbit-oak/blob/trunk/oak-api/src/main/java/org/apache/jackrabbit/oak/api/jmx/IndexStatsMBean.java#L26



On Thu, Oct 5, 2017 at 4:49 PM, Robert Munteanu <ro...@apache.org> wrote:

> Hi,
>
> In Sling we have some tests which validate that full text search is
> working. Occasionaly this test times out because the full-text lucene
> index is not updated and a traversal query is used. More details at
> [1].
>
> We should probably add a way of waiting for the index to be updated, so
> my question is - what would be the way to do that? Ideally we would do
> this from outside the Oak/Sling process, but can also deploy an OSGi
> bundle if needed.
>
> Thanks,
>
> Robert
>
>
> [1]: https://issues.apache.org/jira/browse/SLING-7169
>