[JAVA-1255] Add DBCursor.tryNext() method for tailable cursors Created: 22/May/14 Updated: 25/Aug/17 Resolved: 15/Sep/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Query Operations |
| Affects Version/s: | 2.12.0 |
| Fix Version/s: | 2.13.0, 3.0.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Ross Lawley |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
In 2.12, the Java driver started setting the AwaitData cursor flag any time the Tailable flag was set. As part of this change, the driver stopped violating the Iterator contractor for cursors. Whereas in previous versions of the driver, an Iterator for a cursor with Tailable but not AwaitData could return false from Iterator.hasNext(), and then some time later return true. In 2.12, by contrast, Iterator.hasNext() for a Tailable cursor blocks until there is a result available or until the cursor has been closed. But this change breaks existing clients that were relying on the driver's breaking of the Iterator contract, so the change should be reverted. The driver should allow Tailable without AwaitData, and Iterator.hasNext() for such a cursor will return false but not close the cursor, allowing hasNext() to be called again at a later time. Long term, the driver should offer a different API for tailable cursors (perhaps one without a hasNext() method), but this is a short term measure until we get there. UPDATE:: DBCursor now has a tryNext method which may return null if no documents are available, and then return a document on a subsequent call. |
| Comments |
| Comment by Githook User [ 30/Jan/15 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Fix DBCursor#tryNext support for curr() and numSeen() Missed in |
| Comment by Githook User [ 30/Jan/15 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Ensure next() and hasNext() behaviour doesn't change
|
| Comment by Githook User [ 30/Jan/15 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Added tryNext() for tailable cursors
|
| Comment by Jeffrey Yemin [ 29/Jan/15 ] |
|
2.13.0 has been released. Closing issue. |
| Comment by Githook User [ 07/Oct/14 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Fix DBCursor#tryNext support for curr() and numSeen() Missed in |
| Comment by Githook User [ 08/Sep/14 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Ensure next() and hasNext() behaviour doesn't change
|
| Comment by Githook User [ 05/Sep/14 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Ensure next() and hasNext() behaviour doesn't change
|
| Comment by Githook User [ 05/Sep/14 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Added tryNext() for tailable cursors
|
| Comment by Githook User [ 05/Sep/14 ] |
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Added tryNext() for tailable cursors
|