[CDRIVER-1931] operation_id bugs in command monitoring callbacks Created: 19/Nov/16 Updated: 19/Jan/17 Resolved: 19/Jan/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.6.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Golden | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
In our current Application Performance Monitoring (APM) implementation, a series of commands could be monitored with the same operation_id. We must generate unique ids. Also, a series of commands related to the same mongoc_bulk_operation_t could have different ids, since we use the mongoc_cluster_t's operation_id instead of the mongoc_bulk_operation_t's. We should monitor all commands for one bulk operation with the same id, from the mongoc_bulk_operation_t. And finally, mongoc_bulk_operation_new creates a bulk op with operation_id of zero. The bug described above means we aren't using the mongoc_bulk_operation_t's operation_id, anyway, but we should fix that and also initialize the operation_id. Original report from David Golden:
|
| Comments |
| Comment by Githook User [ 19/Jan/17 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: Fix the Application Performance Monitoring implementation. A series of commands Also, a series of commands related to the same mongoc_bulk_operation_t could |
| Comment by A. Jesse Jiryu Davis [ 07/Jan/17 ] |
|
Good idea David, I'll do that. |
| Comment by David Golden [ 07/Jan/17 ] |
|
The C++ driver API allows users to construct bulk operations independent of any particular client/db/collection. The bulk operation is provided to the bulk_write collection method, which sets client/db/collection at that time and then executes the bulk. Therefore, it uses mongoc_bulk_operation_new. I wonder if mongoc_bulk_operation_set_client should also update the operation_id. |
| Comment by A. Jesse Jiryu Davis [ 07/Jan/17 ] |
|
mongoc_bulk_operation_new sets bypass_document_validation, ordered. server_id is set to 0. The other fields are set to reasonable defaults implicitly, since the whole struct is allocated and cleared by bson_malloc0. The other fields that must be set before executing the operation are database, collection, client, and commands. Those fields can be set by public functions like mongoc_bulk_operation_set_database and so on. test_bulk_new() checks that mongoc_bulk_operation_execute() fails with an error code if these fields aren't all set before you call it. The one field that seems buggy is operation_id. I suspect that if you monitor a bulk insert after calling mongoc_bulk_operation_new, all the operation id's will be zero. Out of curiosity: why use mongoc_bulk_operation_new instead of mongoc_collection_create_bulk_operation? |