lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3738) Be consistent about negative vInt/vLong
Date Fri, 16 Mar 2012 18:11:40 GMT


Michael McCandless commented on LUCENE-3738:

bq. If we disallow, it should be a hard check (no assert), as the data is coming from a file
(and somebody could used a hex editor). The reader will crash later...

Hmm, I don't think we should do that.

If you go and edit your index with a hex editor... there are no guarantees on what may ensue!

bq. Mike: If you fix the unrolled loops, please also add the checks to the other implementations
in Buffered* and so on. 

I don't think the unrolled loops or other impls of write/readVLong are wrong?  The javadocs
state clearly that negatives are not supported.  All we're doing here is added an assert to
backup that javadoc statement.

> Be consistent about negative vInt/vLong
> ---------------------------------------
>                 Key: LUCENE-3738
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3738.patch, LUCENE-3738.patch, LUCENE-3738.patch
> Today, write/readVInt "allows" a negative int, in that it will encode and decode correctly,
just horribly inefficiently (5 bytes).
> However, read/writeVLong fails (trips an assert).
> I'd prefer that both vInt/vLong trip an assert if you ever try to write a negative number...
it's badly trappy today.  But, unfortunately, we sometimes rely on this... had we had this
assert in 'since the beginning' we could have avoided that.
> So, if we can't add that assert in today, I think we should at least fix readVLong to
handle negative longs... but then you quietly spend 9 bytes (even more trappy!).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message