[ https://issues.apache.org/jira/browse/OAK-6391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16072112#comment-16072112 ]
Chetan Mehrotra commented on OAK-6391: -------------------------------------- [~tmueller] Just curious here ... what was the root cause and its relation to 20 > With FastQuerySize, getSize() returns -1 if there are exactly 21 rows > --------------------------------------------------------------------- > > Key: OAK-6391 > URL: https://issues.apache.org/jira/browse/OAK-6391 > Project: Jackrabbit Oak > Issue Type: Bug > Components: query > Reporter: Thomas Mueller > Assignee: Thomas Mueller > Priority: Critical > Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4, > candidate_oak_1_6 > Fix For: 1.8, 1.7.3, 1.6.3 > > > If FastQuerySize is enabled, and the query result has exactly 21 rows, then > getSize() returns -1. With 20 or 22 rows, the correct value is returned. > Comment: > One can not assume getSize() _always_ returns a value larger than 0. > Sometimes, getSize() returns too many, it could also return too few; it is > just an estimate. The loop used to read the rows should _only_ have > "it.hasNext() && i < maxCount" as a condition. With maxCount for example 30. > If the number of rows read is smaller than 30, then that's the real row > count. If it's 30, then you can use getSize() as an estimation. That can > still be -1 for "unknown", even with FastQuerySize enabled. > But it's true that -1 is unexpected in this case. -- This message was sent by Atlassian JIRA (v6.4.14#64029)