[JAVA-383] cursor.count() is positive, but cursor.hasNext() returns false Created: 17/Jun/11 Updated: 25/Jun/13 Resolved: 24/Oct/11 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 2.5.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Joseph Wang | Assignee: | Antoine Girbal |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Resin app server on linux |
||
| Attachments: |
|
| Description |
|
From the logs, it seems to indicate that we get count of 8. However, cursor.hasNext() is false. Bad Good |
| Comments |
| Comment by Antoine Girbal [ 17/Jun/11 ] | ||||||||
|
Most likely it is not a java issue, but a race condition due to replication.
In terms of solution, either:
thx | ||||||||
| Comment by Knut Forkalsrud [ 17/Jun/11 ] | ||||||||
|
This process runs every 15 minutes, but there is new data only once per day. The error case happens very intermittently, once per month or two. The error must also be very transient. This only happens once within a few minutes of the collection's creation. When the process runs again 15 minutes later all the data is perfectly fine and everything completes normally. There are no updates or anything like that happening to the collection. It says the same after the initial insert. The query is rather straight forward (in the attached java file). One thing to be aware of is that the "isValid()" check on the FinancialIndex object depends only on the object itself. The constructor is
They all have a valid name and price, at least as soon as we run the query manually, or the second time it runs. Since we run with replica set and slave queries are OK it is possible that this could have something to do with replication. If somehow metadata about a collection are available before the data within the collection. |