[SERVER-71780] Return StringData from DatabaseName::db() Created: 01/Dec/22 Updated: 29/Jun/23 Resolved: 29/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Dan Larkin-York | Assignee: | [DO NOT USE] Backlog - Server Serverless (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | ntdi_nice_to_have | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Serverless
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Participants: | |||||||||
| Story Points: | 2 | ||||||||
| Description |
|
Currently, DatabaseName::db() returns a const std::string&, which is fine for the most part. However, it's easy to assign the output in a way that copies the underlying string without realizing it (e.g. auto db = dbName.db() instead of const auto& db = dbName.db()). Changing the return type to StringData would require the caller to opt-in to copy behavior via StringData::toString(), or simply calling DatabaseName::toString() to begin with. |
| Comments |
| Comment by Sophia Tan [ 29/Jun/23 ] |
|
This task has been done by |
| Comment by Sophia Tan [ 27/Jun/23 ] |
|
We decided to make the "DatabaseName::db()" and "NamespaceString::db()" private. See the tickets |