You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Jens Alfke <je...@couchbase.com> on 2013/01/15 18:32:56 UTC

Did BigCouch recently change sequence IDs to be arrays?

I just got a bug report about TouchDB failing to sync with BigCouch. From the symptoms, it appears that BigCouch has recently changed its sequence IDs (as returned from _changes) from strings to arrays. Is that true?

I don’t have a local BigCouch to test against currently, but I just confirmed that Cloudant is still using strings for sequence IDs; they look like this:
> "last_seq":"5865-g1AAAADzeJzLYWBgYMlgTmFQSElKzi9KdUhJMtbLTS3KLElMT9VLzskvTUnMK9HLSy3JAapkSmRIsv___39WEgMD61ZUbeZ4tCU5AMmkepjOw6g6TfDozGMBkgwNQAqoeT9Y913i7YXoPgDRDbF7ShYAyj1QSA”

If BigCouch is now using arrays, then I need to fix my code to serialize them properly in the “?since” parameter to the _changes feed URL. But this is a bit confusing — if I JSON-encode the sequence ID, then IDs that are strings will now have double-quotes around them, and I don’t know if Cloudant will understand that. Do I need to special-case based on the type, i.e. stripping the quotes if it’s a string?

—Jens

Re: Did BigCouch recently change sequence IDs to be arrays?

Posted by Robert Newson <ro...@gmail.com>.
We handle it with quotes, pretty sure, and for the reason you suggest.

Cloudant does not run bigcouch. Bigcouch is an extracted portion of our
platform so there's inevitably some drift. The main reason cloudant hasn't
switched to the new format is because of the preponderance of third part
tools that assume number or string, rather than json.

On Tuesday, January 15, 2013, Jens Alfke wrote:

>
> On Jan 15, 2013, at 9:48 AM, Robert Newson <rnewson@apache.org<javascript:;>
> <mailto:rnewson@apache.org <javascript:;>>> wrote:
>
> Yes, that's true. An update_seq is always valid JSON and should be
> treated opaquely, though a change does flush out bugs in client
> libraries and such.
>
> But if I treat it opaquely and send it as JSON, the string sequence IDs
> that Cloudant uses would end up with quotes around them, i.e.
> GET /db/_changes?since=%221-foobarbazzbo%22
> instead of what TouchDB sends now,
> GET /db/_changes?since=1-foobarbazzbo
> Will that still work?
>
> Also, why is it that BigCouch does this (and has for at least 10 months,
> apparently) and Cloudant, which runs BigCouch, doesn’t? I’ve been assuming
> that I can treat Cloudant and BigCouch compatibility as nearly the same
> thing, but maybe not.
>
> —Jens
>

Re: Did BigCouch recently change sequence IDs to be arrays?

Posted by Jens Alfke <je...@couchbase.com>.
On Jan 15, 2013, at 9:48 AM, Robert Newson <rn...@apache.org>> wrote:

Yes, that's true. An update_seq is always valid JSON and should be
treated opaquely, though a change does flush out bugs in client
libraries and such.

But if I treat it opaquely and send it as JSON, the string sequence IDs that Cloudant uses would end up with quotes around them, i.e.
GET /db/_changes?since=%221-foobarbazzbo%22
instead of what TouchDB sends now,
GET /db/_changes?since=1-foobarbazzbo
Will that still work?

Also, why is it that BigCouch does this (and has for at least 10 months, apparently) and Cloudant, which runs BigCouch, doesn’t? I’ve been assuming that I can treat Cloudant and BigCouch compatibility as nearly the same thing, but maybe not.

—Jens

Re: Did BigCouch recently change sequence IDs to be arrays?

Posted by Robert Newson <rn...@apache.org>.
Yes, that's true. An update_seq is always valid JSON and should be
treated opaquely, though a change does flush out bugs in client
libraries and such.

B.

On 15 January 2013 12:32, Jens Alfke <je...@couchbase.com> wrote:
> I just got a bug report about TouchDB failing to sync with BigCouch. From the symptoms, it appears that BigCouch has recently changed its sequence IDs (as returned from _changes) from strings to arrays. Is that true?
>
> I don’t have a local BigCouch to test against currently, but I just confirmed that Cloudant is still using strings for sequence IDs; they look like this:
>> "last_seq":"5865-g1AAAADzeJzLYWBgYMlgTmFQSElKzi9KdUhJMtbLTS3KLElMT9VLzskvTUnMK9HLSy3JAapkSmRIsv___39WEgMD61ZUbeZ4tCU5AMmkepjOw6g6TfDozGMBkgwNQAqoeT9Y913i7YXoPgDRDbF7ShYAyj1QSA”
>
> If BigCouch is now using arrays, then I need to fix my code to serialize them properly in the “?since” parameter to the _changes feed URL. But this is a bit confusing — if I JSON-encode the sequence ID, then IDs that are strings will now have double-quotes around them, and I don’t know if Cloudant will understand that. Do I need to special-case based on the type, i.e. stripping the quotes if it’s a string?
>
> —Jens