[SERVER-65738] Avoid storing db name in two fields of DatabaseName Created: 18/Apr/22  Updated: 23/Jun/22  Resolved: 23/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Sophia Tan Assignee: Sophia Tan
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-66963 Improve performance of NamespaceStrin... Closed
Participants:

 Description   

Db name of the database is stored in two fields of DatabaseName. 

  • _dbName,  it holds the db name
  • _tenantDbName, it holds the tenant id and db name in one string when a tenant id is assigned.

In this ticket, we will redesign the internal data struct to have the db name only be stored in one place, such as _name. This field will hold a string with

  •  <tenant id>_<db name>, if tenant id is assigned.
  •  <db name>, otherwise.

Also, add a field to store the start index of db name and change the implementations of related functions, for example
StringData dbName() {
return StringData(_name.c_str() + _dbIndex, _tenantDbName.size());
}

As a part of this ticket, also remove createSystemTenantDbName - we are not currently using it anywhere and it breaks convention as it takes in a string without a tenantId or a separate tenantId param.


Generated at Thu Feb 08 06:03:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.