Issue Details (XML | Word | Printable)

Key: LUCENE-1519
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael McCandless
Reporter: Deepak
Votes: 0
Watchers: 0
Operations

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

Change Primitive Data Types from int to long in class SegmentMerger.java

Created: 14/Jan/09 05:16 AM   Updated: 25/Sep/09 04:23 PM
Return to search
Component/s: None
Affects Version/s: 2.4
Fix Version/s: 2.4.1, 2.9

Time Tracking:
Original Estimate: 4h
Original Estimate - 4h
Remaining Estimate: 4h
Remaining Estimate - 4h
Time Spent: Not Specified
Remaining Estimate - 4h

Environment: lucene 2.4.0, jdk1.6.0_03/07/11
Issue Links:
Reference
 

Lucene Fields: New
Resolution Date: 19/Feb/09 10:07 AM


 Description  « Hide
Hi

We are getting an exception while optimize. We are getting this exception "mergeFields produced an invalid result: docCount is 385282378 but fdx file size is 3082259028; now aborting this merge to prevent index corruption"

I have checked the code for class SegmentMerger.java and found this check

***********************************************************************************************************************************************************************
if (4+docCount*8 != fdxFileLength)
// This is most likely a bug in Sun JRE 1.6.0_04/_05;
// we detect that the bug has struck, here, and
// throw an exception to prevent the corruption from
// entering the index. See LUCENE-1282 for
// details.
throw new RuntimeException("mergeFields produced an invalid result: docCount is " + docCount + " but fdx file size is " + fdxFileLength + "; now aborting this merge to prevent index corruption");
}
***********************************************************************************************************************************************************************

In our case docCount is 385282378 and fdxFileLength size is 3082259028, even though 4+385282378*8 is equal to 3082259028, the above code will not work because number 3082259028 is out of int range. So type of variable docCount needs to be changed to long

I have written a small test for this

************************************************************************************************************************************************************************

public class SegmentMergerTest {
public static void main(String[] args) {
int docCount = 385282378;
long fdxFileLength = 3082259028L;
if(4+docCount*8 != fdxFileLength)
System.out.println("No Match" + (4+docCount*8));
else
System.out.println("Match" + (4+docCount*8));
}
}

************************************************************************************************************************************************************************

Above test will print No Match but if you change the data type of docCount to long, it will print Match

Can you please advise us if this issue will be fixed in next release?

Regards
Deepak



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael McCandless made changes - 14/Jan/09 09:58 AM
Field Original Value New Value
Assignee Michael McCandless [ mikemccand ]
Michael McCandless made changes - 14/Jan/09 03:12 PM
Resolution Fixed [ 1 ]
Fix Version/s 2.9 [ 12312682 ]
Status Open [ 1 ] Resolved [ 5 ]
Shon Vella made changes - 16/Jan/09 03:29 PM
Link This issue relates to LUCENE-1521 [ LUCENE-1521 ]
Deepak made changes - 20/Jan/09 01:23 AM
Status Resolved [ 5 ] Closed [ 6 ]
Michael McCandless made changes - 18/Feb/09 08:05 PM
Fix Version/s 2.4.1 [ 12313516 ]
Michael McCandless made changes - 19/Feb/09 01:37 AM
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Michael McCandless made changes - 19/Feb/09 10:07 AM
Resolution Fixed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Mark Miller made changes - 25/Sep/09 04:23 PM
Status Resolved [ 5 ] Closed [ 6 ]