Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1518

HTTP COPY with attachments can leave the "revpos" of attachments higher than the "_rev" of the document

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.1.1, 1.2
    • None
    • Database Core
    • None
    • Debian Linux 6.0.5 / CouchDB 1.1.1 / Erlang R14B03
      Ubuntu Linux 12.04 / CouchDB 1.2.0 / Erlang R15B01

    • Regular Contributors Level (Easy to Medium)

    Description

      When COPYing a document with attachments, the _rev of the new document is set to 1-something, but the revpos on the attachments is left as is, meaning they're generally higher than the _rev of the new document.

      I believe this is incorrect, and will cause problems later when updating/replicating the document. (I believe I'm seeing specific problems and am working on a test case, but am not sure they're particularly necessary if this behaviour is incorrect)

      It's quite possible I've misunderstood how attachment revpos works and that this behaviour is ok.

      Specific naming IDs, attachments, etc, don't seem to matter, substitute your own.
      Untested on earlier versions of CouchDB.

      curl -X PUT http://127.0.0.1:5984/testdb/document1 -d '

      {"name": "cat pictures"}

      '
      curl -X GET http://127.0.0.1:5984/testdb/document1

      1. Note down REV and put it in the attachment upload:
        curl -X PUT http://127.0.0.1:5984/testdb/document1/cat1.jpg?rev=REV --data-binary @cat1.jpg -H 'Content-Type: image/jpeg'
      1. Copy the document
        curl -X COPY http://127.0.0.1:5984/testdb/document1 -H "Destination: document2"

      curl -X GET http://127.0.0.1:5984/testdb/document2

      1. Note: revision is 1-something
      2. revpos on attachment is 2-something

      Attachments

        Activity

          People

            rnewson Robert Newson
            mugginsm Colin Coghill
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: