Description
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:
(long) ((double) count / keyCount) + size;
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.