[SERVER-65880] BufBuilder shouldn't be used to serialize data that isn't BSON Created: 21/Apr/22 Updated: 30/Jan/24 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | quick-tech-debt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query Execution
|
||||||||
| Sprint: | QE 2023-05-15, QE 2023-05-29, QE 2023-06-12, QE 2023-06-26, QE 2023-07-10, QE 2023-07-24, QE 2023-08-07, QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02, QE 2023-10-16, QE 2023-10-30 | ||||||||
| Participants: | |||||||||
| Description |
|
BufBuilder is hard-coded to write numbers in little endian, which is appropriate for BSON but might not be expected in other scenarios. Currently, we do use BufBuilder for serialization during spilling (and possibly in some other cases) and must explicitly specify LittleEndian as the format when deserializing with BufReader. The recommendation from Andrew Morrow is to use DataBuillder to serialize. This way, when write/read isn't qualified with endianness, the plalform's endianness is used, and if need to persist or transmit the data, the endianness has to be explicitly specified on both writer and reader avoiding bugs such as BF-24912 |
| Comments |
| Comment by Colin Stolley [ 02/Nov/23 ] |
|
This is probably mischaracterized as a quick win, given that the changes required would touch code throughout the code base and could introduce bugs. Databuilder is not mere a drop-in replacement for BufBuilder, though I had put some thought into making that possible. |
| Comment by Irina Yatsenko (Inactive) [ 03/May/22 ] |
|
This is a technical debt. We are using a bug-prone pattern for serialize/deserialize. For example, it caused BF-24912 |