Hi CGS,
Seems strange to me since updates are made to a document by using stubs;
i.e without recreating the attachment. "When you update the document you
must include the attachment stubs or CouchDB will delete the
attachment." - http://wiki.apache.org/couchdb/HTTP_Document_API
The idea of having to use external storage seems is counter to what I
decided to use couchdb for at the outset.
Thanks,
CGS wrote:
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
script.
CGS
On Thu, Jan 19, 2012 at 2:52 AM, Steven Ringo<[email protected]>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:
http://stackoverflow.com/**questions/1825117/what-is-the-**
revpos-value-used-for-in-**couchdb-attachments<http://stackoverflow.com/questions/1825117/what-is-the-revpos-value-used-for-in-couchdb-attachments>
Is there something I am missing or perhaps a configuration option I am not
setting properly?
Thanks.
--
Steven Ringo