Problem/Motivation
Logger::eventCollections() lists the event collections with a regex on their name. MongoDB evaluates a name regex by scanning the whole collection catalog, so its cost grows linearly with the number of collections in the logger database, which holds one collection per message template.
Measured on MongoDB 8.3.11 while working on #3626728: Remove deprecated collStats after MongoDB release 6.2: the regex listing takes 1.7 to 2.6 s at 305,000 collections, where the exact-name listing that Logger::ensureCollection() runs stays under 1 ms p50 at every size from 1 to 305,000.
The module never needs this listing at runtime: the template collection (watchdog) already is the registry of event collections, and Logger::eventCollection() derives a collection from a template id. The only caller is ControllerTest::testLoggerAddAndUiClear(), which checks that clearing the logger dropped the event collections.
Steps to reproduce
n.a.
Proposed resolution
- 8.x-2.2: deprecate the method, with
@deprecated in mongodb:8.x-2.2 and is removed from mongodb:8.x-2.3. There is no replacement.and a@seeto a change record, plus anE_USER_DEPRECATEDnotice in the method body. The change record explains the cost of the regex listing, and that the template collection is the way to find event collections. - 8.x-2.3: remove the method from
Logger, and move the listing into the test that uses it.
Remaining tasks
- Write the change record.
- MR for 8.x-2.2: deprecation and notice.
- MR for 8.x-2.3: removal, test helper.
User interface changes
None.
API changes
Logger::eventCollections() is deprecated in 8.x-2.2 and removed in 8.x-2.3.
Data model changes
None.
AI disclosure
This issue was prepared with AI assistance. MRs may use it too: update this section accordingly.
Comments
Comment #2
fgmLowering the priority to Minor, following the measurements posted on #3626728: Remove deprecated collStats after MongoDB release 6.2.
The method still has no runtime caller, and the template collection remains the way to find event collections, so withdrawing it is still worth doing, just not urgent.