[JAVA-1091] Always set awaitData along with tailable Created: 23/Jan/14  Updated: 25/Aug/17  Resolved: 31/Jan/14

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: None
Fix Version/s: 2.12.0, 3.0.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to JAVA-1255 Add DBCursor.tryNext() method for tai... Closed
is related to JAVA-605 NullPointerException on DBCursor.hasN... Closed

 Description   

DBCursor#addOption allows a user to set the option Bytes.QUERYOPTION_TAILABLE. There are no circumstances where a user would not want to also set Bytes.QUERYOPTION_AWAITDATA, so if the former is set, the latter will now also be set.

As part of this change, there will be a behavioral change to DBCursor#hasNext(). It used to be that if tailable was set but not awaitData, hasNext() could return false on one invocation, followed by true on the next. This really violates the contract of Iterator, so the driver will no longer allow it. DBCursor#hasNext will now block until either a new document is available or the cursor is no longer valid.



 Comments   
Comment by Githook User [ 31/Jan/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1091: Always set awaitData if tailable is set, and ensure that hasNext() blocks until either there is another available document or the cursor is no longer valid
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/44c5661c454eeef6423f5d3092c464f83746b4e3

Comment by Githook User [ 30/Jan/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1091: Always set awaitData if tailable is set, and ensure that hasNext() blocks until either there is another available document or the cursor is no longer valid.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/88b464093a1acda85b6b74703df8f58d9f7c40da

Generated at Thu Feb 08 08:53:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.