Monitoring replication status through the REST api

58 views
Skip to first unread message

Daniel Carr

unread,
Jul 5, 2014, 7:36:51 AM7/5/14
to mobile-c...@googlegroups.com
I'm setting up a inital replication, and want to monitor whether it exits with an error or whether it completes.

However, if I trigger an error it disappears from _active_tasks, just like if it completed. (I've seen this happen with continuous replications as well)

Is there a better way to monitor the status of a replication through the REST api.

In couchDB, you can GET /_replicator/:session_id. Is there something similar in couchbase-lite?

Jens Alfke

unread,
Jul 5, 2014, 1:24:56 PM7/5/14
to mobile-c...@googlegroups.com

On Jul 5, 2014, at 4:36 AM, Daniel Carr <d.dougl...@gmail.com> wrote:

> I'm setting up a inital replication, and want to monitor whether it exits with an error or whether it completes.
> However, if I trigger an error it disappears from _active_tasks, just like if it completed. (I've seen this happen with continuous replications as well)

If it’s a non-continuous replication, the response status of the POST to _replicate will indicate the error, if any.
If it’s continuous, the POST returns immediately, but the replication should remain in _active_tasks indefinitely; if not, that’s a bug.

(What platform are you running on? It’s always good to state that up front.)

> In couchDB, you can GET /_replicator/:session_id. Is there something similar in couchbase-lite?

No, that’s part of the persistent-replication API. We used to support persistent replications, but took them out because they aren’t needed in an embedded engine, and supporting them added a lot of complexity.

—Jens

Daniel Carr

unread,
Jul 6, 2014, 4:14:42 AM7/6/14
to mobile-c...@googlegroups.com
Thanks Jens.

For the record, I'm on android. Sorry about omitting that.

I think there may be a problem here. How would I know that a one shot replication has failed due to network disconnection?

Scenario: 

    1. Trigger non-continuous replication

    2.  Part way through the replication, the device is disconnected from the network

    3. The replication attempts to reconnect 10(?) times, then fails


The replication is not in _active_tasks, just like if it was successful. There is no where to check if there's an error. )This is why in couchdb a one-shot replication does not respond to the POST request until the replication is complete.)

Is the fact that a one-shot replication disappears from _active_tasks on error a bug? If it stayed there, it would work (though you could end up with a very large _active_tasks). 

Jens Alfke

unread,
Jul 6, 2014, 1:40:49 PM7/6/14
to mobile-c...@googlegroups.com

On Jul 6, 2014, at 1:14 AM, Daniel Carr <d.dougl...@gmail.com> wrote:

This is why in couchdb a one-shot replication does not respond to the POST request until the replication is complete.)

Couchbase Lite on iOS also behaves that way. It used to respond immediately, but I changed it for this reason. The Android port may not have picked up this change, though. If it’s responding immediately to a POST for a one-shot replication, please file a bug report. (Well, first look through the open bugs to see if it’s filed already.)

—Jens

Traun Leyden

unread,
Jul 7, 2014, 11:23:49 AM7/7/14
to mobile-c...@googlegroups.com


On Sunday, July 6, 2014, Jens Alfke <je...@couchbase.com> wrote:

Couchbase Lite on iOS also behaves that way. It used to respond immediately, but I changed it for this reason. The Android port may not have picked up this change, though. If it’s responding immediately to a POST for a one-shot replication, please file a bug report. (Well, first look through the open bugs to see if it’s filed already.)


Yeah that's a known bug in couchbase lite android, although I don't have the issue # handy.
Reply all
Reply to author
Forward
0 new messages