Issue Details (XML | Word | Printable)

Key: LUCENE-957
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Doron Cohen
Reporter: Doron Cohen
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

Lucene RAM Directory doesn't work for Index Size > 8 GB

Created: 12/Jul/07 10:51 PM   Updated: 28/Jul/07 01:49 AM
Return to search
Component/s: Store
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works lucene-957.patch 2007-07-15 09:52 PM Doron Cohen 8 kB
Text File Licensed for inclusion in ASF works lucene-957.patch 2007-07-12 11:05 PM Doron Cohen 1 kB

Resolution Date: 19/Jul/07 04:51 PM


 Description  « Hide
from user list - http://www.gossamer-threads.com/lists/lucene/java-user/50982

Problem seems to be casting issues in RAMInputStream.

Line 90:
bufferStart = BUFFER_SIZE * currentBufferIndex;
both rhs are ints while lhs is long.
so a very large product would first overflow MAX_INT, become negative, and only then (auto) casted to long, but this is too late.

Line 91:
bufferLength = (int) (length - bufferStart);
both rhs are longs while lhs is int.
so the (int) cast result may turn negative and the logic that follows would be wrong.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Doron Cohen added a comment - 12/Jul/07 11:05 PM
Patch fixing int / long cast issues in RAMInputStream.

All tests pass but non of those actually demonstrates the bug being fixed. I don't currently have a large enough index to test this.

I will wait for a manual test by Murali (who reported this issue), and for at least one patch review.


Doron Cohen made changes - 12/Jul/07 11:05 PM
Field Original Value New Value
Attachment lucene-957.patch [ 12361725 ]
Doron Cohen added a comment - 15/Jul/07 09:52 PM
Previous patch apparently did not fix the bug - a casting problem in RAMOutputStream had to be fixed.
Updated patch adds a test imitating ramFile larger than maxint.
For this had to make the allocation of a new byte array in RAMFile overridable.
The new test fails before fixing RAMOutputStream (affecting RAMDirectory constructor from FS). However the issues in RAMInputStream in fact do not cause failures, yet they should be fixed.

With a test in place I now feel confident in this fix - will commit it in a day or two if there are no reservations.


Doron Cohen made changes - 15/Jul/07 09:52 PM
Attachment lucene-957.patch [ 12361860 ]
Repository Revision Date User Message
ASF #557678 Thu Jul 19 16:27:48 UTC 2007 doronc LUCENE-957: RAMDirectory fixed for more than Integer.MAX_VALUE bytes.
Files Changed
ADD /lucene/java/trunk/src/test/org/apache/lucene/store/TestHugeRamFile.java
MODIFY /lucene/java/trunk/src/java/org/apache/lucene/store/RAMFile.java
MODIFY /lucene/java/trunk/src/java/org/apache/lucene/store/RAMInputStream.java
MODIFY /lucene/java/trunk/CHANGES.txt
MODIFY /lucene/java/trunk/src/test/org/apache/lucene/store/MockRAMInputStream.java
MODIFY /lucene/java/trunk/src/java/org/apache/lucene/store/RAMOutputStream.java

Doron Cohen added a comment - 19/Jul/07 04:51 PM
committed.

Doron Cohen made changes - 19/Jul/07 04:51 PM
Lucene Fields [New]
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Murali Varadarajan added a comment - 28/Jul/07 01:49 AM
Doron Cohon,

Thanks a tonne. I tried your first patch and it didn't work. Today i saw your message and checked out the source from head and built it.
It worked !!!