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 08:50:12 UTC

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

Thomas Mueller created OAK-2315:
-----------------------------------

             Summary: 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)