You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Sven Helmberger (JIRA)" <ji...@apache.org> on 2009/01/21 09:44:59 UTC

[jira] Created: (COUCHDB-217) Store Revision of Attachments

Store Revision of Attachments
-----------------------------

                 Key: COUCHDB-217
                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
             Project: CouchDB
          Issue Type: Improvement
            Reporter: Sven Helmberger



I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
store all resources on a single document to keep the same relative hierarchical structure I have in my apps.

I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.

Wouldn't it be possible to store the revision in which the attachment was created with the attachment?

_attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 

I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (COUCHDB-217) Store Revision of Attachments

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis resolved COUCHDB-217.
---------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 0.10)
                   0.11
         Assignee: Paul Joseph Davis

Sven says that the new revpos variable associated with attachments is now a functional replacement for the intent of this ticket.

> Store Revision of Attachments
> -----------------------------
>
>                 Key: COUCHDB-217
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Sven Helmberger
>            Assignee: Paul Joseph Davis
>             Fix For: 0.11
>
>
> I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
> store all resources on a single document to keep the same relative hierarchical structure I have in my apps.
> I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.
> Wouldn't it be possible to store the revision in which the attachment was created with the attachment?
> _attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 
> I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-217) Store Revision of Attachments

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12673540#action_12673540 ] 

Chris Anderson commented on COUCHDB-217:
----------------------------------------

I think this ticket is doable, and I especially like the ability to provide per-attachment etags.

However, I think it will require a change to the database file format, so if this is going to happen it should happen for 0.9.

This would be a medium-difficult patch to pull off, so if someone has done some CouchDB internals work and wants to take it to the next level, this is a good opportunity.

You'll want to see couch_db:doc_flush_binaries/2 for one place the internal attachment metadata is manipulated. There are a few other spots in the source you'd have to touch as well. Just getting the rev onto the attachment metadata is step one. Once that's happened, using that rev as the etag will be easy.

> Store Revision of Attachments
> -----------------------------
>
>                 Key: COUCHDB-217
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Sven Helmberger
>
> I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
> store all resources on a single document to keep the same relative hierarchical structure I have in my apps.
> I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.
> Wouldn't it be possible to store the revision in which the attachment was created with the attachment?
> _attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 
> I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-217) Store Revision of Attachments

Posted by "Sven Helmberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666860#action_12666860 ] 

Sven Helmberger commented on COUCHDB-217:
-----------------------------------------

ok, that's unfortunate.. 

How about not using the document rev but creating a new uuid value just for the new attachment and storing that?

I could still use the UUID to find out that the attachment has changed and you could still use that UUID as Etag.

> Store Revision of Attachments
> -----------------------------
>
>                 Key: COUCHDB-217
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Sven Helmberger
>
> I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
> store all resources on a single document to keep the same relative hierarchical structure I have in my apps.
> I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.
> Wouldn't it be possible to store the revision in which the attachment was created with the attachment?
> _attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 
> I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-217) Store Revision of Attachments

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Anderson updated COUCHDB-217:
-----------------------------------

    Fix Version/s: 0.10

> Store Revision of Attachments
> -----------------------------
>
>                 Key: COUCHDB-217
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Sven Helmberger
>             Fix For: 0.10
>
>
> I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
> store all resources on a single document to keep the same relative hierarchical structure I have in my apps.
> I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.
> Wouldn't it be possible to store the revision in which the attachment was created with the attachment?
> _attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 
> I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-217) Store Revision of Attachments

Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665778#action_12665778 ] 

Jan Lehnardt commented on COUCHDB-217:
--------------------------------------

A cursory glance at the code reveals the issue: Before writing the document that we attach the attachment (heh) to, we don't know the revision id of the to-be written document to put into the attachment structure. When we return from writing the document, we know the revision id, but our attachment has been written already and we would need to change it again to put in the new revision id and that would bump the revision id again.

It might be doable a layer further down, but I don't wont to mess with the core document writing stuff here now :)

For anyone willing to look into this at couch_db:update_docs/4.


> Store Revision of Attachments
> -----------------------------
>
>                 Key: COUCHDB-217
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-217
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Sven Helmberger
>
> I'm writing some multi-app hosting thing and besides using couchdb as database it also stores all images and stylesheets and scripts etc for the applications as attachments. I have one couchdb database per app and
> store all resources on a single document to keep the same relative hierarchical structure I have in my apps.
> I can now fetch that document and use it to quickly find out the name, lenght and content-type of all my attachments. When the document revision changes I know that at least one of the attachments has changed, but I don't know which.
> Wouldn't it be possible to store the revision in which the attachment was created with the attachment?
> _attachments could then contain these revisions as additional property and couchdb could use that revision as ETag when serving the attachment content which would be better than using the documents revision like it is now. 
> I don't know the code, so I don't know wheter this is possible..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.