[CDRIVER-66] Tailable cursors not supported correctly Created: 22/Apr/11 Updated: 19/Oct/16 Resolved: 11/Jul/11 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.3 |
| Fix Version/s: | 0.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Steve Green | Assignee: | Kyle Banker |
| Resolution: | Done | Votes: | 0 |
| Labels: | query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows Server 2008 R2, Mongo v1.6.5 64 bit |
||
| Attachments: |
|
| Description |
|
When the data currently in the cursor is exhausted, the mongo_cursor_next routine will call the 'private' mongo_cursor_get_more routine to see if there is any additional data. If not, mongo_cursor_next returns 0. At this point, the cursor never has a chance to get any more data (without a requery) because this code in mongo_cursor_next prevents another call to mongo_cursor_get_more. /* no data */ I found that if I make the mongo_cursor_get_more routine 'public', i.e., put it in mongo.h, and then add this code if ( mongo_cursor_get_more( m_pCursor ) ) prior to calling mongo_query_next, I get the desired results. This seems like a pretty vulgar hack to me... If there was a way to tell that a cursor was 'tailable' from the cursor structure, the above logic could be worked into the mongo_cursor_next routine. |
| Comments |
| Comment by auto [ 11/Jul/11 ] |
|
Author: {u'login': u'banker', u'name': u'Kyle Banker', u'email': u'kylebanker@gmail.com'}Message: |
| Comment by auto [ 11/Jul/11 ] |
|
Author: {u'login': u'banker', u'name': u'Kyle Banker', u'email': u'kylebanker@gmail.com'}Message: |
| Comment by auto [ 08/Jul/11 ] |
|
Author: {u'login': u'banker', u'name': u'Kyle Banker', u'email': u'kylebanker@gmail.com'}Message: |
| Comment by Kyle Banker [ 27/Apr/11 ] |
|
Thanks for the patches. Will apply soon. Kyle |
| Comment by Steve Green [ 27/Apr/11 ] |
|
There was a bug in the previous version of mongo.c in the mongo_cursor_next routine. This version of the file fixes that bug. |
| Comment by Steve Green [ 25/Apr/11 ] |
|
I've made a patch to address this issue, although I'm not sure that it is the most desirable way to solve the problem. In short, I've added an options field to the mongo_cursor struct that stores the options that were passed to mongo_find. These flags are then used when determining the proper action in the mongo_cursor_next routine. I've attached new versions of mongo.h and mongo.c |