You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2014/12/03 09:00:22 UTC

[jira] [Commented] (OAK-2315) Index cost is sometimes negative

    [ https://issues.apache.org/jira/browse/OAK-2315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14232736#comment-14232736 ] 

Thomas Mueller commented on OAK-2315:
-------------------------------------

It looks like this is not a big problem, as a negative cost just logs an error. For the given case, a low cost is actually OK (the right index is used). But it is unexpected, and should be fixed.

> Index cost is sometimes negative
> --------------------------------
>
>                 Key: OAK-2315
>                 URL: https://issues.apache.org/jira/browse/OAK-2315
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 1.0.9, 1.2, 1.1.3
>
>
> The property index can return a negative cost in the following case:
> * It is a non-unique index (the default)
> * The "entryCount" is set to lower than 10000
> * The "keyCount" property is not set, or set to 0
> * The index matches
> In this case, the following formula is used and returns a negative value:
> {noformat}
> (long) ((double) count / keyCount) + size;
> {noformat}
> Count is for example 500, keyCount is 0. The division evaluates to infinity, which is converted to Long.MAX_VALUE. Size is larger than 0, so there is an overflow to negative.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)