phonegap, android: one-shot replication http request returns immediately

40 views
Skip to first unread message

Daniel Carr

unread,
Mar 8, 2014, 6:46:00 PM3/8/14
to mobile-c...@googlegroups.com
Hi all.

When using phonegap, (and therefore the http servlet), POST to /_replicate gets a response straight away, even if it is not a continuous replication.

This is not compliant with the CouchDB api, as on a non-continuous replication, POST does not respond until the replication is complete or err.

I wanted to know if this is intentional before creating an issue. It is a problem for me, as I need to do an initial replication when the application is started, then set up a continuous replication afterwards. It is much harder to monitor a replication over active tasks, then just react to the POST request. (Esp. for error handling). Probably don't need to full info that couchdb gives, but the error, and the start_last_seq, end_last_seq, recorded_seq can be very useful.

Is this intentional, or should I open a ticket? It could also be part of this issue:  https://github.com/couchbase/couchbase-lite-java-core/issues/75

Cheers,
Daniel


couchbase lite:


POST /_replicate
{
    "source":"http://xxxxx:xx...@xxx.xxx.xxx.xxx:5984/testdb"
    "target":"testdb"
}

RESP 200

{"session_id":"repl001"}


couchdb:

POST /_replicate
{
    "source":"http://xxxxx:xx...@xxx.xxx.xxx.xxx:5984/testdb"
    "target":"testdb"
}

// There is a pause here, until the replication completes, or errs

RESP 200

{"ok":true,"session_id":"ee17015a867d04d650c4f2062428fdb3","source_last_seq":2318,"replication_id_version":3,"history":[{"session_id":"ee17015a867d04d650c4f2062428fdb3","start_time":"Sat, 08 Mar 2014 23:32:45 GMT","end_time":"Sat, 08 Mar 2014 23:34:37 GMT","start_last_seq":0,"end_last_seq":2318,"recorded_seq":2318,"missing_checked":1198,"missing_found":1198,"docs_read":1198,"docs_written":1198,"doc_write_failures":0}]}

RESP 500
{"error":"db_not_found","reason":"could not open http://XXXXX"}

RESP 500
{"error":"{http_request_failed,\"HEAD\",\n \"http://xxxx",\n {error,{error,{conn_failed,{error,enetunreach}}}}}"}

Traun Leyden

unread,
Mar 9, 2014, 11:26:49 AM3/9/14
to mobile-c...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/1dc1f83d-c3cb-47bf-ac6e-a0e9b7c3fe66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages