couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CGS <>
Subject Re: Attachments and replication
Date Thu, 19 Jan 2012 02:21:57 GMT
Hi Steven,

As far as I know, the attachments are still hardcoded in the document and
so, if the document changes its revision, the new document inherits all the
fields (including its attachments). Therefore, the replication transfers
again the attachment. I suppose this was the way to avoid the loss of the
attachment in case of compaction.

Relatively recently, there was a discussion to make an attachment to be
held only once per database (or even maybe externally, don't remember
exactly), but I have no knowledge of its outcome. Maybe someone more
knowledgeable will be able to give you more details here.

For the time being, my suggestion would be you to use external paths
(usually, they are much smaller) and to transfer the files by an external


On Thu, Jan 19, 2012 at 2:52 AM, Steven Ringo <>wrote:

> Hi all,
> Assuming I have a document with an attachment and some fields, and that
> this document has been replicated between source and target servers.
> {
>   "_id": "**551ffd9dc43cb73c257628d8a31e9e**1f",
>   "_rev": "4-**387d5d23b62e398421bddb10e16e74**0f",
>   "foo": "bar",
>   "baz": "quux",
>   "published": false,
>   "_attachments": {
>       "photo.jpg": {
>           "content_type": "image/jpeg",
>           "revpos": 2,
>           "digest": "md5-iOKjYGKWzEmEtMaqmYCtlA=="**,
>           "length": 3622469,
>           "stub": true
>       }
>   }
> }
> Let's say I change one of the fields on the source server; say "foo":
> "bar" to "foo": "bar2". I then do a pull replication.
> Sniffing the packets, it seems to me the entire document is replicated,
> including attachments. I was under the impression couchdb would be able to
> replicate the document independently of the attachments.
> In other words couchdb would transfer just the "text/json" portion of the
> document and not the attachment, i.e. less than ~1 kbyte vs. a few
> megebytes in this case.
> My experience seems to contradict my assumption. It looks like the digest
> and revpos fields are used for this, as mentioned here:
> revpos-value-used-for-in-**couchdb-attachments<>
> Is there something I am missing or perhaps a configuration option I am not
> setting properly?
> Thanks.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message