couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Iriele <siri...@breaktimestudios.com>
Subject Re: startkey endkey problem
Date Wed, 17 Apr 2013 08:04:33 GMT
Hopefully this helps someone somewhere... I'll make a tucket for this
tomorrow... (Hopefully)
On Apr 17, 2013 1:03 AM, "Stanley Iriele" <siriele2x3@gmail.com> 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" <bchesneau@gmail.com> 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 <siriele2x3@gmail.com>
> > 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 <dch@jsonified.com>
> > wrote:
> > >
> > >> On 17 April 2013 00:29, Stanley Iriele <siriele@breaktimestudios.com>
> > >> 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}]
> > >> >>
> > >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message