From dev-return-14916-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Mon Feb 14 21:38:49 2011 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 15969 invoked from network); 14 Feb 2011 21:38:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Feb 2011 21:38:48 -0000 Received: (qmail 17962 invoked by uid 500); 14 Feb 2011 21:38:48 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 17911 invoked by uid 500); 14 Feb 2011 21:38:47 -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 17903 invoked by uid 99); 14 Feb 2011 21:38:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Feb 2011 21:38:47 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of adam.kocoloski@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Feb 2011 21:38:41 +0000 Received: by qyk29 with SMTP id 29so4039385qyk.11 for ; Mon, 14 Feb 2011 13:38:21 -0800 (PST) Received: by 10.229.97.134 with SMTP id l6mr3308273qcn.253.1297719499643; Mon, 14 Feb 2011 13:38:19 -0800 (PST) Received: from [10.1.10.164] (c-66-31-20-188.hsd1.ma.comcast.net [66.31.20.188]) by mx.google.com with ESMTPS id p13sm2090752qcu.29.2011.02.14.13.38.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Feb 2011 13:38:18 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) Subject: Re: inconsistent behavior in _all_docs with deleted documents From: Adam Kocoloski In-Reply-To: Date: Mon, 14 Feb 2011 16:38:16 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <7E427DF5-8373-4F72-B493-FA57B95A6309@apache.org> References: <20110214190825.GK2154@3oh1.uhds.oregonstate.edu> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1082) Let's write down the spec somewhere before we go changing any more = maintenance branch code. BigCouch struggled with maintaining = compatibility on this issue for a while. There's not really an = intuitive answer here, so we just need to pick one and stick with it. Adam On Feb 14, 2011, at 4:22 PM, Paul Davis wrote: > What's the inconsistency? >=20 > _all_docs shouldn't respond with *anything* if the doc is deleted as > _all_docs is a representation of what's in the database when the > request started. >=20 > On the other hand _changes *should* show the doc (once, for the > update_seq where it was deleted). >=20 > None of that answers the question on whether there should be a doc > there or not though. I'd lean towards including it though because we > use that pattern in other places don't we? >=20 > On Mon, Feb 14, 2011 at 3:47 PM, Filipe David Manana > wrote: >> Looking at _changes?include_docs=3Dtrue, it seems that, even before >> COUCHDB-1061, it adds the deleted version of a document to the 'doc' >> attribute of each line: >>=20 >> $ curl = 'http://fdmanana.couchone.com/large1kb_copy/_changes?include_docs=3Dtrue&s= ince=3D341298' >> {"results":[ >> = {"seq":341299,"id":"doc1","changes":[{"rev":"2-067ab79f86426777f902f65c745= 97697"}],"deleted":true,"doc":{"_id":"doc1","_rev":"2-067ab79f86426777f902= f65c74597697","_deleted":true}} >> ], >> "last_seq":341299} >>=20 >> This is not coherent with _all_docs?include_docs=3Dtrue. Views are = not affected. >>=20 >> Should we change _changes to send "doc: null" as well? >>=20 >> On Mon, Feb 14, 2011 at 8:01 PM, Filipe David Manana >> wrote: >>> It's now corrected in the latest revision. >>> I added a test to help prevent this from happening again. >>>=20 >>> cheers >>>=20 >>> On Mon, Feb 14, 2011 at 7:13 PM, Filipe David Manana >>> wrote: >>>> That's probably a side effect from a recent change I made: >>>> https://issues.apache.org/jira/browse/COUCHDB-1061 >>>>=20 >>>> I'll check it later and correct it if it's related. >>>>=20 >>>> cheers >>>>=20 >>>> On Mon, Feb 14, 2011 at 7:08 PM, Gordon wrote: >>>>> Hello, >>>>>=20 >>>>> I noticed a change in behavior from 1.0.1 to 1.1.x regarding = _all_docs and >>>>> deleted documents. >>>>>=20 >>>>> I've got a series of cURL commands that reproduce the "issue" for = me. >>>>>=20 >>>>> curl -XPUT http://localhost:5984/test_20110214 >>>>> curl -XPUT -d '{"_id":"foo","data":"bar"}' -H'Content-Type: >>>>> application/json' http://localhost:5984/test_20110214/foo >>>>> curl -XDELETE http://localhost:5984/test_20110214/foo?rev=3D >>>>> curl -XPOST -d'{"keys":["foo"]}' -H'Content-Type: = application/json' >>>>> http://localhost:5984/test_20110214/_all_docs?include_docs=3Dtrue >>>>>=20 >>>>> and you'll obviously need to replace with the revision = returned by the >>>>> previous command. >>>>>=20 >>>>> On 1.0.1, this results in something like the following: >>>>>=20 >>>>> {"total_rows":0,"offset":0,"rows":[ >>>>> = {"id":"foo","key":"foo","value":{"rev":"2-21a02b631e42e652c8ef52da9b156997= ","deleted":true},"doc":null} >>>>> ]} >>>>>=20 >>>>> However, on 1.1.x, this results in something like the following: >>>>>=20 >>>>> {"total_rows":0,"offset":0,"rows":[ >>>>> = {"id":"foo","key":"foo","value":{"rev":"2-21a02b631e42e652c8ef52da9b156997= ","deleted":true},"doc":{"_id":"foo","_rev":"2-21a02b631e42e652c8ef52da9b1= 56997","_deleted":true}} >>>>> ]} >>>>>=20 >>>>> Note that instead of 'null', 1.1.x actually returns a stub = document with >>>>> _deleted set to 'true'. >>>>>=20 >>>>> I'm not sure if this is change in behavior is expected or not, but = I didn't >>>>> want to file a bug report without checking with the list first. >>>>>=20 >>>>> The second question this led me to: do we want to return any rows = at all? I >>>>> noticed that "total_rows" is 0 in both cases, yet there is 1 row = returned. >>>>>=20 >>>>> Thanks for your time and any insight you can provide. >>>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> -- >>>> Filipe David Manana, >>>> fdmanana@gmail.com, fdmanana@apache.org >>>>=20 >>>> "Reasonable men adapt themselves to the world. >>>> Unreasonable men adapt the world to themselves. >>>> That's why all progress depends on unreasonable men." >>>>=20 >>>=20 >>>=20 >>>=20 >>> -- >>> Filipe David Manana, >>> fdmanana@gmail.com, fdmanana@apache.org >>>=20 >>> "Reasonable men adapt themselves to the world. >>> Unreasonable men adapt the world to themselves. >>> That's why all progress depends on unreasonable men." >>>=20 >>=20 >>=20 >>=20 >> -- >> Filipe David Manana, >> fdmanana@gmail.com, fdmanana@apache.org >>=20 >> "Reasonable men adapt themselves to the world. >> Unreasonable men adapt the world to themselves. >> That's why all progress depends on unreasonable men." >>=20