You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Mikeal Rogers <mi...@gmail.com> on 2010/05/26 01:36:36 UTC

view server line protocol changes for _list

There is a fairly serious problem at the moment with using list
functions in CouchDB.

To recap, the view server line protocol for _list functions looks like this.

>>> ["lists", "name", {request}]
<<< ["start", ["chunks"], {"headers":{}, "code":200}]
>>> ["list_row", {"key":"k","value":"v"}]
<<< ["chunk", ["chunks"]]
>>> ["list_end"]
<<< ["end", ["tail chunks"]]

The problem with this is that the response from the view server that
contains the status code MUST come before any list_row calls have
happened. This means that the view server can't return 404 for queries
that don't have any results. In fact, the view can really only return
200 for anything but a HEAD request on list functions.

I'd like to propose the following changes to the view server protocol
for list functions.

>>> ["lists", "name"]
<<< ["getRow"]
>>> ["list_row", {"key":"k","value":"v"}]
<<< ["getRow"]
>>> ["list_row", {"key":"k","value":"v"}]
<<< ["start", "chunk", {"headers":{}, "code":200}]
<<< ["send", "chunk"]
<<< ["send", "chunk"]
<<< ["getRow"]
>>> ["list_row", {"key":"k","value":"v"}]
<<< ["getRow"]
>>> ["list_end"]
<<< ["end", "tail chunk"]

The big change is that there is no longer a strict request/response.
The erlang side stays idle accepting chunks to send until it gets a
["getRow"] call.

Also, all chunks sent in a single line to erlang get sent to the
client in one chunk anyway so I changed the type from array to string
since you can do multiple ["send"] calls between ["list_row"]
responses anyway.

Thoughts?

-Mikeal

Re: view server line protocol changes for _list

Posted by J Chris Anderson <jc...@gmail.com>.
On May 25, 2010, at 4:36 PM, Mikeal Rogers wrote:

> There is a fairly serious problem at the moment with using list
> functions in CouchDB.
> 
> To recap, the view server line protocol for _list functions looks like this.
> 
>>>> ["lists", "name", {request}]
> <<< ["start", ["chunks"], {"headers":{}, "code":200}]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["chunk", ["chunks"]]
>>>> ["list_end"]
> <<< ["end", ["tail chunks"]]
> 
> The problem with this is that the response from the view server that
> contains the status code MUST come before any list_row calls have
> happened. This means that the view server can't return 404 for queries
> that don't have any results. In fact, the view can really only return
> 200 for anything but a HEAD request on list functions.
> 
> I'd like to propose the following changes to the view server protocol
> for list functions.
> 
>>>> ["lists", "name"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["start", "chunk", {"headers":{}, "code":200}]
> <<< ["send", "chunk"]
> <<< ["send", "chunk"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_end"]
> <<< ["end", "tail chunk"]
> 
> The big change is that there is no longer a strict request/response.
> The erlang side stays idle accepting chunks to send until it gets a
> ["getRow"] call.
> 
> Also, all chunks sent in a single line to erlang get sent to the
> client in one chunk anyway so I changed the type from array to string
> since you can do multiple ["send"] calls between ["list_row"]
> responses anyway.
> 
> Thoughts?

I think this sounds right to me. I'm not seeing any big issues off the top of my head.

Chris

> 
> -Mikeal


Re: view server line protocol changes for _list

Posted by Mikeal Rogers <mi...@gmail.com>.
I just want to kick the tires on this before we start locking things up for 1.0.

Do we think we can get this in?

-Mikeal

On Tue, May 25, 2010 at 11:24 PM, Dirkjan Ochtman <di...@ochtman.nl> wrote:
> On Wed, May 26, 2010 at 01:36, Mikeal Rogers <mi...@gmail.com> wrote:
>> I'd like to propose the following changes to the view server protocol
>> for list functions.
>>
>>>>> ["lists", "name"]
>> <<< ["getRow"]
>>>>> ["list_row", {"key":"k","value":"v"}]
>> <<< ["getRow"]
>>>>> ["list_row", {"key":"k","value":"v"}]
>> <<< ["start", "chunk", {"headers":{}, "code":200}]
>> <<< ["send", "chunk"]
>> <<< ["send", "chunk"]
>> <<< ["getRow"]
>>>>> ["list_row", {"key":"k","value":"v"}]
>> <<< ["getRow"]
>>>>> ["list_end"]
>> <<< ["end", "tail chunk"]
>>
>> The big change is that there is no longer a strict request/response.
>> The erlang side stays idle accepting chunks to send until it gets a
>> ["getRow"] call.
>
> Hopefully it will be called get_row rather than getRow, if we already
> have list_row?
>
> Cheers,
>
> Dirkjan
>

Re: view server line protocol changes for _list

Posted by Dirkjan Ochtman <di...@ochtman.nl>.
On Wed, May 26, 2010 at 01:36, Mikeal Rogers <mi...@gmail.com> wrote:
> I'd like to propose the following changes to the view server protocol
> for list functions.
>
>>>> ["lists", "name"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["start", "chunk", {"headers":{}, "code":200}]
> <<< ["send", "chunk"]
> <<< ["send", "chunk"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_end"]
> <<< ["end", "tail chunk"]
>
> The big change is that there is no longer a strict request/response.
> The erlang side stays idle accepting chunks to send until it gets a
> ["getRow"] call.

Hopefully it will be called get_row rather than getRow, if we already
have list_row?

Cheers,

Dirkjan