[SERVER-51846] IDL parser should create owned copy of BSONObj subobjects Created: 27/Oct/20 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | IDL |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Saltz (Inactive) | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | sa-remove-fv-backlog-22 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Service Arch
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
In IDL with a field of type object, when parsing that field, the 'BSONElement::Obj()' function is used, but this only saves a non-owned reference. This should instead call '.getOwned()'on the result of 'Obj()'. |
| Comments |
| Comment by Mark Benvenuto [ 28/Oct/20 ] |
|
We do have object_owned. If we do make object_owned the default, then all the IDL generated classes that read from the network will have to do a deep copy of the BSONObj which will be a perf hit. I am not sure if it is measurable though. If you want to change object to be owned by default and make the existing object to be object_unowned, you should change all the existing IDL files in that case to be use the unowned type. I am most worried about write_ops.idl since that is the core DML of the server. |
| Comment by Matthew Saltz (Inactive) [ 28/Oct/20 ] |
|
daniel.gottlieb Pointed out we already have an object_owned type. Maybe this ticket could make that the default instead? |
| Comment by Matthew Saltz (Inactive) [ 27/Oct/20 ] |
|
I think it's a one line fix here. |