[CDRIVER-2284] Invalidate generated BSON instead of freezing read and write concerns Created: 14/Sep/17 Updated: 28/Oct/23 Resolved: 23/Nov/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.7.0 |
| Fix Version/s: | 1.9.0 |
| Type: | Improvement | 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: |
|
||||||||||||||||
| Description |
|
Currently, read concern and write concern objects are frozen at the first time that _mongoc_read_concern_get_bson() and _mongoc_write_concern_get_bson() are called, respectively. Once frozen, the objects can no longer be modified via the public API (setter functions will fail). This effectively caches the generated BSON internally. Because freezing converts a mutable struct into an immutable value, libmongoc needs to copy user-supplied structs before attempting to convert them to BSON (see: WRITE_CONCERN_DOC()); however, there are still outstanding cases with collection-level write functions where we do not make copies and may inadvertently freeze the user's struct (as noted in Consider removing the frozen state on these objects and instead have setter functions simply invalidate any previously generated BSON. Such a change would also let us remove the WRITE_CONCERN_DOC() macro and resolve |
| Comments |
| Comment by Githook User [ 23/Nov/17 ] |
|
Author: {'name': 'Jeremy Mikola', 'username': 'jmikola', 'email': 'jmikola@gmail.com'}Message: _mongoc_write_concern_new_from_iter must validate wtimeout before it |
| Comment by Githook User [ 23/Nov/17 ] |
|
Author: {'name': 'Jeremy Mikola', 'username': 'jmikola', 'email': 'jmikola@gmail.com'}Message: _mongoc_write_concern_get_bson() will no longer leave the write concern |
| Comment by Githook User [ 23/Nov/17 ] |
|
Author: {'name': 'Jeremy Mikola', 'username': 'jmikola', 'email': 'jmikola@gmail.com'}Message: Previously, converting a read or write concern to BSON would freeze the This also changes _mongoc_write_concern_new_from_iter() to use existing |