You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Nuutti Kotivuori (JIRA)" <ji...@apache.org> on 2010/09/14 03:06:34 UTC

[jira] Created: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

_log handler has very odd semantics for bytes/offset, probably a bug
--------------------------------------------------------------------

                 Key: COUCHDB-887
                 URL: https://issues.apache.org/jira/browse/COUCHDB-887
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 1.0.1, 1.0, 0.11.2, 0.11.1, 0.11
            Reporter: Nuutti Kotivuori
            Priority: Trivial


The _log method for couchdb servers has query arguments "bytes" and "offset", but they seem to behave really weirdly. If offset >= bytes, an eof error is returned - otherwise offset is just substracted from bytes and the request behaves identically otherwise.

A simple fix to the expected behaviour is included - offset counts backwards from bytes.

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


[jira] Commented: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909083#action_12909083 ] 

Randall Leeds commented on COUCHDB-887:
---------------------------------------

Your patch reverses the semantics of offset, but it's not clear that one is more right.

If your intuition about offet being a negative from the end is right, then I'd expect:

Start = lists:max([LogFileSize - Offset])

where Bytes determines how many bytes to read, but has no effect on where reading begins.

However, in either case I think you're right that Bytes should be passed to file:pread/3 instead of LogFileSize.

> _log handler has very odd semantics for bytes/offset, probably a bug
> --------------------------------------------------------------------
>
>                 Key: COUCHDB-887
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-887
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.11, 0.11.1, 0.11.2, 1.0, 1.0.1
>            Reporter: Nuutti Kotivuori
>            Priority: Trivial
>         Attachments: couch_log.erl.diff
>
>
> The _log method for couchdb servers has query arguments "bytes" and "offset", but they seem to behave really weirdly. If offset >= bytes, an eof error is returned - otherwise offset is just substracted from bytes and the request behaves identically otherwise.
> A simple fix to the expected behaviour is included - offset counts backwards from bytes.

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


[jira] Updated: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

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

Paul Joseph Davis updated COUCHDB-887:
--------------------------------------

    Skill Level: New Contributors Level (Easy)

> _log handler has very odd semantics for bytes/offset, probably a bug
> --------------------------------------------------------------------
>
>                 Key: COUCHDB-887
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-887
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.11, 0.11.1, 0.11.2, 1.0, 1.0.1
>            Reporter: Nuutti Kotivuori
>            Priority: Trivial
>         Attachments: couch_log.erl.diff
>
>
> The _log method for couchdb servers has query arguments "bytes" and "offset", but they seem to behave really weirdly. If offset >= bytes, an eof error is returned - otherwise offset is just substracted from bytes and the request behaves identically otherwise.
> A simple fix to the expected behaviour is included - offset counts backwards from bytes.

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


[jira] Updated: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

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

Nuutti Kotivuori updated COUCHDB-887:
-------------------------------------

    Attachment: couch_log.erl.diff

Patch to fix behavior to be possibly as expected.

> _log handler has very odd semantics for bytes/offset, probably a bug
> --------------------------------------------------------------------
>
>                 Key: COUCHDB-887
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-887
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.11, 0.11.1, 0.11.2, 1.0, 1.0.1
>            Reporter: Nuutti Kotivuori
>            Priority: Trivial
>         Attachments: couch_log.erl.diff
>
>
> The _log method for couchdb servers has query arguments "bytes" and "offset", but they seem to behave really weirdly. If offset >= bytes, an eof error is returned - otherwise offset is just substracted from bytes and the request behaves identically otherwise.
> A simple fix to the expected behaviour is included - offset counts backwards from bytes.

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


[jira] Commented: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

Posted by "Nuutti Kotivuori (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909103#action_12909103 ] 

Nuutti Kotivuori commented on COUCHDB-887:
------------------------------------------

The *current* semantics of offset are such, that there is really no point in specifying it, ever, as one can just supply a smaller bytes value to get the same effect.

If offset is simply substracted from LogFileSize, then offset *must* atleast default to bytes, or otherwise the result is always eof.

> _log handler has very odd semantics for bytes/offset, probably a bug
> --------------------------------------------------------------------
>
>                 Key: COUCHDB-887
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-887
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.11, 0.11.1, 0.11.2, 1.0, 1.0.1
>            Reporter: Nuutti Kotivuori
>            Priority: Trivial
>         Attachments: couch_log.erl.diff
>
>
> The _log method for couchdb servers has query arguments "bytes" and "offset", but they seem to behave really weirdly. If offset >= bytes, an eof error is returned - otherwise offset is just substracted from bytes and the request behaves identically otherwise.
> A simple fix to the expected behaviour is included - offset counts backwards from bytes.

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