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

2011-10-31 Thread Nuutti Kotivuori (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13139993#comment-13139993
 ] 

Nuutti Kotivuori commented on COUCHDB-887:
--

Even your explanation is not really exact. What it does is (abstractly):
- start reading from the end
- seek `bytes` backwards from the end
- seek `offset` bytes forward into the file
- read until a maximum of `bytes` bytes is returned
- stop

The result is that:
- bytes=1offset=1000 - returns last 9000 bytes of log file
- bytes=9000 - returns last 9000 bytes of log file

Like I said in the bug report, the results are 100% equivalent of just doing 
'bytes - offset' on the clientside before making the request, except for the 
case of 'offset = bytes', in which case EOF is returned because of the attempt 
to read past file end.

In general, I'm having trouble figuring out what the original motivation behind 
offset is... I mean, *if* it would seek backwards, you could theoretically get 
the last 100kB of log in 1kB chunks by doing repeated queries with bytes=1024 
and incrementing offset by 1024 each time - but in practice the log file grows 
between each request, so there'll be lots of repeated lines and such.

 _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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2011-10-31 Thread Nuutti Kotivuori (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13140013#comment-13140013
 ] 

Nuutti Kotivuori commented on COUCHDB-887:
--

Sorry, I'm having a hard time finding the commit anywhere. I'd like to check if 
the new logic sounds reasonable to me too :-)

 _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
 Fix For: 1.2, 1.3

 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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2011-10-31 Thread Jan Lehnardt (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13140014#comment-13140014
 ] 

Jan Lehnardt commented on COUCHDB-887:
--

http://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=blobdiff;f=src/couchdb/couch_log.erl;h=1b05f4db64084ac405dd9e75b6d7bdc18e9fcda2;hp=0befe7aabfc79dc1047d044b1e002a3368789e68;hb=ad700014;hpb=7809f3ca844da984ebf1a90deefa2b4ab83d289e

 _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
 Fix For: 1.2, 1.3

 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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2011-10-31 Thread Nuutti Kotivuori (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13140025#comment-13140025
 ] 

Nuutti Kotivuori commented on COUCHDB-887:
--

Okay thanks, looks good. The repeated line issue is still present, but that is 
an entirely separate issue.

 _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
 Fix For: 1.2, 1.3

 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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2011-10-31 Thread Jan Lehnardt (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13140029#comment-13140029
 ] 

Jan Lehnardt commented on COUCHDB-887:
--

Yeah, I decided that that's not worth fixing. The motivation is a poor-man's 
tail -f over HTTP and I think we have that now :)

 _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
 Fix For: 1.2, 1.3

 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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2010-09-13 Thread Randall Leeds (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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] Commented: (COUCHDB-887) _log handler has very odd semantics for bytes/offset, probably a bug

2010-09-13 Thread Nuutti Kotivuori (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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.