couchdb-replication mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Harter <>
Subject Re: What can last_seq from _changes be?
Date Mon, 01 Jun 2015 21:02:09 GMT
Hi Alexander,

On 1 June 2015 at 21:14, Alexander Shorin <> wrote:

> Hi,
> On Mon, Jun 1, 2015 at 10:57 PM, Paul Harter <>
> wrote:
> > I'm using CouchDB and Couchbase Sync Gateway together on a project and
> have
> > run into an incompatibility in how they replicate.
> >
> > In the CouchDB docs it states that last_seq in the the return value of
> > _changes should be a number.
> >
> > Sync Gateway sometimes returns strings like "82::100", two or more ints
> > separated by pairs of colons. When CouchDB gets a values like this during
> > replication from SG it returns it in its next _changes GET as a JSON
> > encoded string with quotes:
> >
> > ?since=%2282%3A%3A100%22
> >
> It seems that replicator is confused or done wrong. There should be no
> case when replicator operates with seqs format which Source peer
> cannot understand. I believe this error could be happened because of
> any of these conditions:
> - SG Source peer was transparently replaced by CouchDB;
> - Replicator has an error in replication logs comparison logic when it
> accidentally takes Target update_seq which Source peer cannot
> understood;
> Could you provide a bit more information what's your replication case
> and who is running your replication?

I'm using CouchDB 1.6.1 and Sync Gateway built from Github on March 18th
commit 1c6559c.

I'm asking CouchDB to replicate from a Sync Gateway database to one of its
own, so CouchDB is running the replication. I'm doing two successive single
pull replications into an existing CouchDB database from Sync Gateway. The
last_seq value returned by the first replication is a string like
"82::100". CouchDB returns this identifier to SyncGateway in the second
replication in the "since" param of the GET query string, but it does so
with quotes around the value like this:


but Sync Gateway isn't expecting the quotes and 500s

> > So the question is: can last_seq be any json value and if so should it
> > always be json encoded in the _changes get query string as CouchDB
> > currently does, or is CouchDB misbehaving in adding the quotes to the
> > string? Or should it just always be a number as the docs state?
> Yes, it can be any JSON value. For CouchDB 1.x it's number, for
> Cloudant it's string, for CouchDB 2.0+ it's array of number and string
> pair.

So the CouchDB version I'm using, 1.6.1, will itself only create a
numerical last_seq, but is there any way to control how it interprets and
then encodes last_seq values it receives from SG? Can I ask it to not json
encode strings?

Maybe I should I use CouchDB 2.0? Would this make any difference?



Paul Harter
Glowinthedark Ltd, Studio 20, Containerville, Corbridge Crescent, London E2
+44 (0)7957 540940

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