[SERVER-62497] AutoGetCollectionForReadCommandMaybeLockFree operator bool not consistent with AutoGetCollectionForReadCommandMaybeLockFree::getCollection operator bool Created: 11/Jan/22  Updated: 27/Oct/23  Resolved: 18/Feb/22

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

Type: Bug Priority: Major - P3
Reporter: Gregory Noma Assignee: Gregory Noma
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: Execution Team 2022-03-07
Participants:

 Description   

AutoGetCollectionForReadCommandMaybeLockFree::operator bool is supposed to be a shortcut to AutoGetCollectionForReadCommandMaybeLockFree::getCollection::operator bool, i.e. it returns true if a collection with the provided namespace exists, or false otherwise. However, in the case where such a collection does not exists, it appears that it is not behaving as expected:

AutoGetCollectionForReadCommandMaybeLockFree coll{...};  // Collection does not exist
logd("coll {} coll->getCollection() {}",
     static_cast<bool>(coll),
     static_cast<bool>(coll->getCollection()));

coll true coll->getCollection() false



 Comments   
Comment by Gregory Noma [ 18/Feb/22 ]

I think this is actually working properly (both cases return false), I was just making a mistake in my testing.

Generated at Thu Feb 08 05:55:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.