lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (LUCENENET-282) Handle potential overflow in LogByteSizeMergePolicy.SetMaxMergeMB
Date Sun, 25 Jan 2015 01:57:35 GMT


ASF GitHub Bot commented on LUCENENET-282:

GitHub user laimis opened a pull request:

    Fix overflow resulting in negative values

    Noticed while debugging failing Lucene42/45 codec tests that sometimes when a test ran
ForceMerge(1) on an index writer, the merge of segments did not occur and the directory contained
whatever the number of segments existed before the merge. The tests then proceeded to fail
as they expected only one segment to be in the index.
    The issue is LogByteSizeMergePolicy. It does not occur all the time in the tests as its
selection is random (
LogByteSizeMergePolicy policy in constructor sets the max size of the segment for forced merges.
The value always ends up being too large for the long type and gets overflown, ie set to a
negative value. This then caused LogMergePolicy to inappropriately mark small segments as
too large at this logic branch:
    I double checked that Java does indeed behave by not setting the value to a negative number
and instead setting it to long.MaxValue. Looks like the previous port developers dealt with
this before as well :) 
    Note that this does not fix all of the tests that use ForceMerges, most of them continue
to fail due to another bug, but the fix for that is coming up in a separate PR.

You can merge this pull request into a Git repository by running:

    $ git pull LogByteSizeMergePolicy_fixes

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #58
commit 593231b3b39cb81dfcd29ea81cf98dc1ba9a026a
Author: Laimonas Simutis <>
Date:   2015-01-25T01:22:04Z

    fix overflow resulting in negative values


> Handle potential overflow in LogByteSizeMergePolicy.SetMaxMergeMB
> -----------------------------------------------------------------
>                 Key: LUCENENET-282
>                 URL:
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Michael Garski
>         Attachments: LUCENENET-282.patch
> Java gracefully overflows to long.maxValue, .NET to Int64.MinValue.  

This message was sent by Atlassian JIRA

View raw message