[SERVER-69822] Use MemoryUsageTracker::withinMemoryLimit() consistently Created: 20/Sep/22  Updated: 29/Oct/23  Resolved: 01/Feb/23

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

Type: Improvement Priority: Major - P3
Reporter: Romans Kasperovics Assignee: Projjal Chanda
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Participants:

 Description   

MemoryUsageTracker::withinMemoryLimit() wraps

return _memoryUsageBytes <= static_cast<long long>(_maxAllowedMemoryUsageBytes);

However, there are multiple places in the code where this comparison is done explicitly with different predicates '<', '=>', '>', which can be confusing.

I propose to replace these comparisons with withinMemoryLimit() or !withinMemoryLimit() whenever possible for clarity and consistency.



 Comments   
Comment by Githook User [ 31/Jan/23 ]

Author:

{'name': 'Projjal Chanda', 'email': 'projjal.chanda@mongodb.com', 'username': ''}

Message: SERVER-69822: Use MemoryUsageTracker::withinMemoryLimit() consistently
Branch: master
https://github.com/mongodb/mongo/commit/9afc315f73723d07c434fa738bdde25717bf7708

Comment by Steve Tarzia [ 20/Sep/22 ]

I see only a couple of places where this is the case.  romans.kasperovics@mongodb.com, I am backlogging this, but feel free to pick it up and fix it, as you suggested.

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