summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/memory_usage_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/memory_usage_tracker.h')
-rw-r--r--src/mongo/db/pipeline/memory_usage_tracker.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mongo/db/pipeline/memory_usage_tracker.h b/src/mongo/db/pipeline/memory_usage_tracker.h
index 9847b41e3cb..6887e91289a 100644
--- a/src/mongo/db/pipeline/memory_usage_tracker.h
+++ b/src/mongo/db/pipeline/memory_usage_tracker.h
@@ -50,13 +50,11 @@ public:
PerFunctionMemoryTracker() = delete;
void update(long long diff) {
-
- // TODO SERVER-61281: this is a temporary measure in tackling the problem in this
- // ticket. It prevents the underflow from happening but doesn't address the cause
- // which is inaccurate tracking. Once inaccurate tracking is resolved, the underflow
- // assertion could be restored. See SERVER-62856 and SERVER-65473 for details.
-
- set(std::max(_currentMemoryBytes + diff, 0LL));
+ tassert(5578603,
+ str::stream() << "Underflow on memory tracking, attempting to add " << diff
+ << " but only " << _currentMemoryBytes << " available",
+ diff >= 0 || _currentMemoryBytes >= std::abs(diff));
+ set(_currentMemoryBytes + diff);
}
void set(long long total) {
@@ -147,13 +145,11 @@ public:
* Updates total memory usage.
*/
void update(long long diff) {
-
- // TODO SERVER-61281: this is a temporary measure in tackling the problem in this
- // ticket. It prevents the underflow from happening but doesn't address the cause
- // which is inaccurate tracking. Once inaccurate tracking is resolved, the underflow
- // assertion could be restored. See SERVER-62856 and SERVER-65473 for details.
-
- set(std::max(_memoryUsageBytes + diff, 0LL));
+ tassert(5578602,
+ str::stream() << "Underflow on memory tracking, attempting to add " << diff
+ << " but only " << _memoryUsageBytes << " available",
+ diff >= 0 || (int)_memoryUsageBytes >= -1 * diff);
+ set(_memoryUsageBytes + diff);
}
auto currentMemoryBytes() const {