bravier commented on issue #1418: BUG: Recreating deleted document can break 
replication when VDU function is active
URL: https://github.com/apache/couchdb/issues/1418#issuecomment-430149024
 
 
   Hello,
   
   We are facing a similar issue as the one described by @ondra-novak on the 
`_users` database.
   
   ## Steps to reproduce
   Let `A` and `B` be 2 CouchDB servers.
   
   - Create the `_users` database _(if it does not exist yet)_
     _Request_
     ```shell
     curl -X PUT http://$A:5984/_users
     ```
     _Response_
     ```json
     {
       "ok": true
     }
     ```
   - Create a user document
     _Request_
     ```shell
     curl -X PUT http://$A:5984/_users/org.couchdb.user:[email protected] -d 
'{"name": "[email protected]", "type": "user", "roles": [], "password": 
"password"}'
     ```
     _Response_
     ```json
     {
       "ok": true,
       "id": "org.couchdb.user:[email protected]",
       "rev": "1-19fa61446d76bcb9131a1b65c03b4c1c"
     }
     ```
   - Replicate `_users` from `A` to `B`
     _Request_
     ```shell
     curl -X POST http://$A:5984/_replicate \
      -d 
'{"source":"http://$A:5984/_users","target":"http://$B:5984/_users","create_target":true}'
 \
      -H "Content-Type: application/json"
     ```
     _Response_
     ```json
     {
       "ok": true,
       "session_id": "...",
       "..."
     }
   - Delete the user document from `A`
     _Request_
     ```shell
     curl -X DELETE 
http://$A:5984/_users/org.couchdb.user:[email protected]?rev=1-19fa61446d76bcb9131a1b65c03b4c1c
     ```
     _Response_
     ```json
     {
       "ok": true,
       "id": "org.couchdb.user:[email protected]",
       "rev": "2-43b4189bc429587a529beba79a037cad"
     }
     ```
   - Replicate `_users` from `A` to `B` once again
     _Request_
     ```shell
     curl -X POST http://$A:5984/_replicate \
      -d 
'{"source":"http://$A:5984/_users","target":"http://$B:5984/_users","create_target":true}'
 \
      -H "Content-Type: application/json"
     ```
     _Response_
     ```json
     {
       "ok": true,
       "session_id": "...",
       "..."
     }
   - Re-create the same user document again on `A`
     _Request_
     ```shell
     curl -X PUT http://$A:5984/_users/org.couchdb.user:[email protected] -d 
'{"name": "[email protected]", "type": "user", "roles": [], "password": 
"password"}'
     ```
     _Response_
     ```json
     {
       "ok": true,
       "id": "org.couchdb.user:[email protected]",
       "rev": "3-1a2c0e3876f314e08d80b1d236481a2d"
     }
     ```
   - Replicate `_users` from `A` to `B`
     _Request_
     ```shell
     curl -X POST http://$A:5984/_replicate \
      -d 
'{"source":"http://$A:5984/_users","target":"http://$B:5984/_users","create_target":true}'
 \
      -H "Content-Type: application/json"
     ```
     _Response_
     ```json
     {
       "ok": true,
       "session_id": "...",
       "..."
     }
     ```
     
   ## Expected behavior
   The user document might be replicated from `A` to `B` and the number of 
documents on `A/_users` and `B/_users` might be equal to 2.
     
   ## Current behavior
   The document is not replicated and the number of documents on `A/_users` is 
equal to 2 but the number of documents on `B/_users` is equal to 1.
   
   ## Environment
   - Server `A`
     - OS: Fedora 28
     - CouchDB: 2.1.2
   - Server `B`
     - OS: CentOS 7.5.1804
     - CouchDB: 2.1.2
   
   This issue is quite impacting for us as it silently breaks replication and 
can lead to data loss.
   
   Thanks in advance for helping us on this bug.
   
   Do not hesitate to ask me for more infos if needed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to