Skip to content

Commit 19153a4

Browse files
Added method to enable memory yellow zone by force (#6839)
1 parent 654e1f2 commit 19153a4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ydb/library/yql/minikql/aligned_page_pool.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept {
504504
template<typename T>
505505
void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() {
506506
if (Limit == 0) return;
507+
if (IsMemoryYellowZoneForcefullyChanged) return;
507508
if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return;
508509

509510
ui8 usedMemoryPercent = 100 * GetUsed() / Limit;

ydb/library/yql/minikql/aligned_page_pool.h

+9
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ class TAlignedPagePoolImpl {
222222
return IsMemoryYellowZoneReached;
223223
}
224224

225+
void ForcefullySetMemoryYellowZone(bool isEnabled) noexcept {
226+
IsMemoryYellowZoneReached = isEnabled;
227+
IsMemoryYellowZoneForcefullyChanged = true;
228+
}
229+
225230
protected:
226231
void* Alloc(size_t size);
227232
void Free(void* ptr, size_t size) noexcept;
@@ -268,6 +273,10 @@ class TAlignedPagePoolImpl {
268273

269274
// Indicates when memory limit is almost reached.
270275
bool IsMemoryYellowZoneReached = false;
276+
// Indicates that memory yellow zone was enabled or disabled forcefully.
277+
// If the value of this variable is true, then the limits specified below will not be applied and
278+
// changing the value can only be done manually.
279+
bool IsMemoryYellowZoneForcefullyChanged = false;
271280
// This theshold is used to determine is memory limit is almost reached.
272281
// If TIncreaseMemoryLimitCallback is set this thresholds should be ignored.
273282
// The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%.

0 commit comments

Comments
 (0)