You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Martin Hewitt <ma...@thenoi.se> on 2012/06/22 04:03:00 UTC
_replicator endpoint and idempotency
Hi all,
Just a quick question - if I have a replication payload and I post the same payload twice to the _replicator endpoint, will it create two replication jobs or is the _id field in the _replicator db a hash of the document?
I'm trying to ensure continuous master-master behaviour and I'm wondering if I need to read and check against the contents of the _replicator db or if CouchDB can sort it out for me!
Thanks,
Martin
Re: _replicator endpoint and idempotency
Posted by Martin Hewitt <ma...@thenoi.se>.
Thanks Dave, that was my interpretation of the docs as well, but I didn't see the exact phrasing I was looking for so thought it was worth checking out!
Martin
On Friday, 22 June 2012 at 11:53, Dave Cottlehuber wrote:
> On 22 June 2012 04:03, Martin Hewitt <martin@thenoi.se (mailto:martin@thenoi.se)> wrote:
> > Hi all,
> >
> > Just a quick question - if I have a replication payload and I post the same payload twice to the _replicator endpoint, will it create two replication jobs or is the _id field in the _replicator db a hash of the document?
> >
> > I'm trying to ensure continuous master-master behaviour and I'm wondering if I need to read and check against the contents of the _replicator db or if CouchDB can sort it out for me!
> >
> > Thanks,
> >
> > Martin
>
> It's idempotent. Try it and see - you can see the id returned on creation:
>
> Run 1:
> {"ok":true,"_local_id":"b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous"}
>
> run 2:
> {"ok":true,"_local_id":"b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous"}
>
> Or look later on using GET $COUCH/_active_tasks:
> {
> "checkpointed_source_seq": 20122,
> "continuous": true,
> "doc_id": null,
> "doc_write_failures": 0,
> "docs_read": 0,
> "docs_written": 0,
> "missing_revisions_found": 0,
> "pid": "<0.842.3>",
> "progress": 100,
> "replication_id": "b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous",
> "revisions_checked": 0,
> "source": "e2",
> "source_seq": 20122,
> "started_on": 1340360725,
> "target": "e1",
> "type": "replication",
> "updated_on": 1340360935
> },
>
> And similar info is in couch.log as well of course.
>
> A+
> Dave
>
>
Re: _replicator endpoint and idempotency
Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 22 June 2012 04:03, Martin Hewitt <ma...@thenoi.se> wrote:
> Hi all,
>
> Just a quick question - if I have a replication payload and I post the same payload twice to the _replicator endpoint, will it create two replication jobs or is the _id field in the _replicator db a hash of the document?
>
> I'm trying to ensure continuous master-master behaviour and I'm wondering if I need to read and check against the contents of the _replicator db or if CouchDB can sort it out for me!
>
> Thanks,
>
> Martin
It's idempotent. Try it and see - you can see the id returned on creation:
Run 1:
{"ok":true,"_local_id":"b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous"}
run 2:
{"ok":true,"_local_id":"b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous"}
Or look later on using GET $COUCH/_active_tasks:
{
"checkpointed_source_seq": 20122,
"continuous": true,
"doc_id": null,
"doc_write_failures": 0,
"docs_read": 0,
"docs_written": 0,
"missing_revisions_found": 0,
"pid": "<0.842.3>",
"progress": 100,
"replication_id": "b53bf6d24f7baca426fc0ccbbc5a7a8a+continuous",
"revisions_checked": 0,
"source": "e2",
"source_seq": 20122,
"started_on": 1340360725,
"target": "e1",
"type": "replication",
"updated_on": 1340360935
},
And similar info is in couch.log as well of course.
A+
Dave