incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tibor Gemes (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COUCHDB-1665) _replicator and _users
Date Fri, 01 Feb 2013 12:18:12 GMT
Tibor Gemes created COUCHDB-1665:
------------------------------------

             Summary: _replicator and _users
                 Key: COUCHDB-1665
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1665
             Project: CouchDB
          Issue Type: Bug
          Components: Replication
            Reporter: Tibor Gemes


I've set up 2 servers, one local and one remote. I want to replicate the _users database always.
So I decided to add a document to the _replicator database. This seems to be fine. But after
I add a user document to the _users database, the replicator keeps failing. It is in an endless
triggered-error-triggered-error cycle, but the replication does not take place. If I call
_replicate with the same json, then the replication happens perfectly. If the two _users databases
are in sync then the replicator document settles in the triggered state.   

Here is a simple testcase to reproduce. The local and remote databases are freshly created:
{code}
curl  -H "Content-type: application/json" -X PUT -d "{\"source\": \"_users\", \"target\":
\"${REMOTE_URL}/_users\", \"continuous\":  true, \"user_ctx\": {\"name\": \"admin\", \"roles\":
[\"admin\"]}}" ${LOCAL_URL}/_replicator/users:devices_users
{"ok":true,"id":"users:devices_users","rev":"1-010f00d464fba86a2820371c7bf04900"}

curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"2-1df51063f46e4465ec1f6aaad7b03cd7","source":"_users","target":"http://admin:devices@devices-db:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"triggered","_replication_state_time":"2013-02-01T12:57:05+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

curl -X PUT -d  '{ "type": "user",   "name": "u1",  "roles": ["u1"],  "password": "XXX"}'
${LOCAL_URL}/_users/org.couchdb.user:u1
{"ok":true,"id":"org.couchdb.user:u1","rev":"1-f27f72a514abae8078740c792d5a0795"}

curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"3-c0ee7e14995877591740ee3191c147df","source":"_users","target":"http://admin:devices@devices-db:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"error","_replication_state_time":"2013-02-01T12:57:52+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"9-e16eff5cb75c2620a429ba0610bbf487","source":"_users","target":"http://admin:devices@devices-db:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"error","_replication_state_time":"2013-02-01T12:58:08+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

curl -X GET ${REMOTE_URL}/_users/org.couchdb.user:u1
{"error":"not_found","reason":"missing"}

curl  -H "Content-type: application/json" -X POST -d  "{\"source\": \"_users\", \"target\":
\"${REMOTE_URL}/_users\"}" ${LOCAL_URL}/_replicate
{"ok":true,"session_id":"bc58f3a39efb24ecbcb73114040c13b9","source_last_seq":2,"replication_id_version":2,"history":[{"session_id":"bc58f3a39efb24ecbcb73114040c13b9","start_time":"Fri,
01 Feb 2013 12:02:07 GMT","end_time":"Fri, 01 Feb 2013 12:02:07 GMT","start_last_seq":0,"end_last_seq":2,"recorded_seq":2,"missing_checked":2,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0}]}

curl -X GET ${REMOTE_URL}/_users/org.couchdb.user:u1
{"_id":"org.couchdb.user:u1","_rev":"1-f27f72a514abae8078740c792d5a0795","type":"user","name":"u1","roles":["u1"],"password_sha":"da3b3bd9b957aafe94e9abce96bea95150d3dc8c","salt":"203b9f2e2bde5de40f107e84a4fec173"}

curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"102-1bd305355290f8209985e2284250e8ce","source":"_users","target":"http://admin:devices@devices-db:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"triggered","_replication_state_time":"2013-02-01T13:02:12+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}
{code}

Here is what I see in the couchdb log: 
{code}
[info] [<0.1742.0>] Document `users:devices_users` triggered replication `d78c7d9b7b215c6f2a3cb99c41f6be4c+continuous`
[info] [<0.1736.0>] starting new replication `d78c7d9b7b215c6f2a3cb99c41f6be4c+continuous`
at <0.1742.0> (`_users` -> `h
ttp://admin:*****@devices-db:5984/_users/`)
[error] [emulator] Error in process <0.1749.0> with exit value: {{nocatch,not_found},[{couch_users_db,after_doc_read,2,[
{file,"couch_users_db.erl"},{line,99}]},{couch_db,'-open_doc_revs_int/3-fun-0-',3,[{file,"couch_db.erl"},{line,1166}]},{
lists,map,2,[{file,"lists.erl"},{line,1173}]},{couch_db,'-open_doc_revs_int/3-fun-1-'... 



=ERROR REPORT==== 1-Feb-2013::13:02:07 ===
Error in process <0.1749.0> with exit value: {{nocatch,not_found},[{couch_users_db,after_doc_read,2,[{file,"couch_users_
db.erl"},{line,99}]},{couch_db,'-open_doc_revs_int/3-fun-0-',3,[{file,"couch_db.erl"},{line,1166}]},{lists,map,2,[{file,
"lists.erl"},{line,1173}]},{couch_db,'-open_doc_revs_int/3-fun-1-'... 

[error] [<0.1742.0>] Worker <0.1749.0> died with reason: {{nocatch,not_found},
                                                          [{couch_users_db,
                                                            after_doc_read,2,
                                                            [{file,
                                                              "couch_users_db.erl"},
                                                             {line,99}]},
                                                           {couch_db,
                                                            '-open_doc_revs_int/3-fun-0-',
                                                            3,
                                                            [{file,
                                                              "couch_db.erl"},
                                                             {line,1166}]},
                                                           {lists,map,2,
                                                            [{file,
                                                              "lists.erl"},
                                                             {line,1173}]},
                                                           {couch_db,
                                                            '-open_doc_revs_int/3-fun-1-',
                                                            4,
                                                            [{file,
                                                              "couch_db.erl"},
                                                             {line,1158}]},
                                                           {lists,zipwith,3,
...
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message