You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Alex Schenkman <al...@schenkman.info> on 2014/04/18 21:46:16 UTC

Howto delay view requests until indexes are rebuilt

Hi list,

According to what I see in the logs and the results I get, the following
might be happening. Given that:

1) I update a document (using an update handler)
2) Couch starts an index update
3) I request a view
4) I get the "old" view results
5) Couch finnish its re-indexing
6) I request the same view again
7) I get the new view results

I understand why this is happening, but in my use case, I woud prefer couch
delaying the answer to the view request, until the index is rebuilt.
Is it possible to tell couch to behave this way?
I could not find any setting for this in the config file.

Thanks in advance!

Re: Howto delay view requests until indexes are rebuilt

Posted by Robert Samuel Newson <rn...@apache.org>.
Hi Alex,

CouchDB does not update indexes until you query the view. The behaviour you are asking for is the default behaviour (that the view reflects the current state of the database). stale=ok is "don’t update the view" and stale=update_after is "update the view after *this* query".

As Stanley notes, you must be supply stale=ok or stale=update_after in order to reach your step 4.

B.

On 18 Apr 2014, at 21:17, Stanley Iriele <si...@gmail.com> wrote:

> So the default behavior us to wait until it's finished for that sequence
> particular request. Can you send the exact query you're making... Are you
> passing stale=OK?
> On Apr 18, 2014 12:59 PM, "Alex Schenkman" <al...@schenkman.info> wrote:
> 
>> Hi list,
>> 
>> According to what I see in the logs and the results I get, the following
>> might be happening. Given that:
>> 
>> 1) I update a document (using an update handler)
>> 2) Couch starts an index update
>> 3) I request a view
>> 4) I get the "old" view results
>> 5) Couch finnish its re-indexing
>> 6) I request the same view again
>> 7) I get the new view results
>> 
>> I understand why this is happening, but in my use case, I woud prefer couch
>> delaying the answer to the view request, until the index is rebuilt.
>> Is it possible to tell couch to behave this way?
>> I could not find any setting for this in the config file.
>> 
>> Thanks in advance!
>> 


Re: Howto delay view requests until indexes are rebuilt

Posted by Stanley Iriele <si...@gmail.com>.
So the default behavior us to wait until it's finished for that sequence
particular request. Can you send the exact query you're making... Are you
passing stale=OK?
On Apr 18, 2014 12:59 PM, "Alex Schenkman" <al...@schenkman.info> wrote:

> Hi list,
>
> According to what I see in the logs and the results I get, the following
> might be happening. Given that:
>
> 1) I update a document (using an update handler)
> 2) Couch starts an index update
> 3) I request a view
> 4) I get the "old" view results
> 5) Couch finnish its re-indexing
> 6) I request the same view again
> 7) I get the new view results
>
> I understand why this is happening, but in my use case, I woud prefer couch
> delaying the answer to the view request, until the index is rebuilt.
> Is it possible to tell couch to behave this way?
> I could not find any setting for this in the config file.
>
> Thanks in advance!
>