You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Chris Anderson <jc...@apache.org> on 2009/01/22 23:43:03 UTC

minor API change update=false => stale=ok

I'd been meaning to rename update=false to stale=ok for a while.

The feature is very limited. When a view is called with stale=ok, if
there is currently an in-memory pointer to a completed view index,
that will be preferred over updating the view to ensure that it
reflects all database updates through the current sequence number. The
effect is slightly lower latency, in the majority of cases.

However, if the view is not yet built, or has not been queried since
the last time CouchDB was booted, sending stale=ok as a query
parameter will have no effect. As such, I think update=false is a
misleading name, and stale=ok is more indicative of the advisory
nature of this param.

This change was committed today in revision 736837

-- 
Chris Anderson
http://jchris.mfdz.com

Re: minor API change update=false => stale=ok

Posted by Paul Davis <pa...@gmail.com>.
On Thu, Jan 22, 2009 at 6:29 PM, kowsik <ko...@gmail.com> wrote:
> AFAIR, all URL query params to couch are proper json. Just to be
> pedantic, shouldn't that be stale=true or stale="ok"?
>

Nope, not all values require valid JSON.

> K.
>
> On Thu, Jan 22, 2009 at 2:43 PM, Chris Anderson <jc...@apache.org> wrote:
>> I'd been meaning to rename update=false to stale=ok for a while.
>>
>> The feature is very limited. When a view is called with stale=ok, if
>> there is currently an in-memory pointer to a completed view index,
>> that will be preferred over updating the view to ensure that it
>> reflects all database updates through the current sequence number. The
>> effect is slightly lower latency, in the majority of cases.
>>
>> However, if the view is not yet built, or has not been queried since
>> the last time CouchDB was booted, sending stale=ok as a query
>> parameter will have no effect. As such, I think update=false is a
>> misleading name, and stale=ok is more indicative of the advisory
>> nature of this param.
>>
>> This change was committed today in revision 736837
>>
>> --
>> Chris Anderson
>> http://jchris.mfdz.com
>>
>

Re: minor API change update=false => stale=ok

Posted by Chris Anderson <jc...@apache.org>.
On Thu, Jan 22, 2009 at 6:49 PM, Noah Slater <ns...@apache.org> wrote:
> On Fri, Jan 23, 2009 at 10:56:13AM +1030, Antony Blakey wrote:
>> Would this not be a good general rule however?
>>
>>   stale-ok=true
>
> This disagrees with my sense of style. I prefer a single word key.
>

Going forward, we may add eg stale=force to give the semantics people
always wanted from update=false (go to disk to find the latest state
of the view, if the view has never been computed, return an error).

I think if we were gonna go all the way json, we'd do something like:

/db/_view/some/thing?{"stale":"ok","startkey":"g","limit":10}

Which I don't like for all kinds of reasons.

-- 
Chris Anderson
http://jchris.mfdz.com

Re: minor API change update=false => stale=ok

Posted by Noah Slater <ns...@apache.org>.
On Fri, Jan 23, 2009 at 10:56:13AM +1030, Antony Blakey wrote:
> Would this not be a good general rule however?
>
>   stale-ok=true

This disagrees with my sense of style. I prefer a single word key.

-- 
Noah Slater, http://tumbolia.org/nslater

Re: minor API change update=false => stale=ok

Posted by Antony Blakey <an...@gmail.com>.
On 23/01/2009, at 10:11 AM, Chris Anderson wrote:

> On Thu, Jan 22, 2009 at 3:31 PM, Noah Slater <ns...@apache.org>  
> wrote:
>> On Thu, Jan 22, 2009 at 03:29:00PM -0800, kowsik wrote:
>>> AFAIR, all URL query params to couch are proper json. Just to be
>>> pedantic, shouldn't that be stale=true or stale="ok"?
>>
>> I don't think this should have to be the case.
>>
>
> IIRC, only startkey, endkey and key are JSON

And anything that takes true/false i.e. group=true

Would this not be a good general rule however?

   stale-ok=true

This particular case has the advantage that the legal values are  
immediately suggested (sans i18n) because the key IMO is obviously a  
binary predicate.

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Every task involves constraint,
Solve the thing without complaint;
There are magic links and chains
Forged to loose our rigid brains.
Structures, structures, though they bind,
Strangely liberate the mind.
   -- James Fallen



Re: minor API change update=false => stale=ok

Posted by Chris Anderson <jc...@apache.org>.
On Thu, Jan 22, 2009 at 3:31 PM, Noah Slater <ns...@apache.org> wrote:
> On Thu, Jan 22, 2009 at 03:29:00PM -0800, kowsik wrote:
>> AFAIR, all URL query params to couch are proper json. Just to be
>> pedantic, shouldn't that be stale=true or stale="ok"?
>
> I don't think this should have to be the case.
>

IIRC, only startkey, endkey and key are JSON



-- 
Chris Anderson
http://jchris.mfdz.com

Re: minor API change update=false => stale=ok

Posted by Noah Slater <ns...@apache.org>.
On Thu, Jan 22, 2009 at 03:29:00PM -0800, kowsik wrote:
> AFAIR, all URL query params to couch are proper json. Just to be
> pedantic, shouldn't that be stale=true or stale="ok"?

I don't think this should have to be the case.

-- 
Noah Slater, http://tumbolia.org/nslater

Re: minor API change update=false => stale=ok

Posted by kowsik <ko...@gmail.com>.
AFAIR, all URL query params to couch are proper json. Just to be
pedantic, shouldn't that be stale=true or stale="ok"?

K.

On Thu, Jan 22, 2009 at 2:43 PM, Chris Anderson <jc...@apache.org> wrote:
> I'd been meaning to rename update=false to stale=ok for a while.
>
> The feature is very limited. When a view is called with stale=ok, if
> there is currently an in-memory pointer to a completed view index,
> that will be preferred over updating the view to ensure that it
> reflects all database updates through the current sequence number. The
> effect is slightly lower latency, in the majority of cases.
>
> However, if the view is not yet built, or has not been queried since
> the last time CouchDB was booted, sending stale=ok as a query
> parameter will have no effect. As such, I think update=false is a
> misleading name, and stale=ok is more indicative of the advisory
> nature of this param.
>
> This change was committed today in revision 736837
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>