[SERVER-77729] Make NamespaceString override the stringifyForAssert for assert Created: 02/Jun/23  Updated: 29/Oct/23  Resolved: 06/Jun/23

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

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

Issue Links:
Depends
depends on SERVER-77796 ASSERT problem finding stringifyForAs... Closed
is depended on by SERVER-74488 Make NamespaceString::toString() private Closed
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2023-06-12
Participants:
Story Points: 1

 Description   

When we make NamespaceString::toString() private, the unitest code `ASSERT_EQ(nss1, nss2)` get compile error like this:

C:\data\mci\5b1328debd0837979a36f1bb84db036f\src\src\mongo/unittest/stringify.h(147,1): error C2248: 'mongo::NamespaceString::toString': cannot access private member declared in class 'mongo::NamespaceString'
[2023/06/02 01:35:12.657]         return x.toString();
[2023/06/02 01:35:12.657] ^
[2023/06/02 01:35:12.657] C:\data\mci\5b1328debd0837979a36f1bb84db036f\src\src\mongo/db/namespace_string.h(861): note: see declaration of 'mongo::NamespaceString::toString'
[2023/06/02 01:35:12.657]     std::string toString() const { 

To resolve this issue, we are going to make the NamespaceString override the stringifyForAssert. 



 Comments   
Comment by Githook User [ 06/Jun/23 ]

Author:

{'name': 'Sophia Tan', 'email': 'sophia_tll@hotmail.com', 'username': 'sophiatll'}

Message: SERVER-77729 Make NamespaceString override the stringifyForAssert for assert
Branch: master
https://github.com/mongodb/mongo/commit/64d8026322ab66998c5de819ae3f0cbdd00cc91b

Comment by Billy Donahue [ 03/Jun/23 ]

define a stringifyForAssert instead.

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