Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 1184 invoked from network); 25 May 2010 23:43:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 May 2010 23:43:03 -0000 Received: (qmail 22701 invoked by uid 500); 25 May 2010 23:43:02 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 22551 invoked by uid 500); 25 May 2010 23:43:02 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 22543 invoked by uid 99); 25 May 2010 23:43:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 May 2010 23:43:02 +0000 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jchris@gmail.com designates 209.85.212.180 as permitted sender) Received: from [209.85.212.180] (HELO mail-px0-f180.google.com) (209.85.212.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 May 2010 23:42:55 +0000 Received: by pxi17 with SMTP id 17so2630769pxi.11 for ; Tue, 25 May 2010 16:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=pemlyAKFEkDVCU88S5b86s7KFGfGQlyVfyrfeBvajwQ=; b=XcfEns+22Qoffx/ij4JipGg5T6pgikcuMzcVJgX8H2uFqr3KnQgtVMqZGiUoAPEDC9 CZbza8mZE+wWRaRiAMkaxoREXMFNov0YoOvezaRmMPRTJKz1xqBqRSTXKxBm4Hm0DFkx 59O8kUj4sYpEbjS0WcwAYDw7AHwWo5stO7rSU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=Y5OoVYmw9tqZbvUXiURuzDhiaMz1YBianWBw4Vn8H0PHN9mOM30//b931p1wYq/mhM aCcsjkyXEs5OiJT7nAyoly4iuWKLMqe11uUx27qd+/8q0jsVWrj1zIJcu4oMOBneeLqO 5yLfKHdHjyMcq6eBDw56HvRyVGa++wnQOLi4c= Received: by 10.141.131.15 with SMTP id i15mr5906321rvn.18.1274830954571; Tue, 25 May 2010 16:42:34 -0700 (PDT) Received: from [10.0.1.245] (h-74-1-186-35.snfccasy.static.covad.net [74.1.186.35]) by mx.google.com with ESMTPS id l29sm4621693rvb.4.2010.05.25.16.42.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 May 2010 16:42:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: view server line protocol changes for _list From: J Chris Anderson In-Reply-To: Date: Tue, 25 May 2010 16:42:31 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <79CD6D2D-EA4C-4A34-963C-BA2652AB243E@gmail.com> References: To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1078) 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. >=20 > To recap, the view server line protocol for _list functions looks like = this. >=20 >>>> ["lists", "name", {request}] > <<< ["start", ["chunks"], {"headers":{}, "code":200}] >>>> ["list_row", {"key":"k","value":"v"}] > <<< ["chunk", ["chunks"]] >>>> ["list_end"] > <<< ["end", ["tail chunks"]] >=20 > 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. >=20 > I'd like to propose the following changes to the view server protocol > for list functions. >=20 >>>> ["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"] >=20 > 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. >=20 > 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. >=20 > Thoughts? I think this sounds right to me. I'm not seeing any big issues off the = top of my head. Chris >=20 > -Mikeal