[CDRIVER-1215] Eliminate copy of command reply document Created: 29/Apr/16  Updated: 10/Aug/16  Resolved: 24/May/16

Status: Closed
Project: C Driver
Component/s: libmongoc, Performance
Affects Version/s: 1.3.0
Fix Version/s: 1.4.0

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-1212 C Driver Performance Benchmarking Closed

 Description   

mongoc_client_command_simple takes a pointer to a bson_t, into which it must copy the command reply. In the past, users who wanted to avoid the copy could use mongoc_client_command instead. (It returns a cursor which holds the original RPC, avoiding the copy.)

But the new find / getMore commands required me to separate commands from cursors (CDRIVER-906) and send all "find" commands through the cursor-less command path, which copies the reply. (See _mongoc_cursor_find_command.)

Eliminate the copy:

1. Add uint8_t *bson_reserve_buffer(bson_t, size_t).
2. Use bson_reserve_buffer to preallocate the reply's internal buffer as soon as we know the reply's size.
3. Receive the server response directly into the reply buffer.



 Comments   
Comment by Githook User [ 24/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1215 unused-function warnings
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ac57f48a0a266138bf5c3ef74e805fcd87d0b68f

Comment by Githook User [ 24/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1215 overflow warning in test
Branch: master
https://github.com/mongodb/libbson/commit/dabddecca853f7ff2729ef4554d1ff0ded5b8ae0

Comment by Githook User [ 24/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1215 distribute op-reply-header.def
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2a7e528694572c43e18238f7aa80172f86201d41

Comment by Githook User [ 24/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1215 don't copy command reply
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/11555f94d2892efd149da22994e097a90b758032

Comment by Githook User [ 24/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1215 implement bson_reserve_buffer
Branch: master
https://github.com/mongodb/libbson/commit/4efe8e266b6a711125d3ca152e0502811a69be0c

Generated at Wed Feb 07 21:11:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.