[SERVER-23718] Stop storing NUL terminators in Document and Value Created: 14/Apr/16  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework, Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Participants:

 Description   

We currently store NUL bytes at the end of the keys in a Document and anything that uses string-like storage in Value, even though in both cases we also store explicit lengths both for efficency and in the case of Value to correctly handle embedded NUL bytes in the middle of the string. This dates to a brief period when StringData required that str[size] was valid and pointed to a NUL byte. Since this is no longer the case, we should stop storing them. This will allow storing longer strings (up to 14 bytes from 13) inline in Value, and should reduce the size of Documents by reducing the probability that we need to skip bytes so the next Value will be properly aligned.



 Comments   
Comment by Mathias Stearn [ 14/Apr/16 ]

FYI, I think the only thing that depends on the NUL terminator is Value::getRegexFlags().

Generated at Thu Feb 08 04:04:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.