You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Juuso Väänänen (JIRA)" <ji...@apache.org> on 2010/10/31 21:26:25 UTC

[jira] Created: (COUCHDB-930) Locally replicated compressed attachements have wrong disk_len

Locally replicated compressed attachements have wrong disk_len
--------------------------------------------------------------

                 Key: COUCHDB-930
                 URL: https://issues.apache.org/jira/browse/COUCHDB-930
             Project: CouchDB
          Issue Type: Bug
          Components: Replication
    Affects Versions: 1.0.1
         Environment: Ubuntu 10.04, Erlang R13B3, couchdb svn rev 1029390
Debian squeeze/sid, Erlang R14A2, couchdb 1.0.1
            Reporter: Juuso Väänänen
            Priority: Minor


When replicating document locally compressed attached file length is shown wrongly on replication target. Also Content-Length -header shows zero value when requesting replicated attachement.

Source:
{"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":1259,"stub":true,"encoding":"gzip","encoded_length":534}}}

Replicated:
{"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":534,"stub":true,"encoding":"gzip","encoded_length":534}}}


Steps to produce:
1. create databases a and b
2. create text-document with attachement on db a
3. start local replication a to b
4. request document's attachement on db b


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


[jira] Commented: (COUCHDB-930) Locally replicated compressed attachements have wrong disk_len

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927222#action_12927222 ] 

Filipe Manana commented on COUCHDB-930:
---------------------------------------

Hi Juuso,
Thanks for the patch.

This is not exactly a bug.
CouchDB accepts attachments already compressed (gzip). When it receives one, since it cannot guess what its uncompressed length is (doing uncompression just to find that out is very expensive) it sets both #att.disk_len and #att.att_len to the same value (compressed length).

For this particular case, local to local replication, we can probably just grab the source #att.disk_len and copy it to the destination #att.disk_len.

I'll try the patch by the end of the week.
Cheers

> Locally replicated compressed attachements have wrong disk_len
> --------------------------------------------------------------
>
>                 Key: COUCHDB-930
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-930
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 1.0.1
>         Environment: Ubuntu 10.04, Erlang R13B3, couchdb svn rev 1029390
> Debian squeeze/sid, Erlang R14A2, couchdb 1.0.1
>            Reporter: Juuso Väänänen
>            Priority: Minor
>         Attachments: fix-local-replication.patch
>
>
> When replicating document locally compressed attached file length is shown wrongly on replication target. Also Content-Length -header shows zero value when requesting replicated attachement.
> Source:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":1259,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Replicated:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":534,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Steps to produce:
> 1. create databases a and b
> 2. create text-document with attachement on db a
> 3. start local replication a to b
> 4. request document's attachement on db b

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


[jira] Updated: (COUCHDB-930) Locally replicated compressed attachements have wrong disk_len

Posted by "Juuso Väänänen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juuso Väänänen updated COUCHDB-930:
-----------------------------------

    Attachment: fix-local-replication.patch

Patch for adding test also for local replication and suggestion how to fix that. Compability with older releases not tested.

> Locally replicated compressed attachements have wrong disk_len
> --------------------------------------------------------------
>
>                 Key: COUCHDB-930
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-930
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 1.0.1
>         Environment: Ubuntu 10.04, Erlang R13B3, couchdb svn rev 1029390
> Debian squeeze/sid, Erlang R14A2, couchdb 1.0.1
>            Reporter: Juuso Väänänen
>            Priority: Minor
>         Attachments: fix-local-replication.patch
>
>
> When replicating document locally compressed attached file length is shown wrongly on replication target. Also Content-Length -header shows zero value when requesting replicated attachement.
> Source:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":1259,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Replicated:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":534,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Steps to produce:
> 1. create databases a and b
> 2. create text-document with attachement on db a
> 3. start local replication a to b
> 4. request document's attachement on db b

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


[jira] Closed: (COUCHDB-930) Locally replicated compressed attachements have wrong disk_len

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

Filipe Manana closed COUCHDB-930.
---------------------------------

    Resolution: Fixed

Applied in trunk revision 1032673.

I only added two minor changes:

- splitted one line in couch_db.erl into 2 lines in order to respect the maximum 80 characters line length convention;
- corrected a comment in the test case.

Thanks Juuso.

> Locally replicated compressed attachements have wrong disk_len
> --------------------------------------------------------------
>
>                 Key: COUCHDB-930
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-930
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 1.0.1
>         Environment: Ubuntu 10.04, Erlang R13B3, couchdb svn rev 1029390
> Debian squeeze/sid, Erlang R14A2, couchdb 1.0.1
>            Reporter: Juuso Väänänen
>            Assignee: Filipe Manana
>            Priority: Minor
>         Attachments: fix-local-replication.patch
>
>
> When replicating document locally compressed attached file length is shown wrongly on replication target. Also Content-Length -header shows zero value when requesting replicated attachement.
> Source:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":1259,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Replicated:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":534,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Steps to produce:
> 1. create databases a and b
> 2. create text-document with attachement on db a
> 3. start local replication a to b
> 4. request document's attachement on db b

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


[jira] Assigned: (COUCHDB-930) Locally replicated compressed attachements have wrong disk_len

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

Filipe Manana reassigned COUCHDB-930:
-------------------------------------

    Assignee: Filipe Manana

> Locally replicated compressed attachements have wrong disk_len
> --------------------------------------------------------------
>
>                 Key: COUCHDB-930
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-930
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 1.0.1
>         Environment: Ubuntu 10.04, Erlang R13B3, couchdb svn rev 1029390
> Debian squeeze/sid, Erlang R14A2, couchdb 1.0.1
>            Reporter: Juuso Väänänen
>            Assignee: Filipe Manana
>            Priority: Minor
>         Attachments: fix-local-replication.patch
>
>
> When replicating document locally compressed attached file length is shown wrongly on replication target. Also Content-Length -header shows zero value when requesting replicated attachement.
> Source:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":1259,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Replicated:
> {"_id":"c68f75e26cc62c81f0bab14441000141","_rev":"4-89b0b48063ae1f338321af8d6b4e2eeb","_attachments":{"md5.patch":{"content_type":"text/x-patch","revpos":2,"length":534,"stub":true,"encoding":"gzip","encoded_length":534}}}
> Steps to produce:
> 1. create databases a and b
> 2. create text-document with attachement on db a
> 3. start local replication a to b
> 4. request document's attachement on db b

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