[CDRIVER-3051] Using multi flag with mongoc_collection_update fails if retryWrites=true Created: 29/Mar/19  Updated: 28/Oct/23  Resolved: 03/Apr/19

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.10.0
Fix Version/s: 1.15.0

Type: Bug Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Jeremy Mikola
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CDRIVER-2961 Support Retryable Writes on by Default Closed
Related
related to CDRIVER-2840 Delete Many and Update Many fail with... Closed
is related to CDRIVER-3053 mongoc_collection_remove and delete a... Closed
is related to CDRIVER-3052 Documentation examples should not use... Closed

 Description   

When the MONGOC_UPDATE_MULTI_UPDATE update flag is used with mongoc_collection_update(), it fails to set the has_multi_write flag on the constructed mongoc_write_command_t. This causes _mongoc_write_opmsg() to set allow_txn_number to "yes" and the server returns a command error for including a txnNumber field in a multi-write.

This bug was only caught by test_example_53() in test-mongoc-sample-commands.c (documentation examples), so I think we should also add a proper test in test-mongoc-collection.c.



 Comments   
Comment by Githook User [ 03/Apr/19 ]

Author:

{'name': 'Jeremy Mikola', 'username': 'jmikola', 'email': 'jmikola@gmail.com'}

Message: CDRIVER-3051 set has_multi_write in mongoc_collection_update

If has_multi_write is not set, a 3.6+ server will return an error when
a multi-update is sent while retryWrites is enabled.

This also adds new tests for the UPSERT and MULTI_UPDATE flags.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e283dc9debc60742bf3ffc10ff8c5d9bcb3fc93d

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