[CDRIVER-1054] Support negative cursor limit for single-batch OP_QUERY and find command results Created: 14/Dec/15 Updated: 02/Feb/16 Resolved: 27/Jan/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.3.0 |
| Fix Version/s: | 1.3.2 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeremy Mikola | Assignee: | Jeremy Mikola |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Currently, there is no way for an extending driver to request single-batch result sets in a universal manner suitable for OP_QUERY and the find command. In the case of OP_QUERY, _mongoc_n_return() has an assertion as of 1.3.0 that fails for negative limits. For the find command, there is no way to express singleBatch without using a 3.2+ find command document (I may be overlooking some hacky solution to abuse how query modifiers are merged into the command document). Changing the private cursor struct to have a signed limit would allow drivers extending libmongoc to pass a negative limit and request that the query return a single batch of results and leave no cursor open on the server. For legacy OP_QUERY operations, this negative limit would be passed as-is (the wire protocol already specifies a signed 32-bit integer for limit). For the find command, a negative limit would be made positive and the singleBatch command option set to true. Changes would entail revising the assertion in _mongoc_n_return() to operate on the absolute value of the limit, as well as changing the internal struct's field to a signed integer. Note: the related issue, CDRIVER-1053, refers to changing the public API of mongoc_collection_find() to receive a signed limit. |
| Comments |
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge remote-tracking branch 'upstream/r1.3'
|
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #310 from jmikola/cdriver-1054
|
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'jmikola', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'}Message: This adds internal support for specifying a negative cursor limit (i.e. single-batch mode) for both OP_QUERY and find command code paths. Note that this does not change the public API, which will be handled for 2.0 by CDRIVER-1053. |
| Comment by A. Jesse Jiryu Davis [ 27/Jan/16 ] |
|
Let's not close this until it's merged to master too. |
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #310 from jmikola/cdriver-1054
|
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'jmikola', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'}Message: This adds internal support for specifying a negative cursor limit (i.e. single-batch mode) for both OP_QUERY and find command code paths. Note that this does not change the public API, which will be handled for 2.0 by CDRIVER-1053. |
| Comment by Jeremy Mikola [ 26/Jan/16 ] |