From user-return-16771-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Sat Jun 18 21:46:21 2011 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5220366A6 for ; Sat, 18 Jun 2011 21:46:21 +0000 (UTC) Received: (qmail 64775 invoked by uid 500); 18 Jun 2011 21:46:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 64745 invoked by uid 500); 18 Jun 2011 21:46:19 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 64737 invoked by uid 99); 18 Jun 2011 21:46:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2011 21:46:19 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of celehner1@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2011 21:46:13 +0000 Received: by vws16 with SMTP id 16so2545492vws.11 for ; Sat, 18 Jun 2011 14:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to :x-mailer; bh=WMZm1ZA7Su/Nu9PZYHBpFhe3D55T0sTn2rwOjCAjeng=; b=noooHXO16O5kTaSlqQq8C3n4fmHflh2g6ml/Q/+9Cw1V/dwSeMW08aS28uonznq8D1 z0DvFKRb7oeyr4j2Ok+mafYJpfIhv7w/fhDaE9tFdqHEsEunWJVFuVpK+KIc0cT3gcXb +C4SwAhAprYJLC0Ol1bpW+E4EI5Q8N4d+ZbT0= 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=fLoPw2nHffvVvldKdK+TfyNP5gdxDNqvS91gXCGcIEXe+ie5CVwlY0+1NwZT7XwfXV Ct13iUFo6k8PKlZC76tD9zoA/sbymZ4hl5pquiwCoX0INR9c9B/J4aeD6nB78jXXuXRu bUj1kxNS6rXkN8Bjv2UIHjslOQNRqKUY6HYRo= Received: by 10.220.65.65 with SMTP id h1mr1287330vci.167.1308433551376; Sat, 18 Jun 2011 14:45:51 -0700 (PDT) Received: from [10.0.1.189] (ool-182fd2e9.dyn.optonline.net [24.47.210.233]) by mx.google.com with ESMTPS id a1sm78514vco.34.2011.06.18.14.45.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2011 14:45:50 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Reduces out of order? From: Charles Lehner In-Reply-To: <1308402892.31733.ezmlm@couchdb.apache.org> Date: Sat, 18 Jun 2011 17:45:49 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <4F450A6D-4492-4576-88A4-091EF56C3909@gmail.com> References: <1308402892.31733.ezmlm@couchdb.apache.org> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1084) Thanks for addressing my question, Dave and Sean. It looks like I can't = do what I was trying to do, which is to store deltas as documents and = then use a time-ordered view to apply the deltas and see the current = state of the system, or its state at a point in the past. I could do this with a list function, but that would require iterating = through all the documents for each request. More likely I'll make = something custom in node.js. Charles On Jun 17, 2011, at 10:18 PM, Dave Cottlehuber wrote: > On 18 June 2011 14:07, Sean Copenhaver = wrote: >> Hmmm... I don't think it's a good idea to have an order sensitive = reduce function. Also I think you are thinking about the actual view = index which is ordered by the key you emit from the map function. >>=20 >> I believe couch will reduce each b-tree node worth of the view and = store those, then rereduce those and parts of nodes as needed so your = reduced queries only do part of the work. >>=20 >> I hope that made some sense. >>=20 >>=20 >>=20 >> On Jun 17, 2011, at 9:17 PM, Charles Lehner = wrote: >>=20 >>> Hi, >>>=20 >>> I have a reduce function that is sensitive to row order. My = understanding is that reduces are supposed to get their rows sorted by = key. But this one is getting them out of order; in fact, the order = changes inconsistently between replications. >>>=20 >>> I'm seeing this on both 1.0.2 and trunk. Is this the expected = behavior? >>>=20 >>> Thanks, >>> Charles >>=20 >=20 > Sean's spot on; MR should not be sensitive to row order; that's kinda > the point of being able to divide and conquer arbitrarily is that the > result is identical and independent of the order of processing. >=20 > = http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Restrictions_= on_map_and_reduce_functions >=20 > I'm not sure what you meant by between replications, but after more > data is added to the couch, impacted b-tree leaf and intermediate > nodes get re-written. As its append-only, this continues right to the > top of the tree. So your "row order" changes each time more data is > added, potentially. >=20 > Perhaps a list might be more appropriate for your post-processing > sorting? or client side? >=20 > A+ > Dave