CouchDB
  1. CouchDB
  2. COUCHDB-885

Attachments introduce conflicts after replication.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.3, 1.1, 1.2
    • Component/s: Database Core
    • Labels:
      None
    • Environment:

      Mac OSX, Windows XP, Windows 7

    • Skill Level:
      Committers Level (Medium to Hard)

      Description

      Step to reproduce the bug:

      1. Make database "test" on a remote couchdb server that reside on a different machine!
      2. Create new document: "http://remote-server:5984/test/doc"
      3. Create database "replica" on the local couchdb server.
      4. Trigger pull replication http://remote-server:5984/test -> http://localhost:5984/replica
      5. Attach a file to the replicated document on the local couchdb server.
      6. Trigger push replication http://localhost:5984/replica -> http://remote-server:5984/test

      The document in the test database shows one conflict. If instead attachment the document is updated with a new field after the replication no conflict.
      The same sequence shows no conflicts on CouchDB 0.11.

                            • test.sh ****************

      #!/usr/bin/env bash

      LOCAL="http://localhost:5984"
      REMOTE="http://koleto.couchone.com"

      echo "====================================================="
      echo "This sequence create a conflict after the replication"
      echo "====================================================="

      echo "Cleanup"
      curl --silent -X DELETE $LOCAL/replica
      curl --silent -X DELETE $REMOTE/test

      echo "Create database:" $REMOTE/test
      curl --silent -X PUT $REMOTE/test

      echo "Create empty document:"
      curl --silent -d '{}' -X PUT $REMOTE/test/doc

      echo "Create local databse:" $LOCAL/replica
      curl --silent -X PUT $LOCAL/replica

      echo "Pull replication:" REMOTE/test "->" $LOCAL/replica
      curl --silent -X POST -d "

      {\"source\":\"$REMOTE/test\",\"target\":\"$LOCAL/replica\"}

      " -H 'Content-Type: application/json' $LOCAL/_replicate

      echo "Put an attachment to the document:"
      echo "foobar!" | curl --silent --upload-file - -X PUT "$LOCAL/replica/doc/foo.txt?rev=1-967a00dff5e02add41819138abb3284d"

      echo "Push replication:" $LOCAL/replica "->" $REMOTE/test
      curl --silent -X POST -d "

      {\"source\":\"$LOCAL/replica\",\"target\":\"$REMOTE/test\"}

      " -H 'Content-Type: application/json' $LOCAL/_replicate

      echo '############## Get one conflic #####################'
      curl --silent -X GET $REMOTE/test/doc?conflicts=true

      echo "====================================================="
      echo "The same sequence with adding a field to the document"
      echo "====================================================="

      echo "Cleanup"
      curl --silent -X DELETE $LOCAL/replica
      curl --silent -X DELETE $REMOTE/test

      echo "Create database:" $REMOTE/test
      curl --silent -X PUT $REMOTE/test

      echo "Create empty document:"
      curl --silent -d '{}' -X PUT $REMOTE/test/doc

      echo "Create local databse:" $LOCAL/replica
      curl --silent -X PUT $LOCAL/replica

      echo "Pull replication:" REMOTE/test "->" $LOCAL/replica
      curl --silent -X POST -d "

      {\"source\":\"$REMOTE/test\",\"target\":\"$LOCAL/replica\"}

      " -H 'Content-Type: application/json' $LOCAL/_replicate

      echo "Adding a new field:"
      curl --silent -d '

      {"foo":"bar" , "_rev" : "1-967a00dff5e02add41819138abb3284d" }

      ' -X PUT $LOCAL/replica/doc?rev=1-967a00dff5e02add41819138abb3284d

      echo "Push replication:" $LOCAL/replica "->" $REMOTE/test
      curl --silent -X POST -d "

      {\"source\":\"$LOCAL/replica\",\"target\":\"$REMOTE/test\"}

      " -H 'Content-Type: application/json' $LOCAL/_replicate

      echo '###### No conflicts after the replication ########'
      curl --silent -X GET $REMOTE/test/doc?conflicts=true

      1. COUCHDB-885.sh
        0.8 kB
        Robert Newson

        Issue Links

          Activity

          Robert Newson made changes -
          Fix Version/s 1.0.3 [ 12316107 ]
          Fix Version/s 1.1 [ 12314933 ]
          Robert Newson made changes -
          Attachment COUCHDB-885.sh [ 12479467 ]
          Paul Joseph Davis made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Randall Leeds made changes -
          Link This issue relates to COUCHDB-902 [ COUCHDB-902 ]
          Jan Lehnardt made changes -
          Fix Version/s 1.2 [ 12315198 ]
          Fix Version/s 0.11 [ 12313841 ]
          Paul Joseph Davis made changes -
          Skill Level Committers Level (Medium to Hard)
          Nikolai Teofilov made changes -
          Summary Delete document with attachment fails after replication. Attachments introduce conflicts after replication.
          Description Step to reproduce the bug:

          1. Make database "test" on a remote couchdb server that reside on a different machine!
          2. Create new document: "http://remote-server:5984/test/doc"
          3. Create database "test" on the local couchdb server.
          4. Trigger pull replication http://remote-server:5984/test -> http://localhost:5984/test
          5. Attach a file to the replicated document on the local couchdb server.
          6. Trigger push replication http://localhost:5984/test -> http://remote-server:5984/test
          7. Delete the replicated document that contain now the attachment on remote database.
           
                This operation will delete the last revision of the document (after the replication) but the previous revision of the document (before the replication) still exist in the database.

          This defect appears only for replications between databases on two different couchdb servers, and only for documents that were updated with a new attachment.
          Step to reproduce the bug:

          1. Make database "test" on a remote couchdb server that reside on a different machine!
          2. Create new document: "http://remote-server:5984/test/doc"
          3. Create database "replica" on the local couchdb server.
          4. Trigger pull replication http://remote-server:5984/test -> http://localhost:5984/replica
          5. Attach a file to the replicated document on the local couchdb server.
          6. Trigger push replication http://localhost:5984/replica -> http://remote-server:5984/test

          The document in the test database shows one conflict. If instead attachment the document is updated with a new field after the replication no conflict.
          The same sequence shows no conflicts on CouchDB 0.11.


          ************ test.sh ****************

          #!/usr/bin/env bash

          LOCAL="http://localhost:5984"
          REMOTE="http://koleto.couchone.com"

          echo "====================================================="
          echo "This sequence create a conflict after the replication"
          echo "====================================================="


          echo "Cleanup"
          curl --silent -X DELETE $LOCAL/replica
          curl --silent -X DELETE $REMOTE/test


          echo "Create database:" $REMOTE/test
          curl --silent -X PUT $REMOTE/test

          echo "Create empty document:"
          curl --silent -d '{}' -X PUT $REMOTE/test/doc


          echo "Create local databse:" $LOCAL/replica
          curl --silent -X PUT $LOCAL/replica

          echo "Pull replication:" REMOTE/test "->" $LOCAL/replica
          curl --silent -X POST -d "{\"source\":\"$REMOTE/test\",\"target\":\"$LOCAL/replica\"}" -H 'Content-Type: application/json' $LOCAL/_replicate

          echo "Put an attachment to the document:"
          echo "foobar!" | curl --silent --upload-file - -X PUT "$LOCAL/replica/doc/foo.txt?rev=1-967a00dff5e02add41819138abb3284d"

          echo "Push replication:" $LOCAL/replica "->" $REMOTE/test
          curl --silent -X POST -d "{\"source\":\"$LOCAL/replica\",\"target\":\"$REMOTE/test\"}" -H 'Content-Type: application/json' $LOCAL/_replicate

          echo '############## Get one conflic #####################'
          curl --silent -X GET $REMOTE/test/doc?conflicts=true

          echo "====================================================="
          echo "The same sequence with adding a field to the document"
          echo "====================================================="


          echo "Cleanup"
          curl --silent -X DELETE $LOCAL/replica
          curl --silent -X DELETE $REMOTE/test

          echo "Create database:" $REMOTE/test
          curl --silent -X PUT $REMOTE/test

          echo "Create empty document:"
          curl --silent -d '{}' -X PUT $REMOTE/test/doc


          echo "Create local databse:" $LOCAL/replica
          curl --silent -X PUT $LOCAL/replica

          echo "Pull replication:" REMOTE/test "->" $LOCAL/replica
          curl --silent -X POST -d "{\"source\":\"$REMOTE/test\",\"target\":\"$LOCAL/replica\"}" -H 'Content-Type: application/json' $LOCAL/_replicate

          echo "Adding a new field:"
          curl --silent -d '{"foo":"bar" , "_rev" : "1-967a00dff5e02add41819138abb3284d" }' -X PUT $LOCAL/replica/doc?rev=1-967a00dff5e02add41819138abb3284d


          echo "Push replication:" $LOCAL/replica "->" $REMOTE/test
          curl --silent -X POST -d "{\"source\":\"$LOCAL/replica\",\"target\":\"$REMOTE/test\"}" -H 'Content-Type: application/json' $LOCAL/_replicate

          echo '###### No conflicts after the replication ########'
          curl --silent -X GET $REMOTE/test/doc?conflicts=true
           
          Fix Version/s 0.11 [ 12313841 ]
          Component/s Database Core [ 12312233 ]
          Component/s Replication [ 12313107 ]
          Nikolai Teofilov made changes -
          Field Original Value New Value
          Description Step to reproduce the bug:

          1. Make database "test" on a remote couchdb server that reside on a different machine!
          2. Create new document: "http://remote-server:5984/test/doc"
          3. Create database "test" on the local couchdb server.
          4. Trigger pull replication http://remote-server:5984/test -> http://localhost:5984/test
          5. Attach a file to the replicated document on the local couchdb server.
          6. Trigger push replication http://localhost:5984/test -> http://remote-server:5984/test
          7. Delete the replicated document that contain now the attachment on remote database.
           
                This will delete last revision of the document after the replication but the previous revision of the document before the replication still exist in the database.

          This defect appears only between replication between databases on two different couchdb servers, and it only for documents that has been updated with a new attachment.
          Step to reproduce the bug:

          1. Make database "test" on a remote couchdb server that reside on a different machine!
          2. Create new document: "http://remote-server:5984/test/doc"
          3. Create database "test" on the local couchdb server.
          4. Trigger pull replication http://remote-server:5984/test -> http://localhost:5984/test
          5. Attach a file to the replicated document on the local couchdb server.
          6. Trigger push replication http://localhost:5984/test -> http://remote-server:5984/test
          7. Delete the replicated document that contain now the attachment on remote database.
           
                This operation will delete the last revision of the document (after the replication) but the previous revision of the document (before the replication) still exist in the database.

          This defect appears only for replications between databases on two different couchdb servers, and only for documents that were updated with a new attachment.
          Nikolai Teofilov created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Nikolai Teofilov
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development