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 E2064FAAD for ; Wed, 17 Apr 2013 08:08:40 +0000 (UTC) Received: (qmail 10818 invoked by uid 500); 17 Apr 2013 08:08:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 10530 invoked by uid 500); 17 Apr 2013 08:08:39 -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 9882 invoked by uid 99); 17 Apr 2013 08:08:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Apr 2013 08:08:38 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bchesneau@gmail.com designates 209.85.128.45 as permitted sender) Received: from [209.85.128.45] (HELO mail-qe0-f45.google.com) (209.85.128.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Apr 2013 08:08:32 +0000 Received: by mail-qe0-f45.google.com with SMTP id 1so748187qee.32 for ; Wed, 17 Apr 2013 01:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=J6E8cOjqeeyKUMQDXCW4mSJywEwsLnqHW6sww2TnTdM=; b=uNMUAUoCtFOxPEpGNiX93qRQ+0Ikc3xEXAmw7jdCQOB+z4fzirpp3cCQbvvr4D4vTC 2pMoUhWlXX3vfo2mDsr81Wwqg6C/7CBKDoYl++OkuC7soppG0NPhwAjNx/sQgQg3ufa8 c/HbP08ICOiICNh+Guyna9bXsLN0tC4uMZx6+noQHU3ZLUqb1C1OfSOMTLcFZ5l40x8+ fULyfIo+GbFzEp+lGhLCz3Khm0Pg3VMdn1A3XIwHe78Qe6NJ0rKSPpAeDI47yMhdACw7 H5xjn4ndoSxftvL/dLDyISPD4RPA8lsizEmREYEcdMOdL2Z8mipZLBWKZoEfXjMBhqNw /RMA== MIME-Version: 1.0 X-Received: by 10.224.1.65 with SMTP id 1mr5989216qae.38.1366186091730; Wed, 17 Apr 2013 01:08:11 -0700 (PDT) Received: by 10.49.27.231 with HTTP; Wed, 17 Apr 2013 01:08:11 -0700 (PDT) In-Reply-To: References: Date: Wed, 17 Apr 2013 10:08:11 +0200 Message-ID: Subject: Re: startkey endkey problem From: Benoit Chesneau To: "user@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org I mixed maills... sorry :) On Wed, Apr 17, 2013 at 10:04 AM, Stanley Iriele wrote: > Hopefully this helps someone somewhere... I'll make a tucket for this > tomorrow... (Hopefully) > On Apr 17, 2013 1:03 AM, "Stanley Iriele" wrote: > >> Hey....thanks for the clarity.. But that does not really apply to this >> case....the way I'm requesting days fortunately doesn't bite me in the ass >> :-) even though its string ordering... So..1..and 10..come before 2 for >> those who care but ....this is the case when there are you go into a list >> function and you don't call send.... It just blows up with a 500 ... >> And it didn't not do this is couchdb 1.2.1...but it does now... >> >> originally I thought it was a view problem because it only happened when >> the keys were of an invalid range... But that was just a symptom.. Not the >> cause.... So that explains the misleading subject >> On Apr 17, 2013 12:48 AM, "Benoit Chesneau" wrote: >> >> > So let say it one time for the good. In the current version the >> > rewriter doesn't parse the variables in nested lists. Maybe it should >> > be written somewhere in the doc. >> > >> > >> > Some detailed explanation on how work the variable replacement in the >> > rewriter: >> > >> > The current difficulty with variables replacement in the rewriter is >> > the same yoou have in Erlang. The URL parameters in the URL are >> > received as strings. Strings in Erlang are list of integers. Unless >> > you know it you have no way to know if foo=1 is an integer or a list, >> > or if true is a boolean or a list. Also if you are passing "foo" to a >> > view should it be json encoded or not. The way we bypass that in views >> > is considering that values given to startkey and endkey are json >> > encoded. By default all params are url decoded, and json decoded if >> > needed, >> > >> > In the current rewriter we have no expectation on how variables are >> > passed except for some known parameters (keys, endkeys, startkeys, >> > end_key, start_key, key) that are considered as json values. To tell >> > if the parameter "foo" is an integer you have to use the "format" >> > property. >> > >> > Nested list: >> > >> > We are for now only replacing the first level in lists [1]. I need to >> > revisit the code to understand why it does, but I suspect i made a >> > premature optimization. I will try to fix that asap. >> > >> > - benoit >> > >> > >> > >> > [1] >> > >> https://github.com/benoitc/couchdb/blob/master/src/couchdb/couch_httpd_rewrite.erl#L273 >> > >> > >> > On Wed, Apr 17, 2013 at 8:42 AM, Stanley Iriele >> > wrote: >> > > sure...i was using a rewrite handler to rewrite >> > > /:game/channels/:year/:month/:day/ >> > > >> > > though these are strings they work for my case and they map to >> > > >> > > >> > >> db/_design/ddoc/_list/bats/viewname?startkey=[":game",":year",":month",":day"]&endkey=[":game",":year",":month",":day",{}] >> > > >> > > this worked just fine before in couchdb 1.2.1 when selecting days that >> > were >> > > not populated.... >> > > but the view works fine and returns empty rows...the list function >> > however >> > > is where it blew up..aparently if you write start({}) for setting >> > > headers...but you dont ever call the send function...it blows up with >> > > >> > > [Tue, 16 Apr 2013 02:15:20 GMT] [error] [<0.2125.1>] Uncaught error in >> > HTTP >> > > request: {error,undef} >> > > [Tue, 16 Apr 2013 02:15:20 GMT] [info] [<0.2125.1>] Stacktrace: >> > > [{undefined,write_chunk,[[]]}, >> > > {couch_httpd,last_chunk,1}, >> > > {couch_mrview_show,list_cb,2}, >> > > {couch_mrview,finish_fold,2}, >> > > >> {couch_query_servers,with_ddoc_proc,2}, >> > > {couch_httpd,etag_maybe,2}, >> > > {couch_httpd_db,do_db_req,2}, >> > > {couch_httpd,handle_request_int,5}] >> > > >> > > but if you just add: >> > > >> > > send("") sending an empty string it works just fine..so my work around >> is >> > > sending this empty string...it does not pollute the response in >> > > anyway...but existing code does break >> > > >> > > >> > > On Tue, Apr 16, 2013 at 9:44 PM, Dave Cottlehuber >> > wrote: >> > > >> > >> On 17 April 2013 00:29, Stanley Iriele >> > >> wrote: >> > >> > nevermind..I found the cause...It is clearly a couhdb bug...but I >> > found a >> > >> > work around for it that seems to make everyone happy..if anyone gets >> > this >> > >> > error...or even sees this message I'll happily follow up >> > >> >> > >> Hi Stanley, >> > >> >> > >> Glad to hear you found a solution! Can you share the HTTP query syntax >> > >> you are using, and also what your workaround is? >> > >> >> > >> If it's a bug a JIRA ticket would be welcomed >> > >> https://issues.apache.org/jira/browse/COUCHDB with the details. >> > >> >> > >> A+ >> > >> Dave >> > >> >> > >> > On Mon, Apr 15, 2013 at 8:00 PM, Stanley Iriele < >> > >> > siriele@breaktimestudios.com> wrote: >> > >> > >> > >> >> Hi,,,I have just upgraded to using couchdb 1.3.0 from 1.2.1 and now >> > this >> > >> >> stack trace is showing up when i query startkey and endkey values >> > that >> > >> are >> > >> >> out of range of the view..is there a flag i need to set or config i >> > >> need to >> > >> >> change because this was not hapening before >> > >> >> >> > >> >> >> > >> >> [Tue, 16 Apr 2013 02:15:20 GMT] [error] [<0.2125.1>] Uncaught error >> > in >> > >> >> HTTP request: {error,undef} >> > >> >> [Tue, 16 Apr 2013 02:15:20 GMT] [info] [<0.2125.1>] Stacktrace: >> > >> >> [{undefined,write_chunk,[[]]}, >> > >> >> {couch_httpd,last_chunk,1}, >> > >> >> {couch_mrview_show,list_cb,2}, >> > >> >> {couch_mrview,finish_fold,2}, >> > >> >> >> > {couch_query_servers,with_ddoc_proc,2}, >> > >> >> {couch_httpd,etag_maybe,2}, >> > >> >> {couch_httpd_db,do_db_req,2}, >> > >> >> >> {couch_httpd,handle_request_int,5}] >> > >> >> >> > >> >> > >>