Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method to enable memory yellow zone by force #6839

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ydb/library/yql/minikql/aligned_page_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept {
template<typename T>
void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() {
if (Limit == 0) return;
if (IsMemoryYellowZoneForcefullyChanged) return;
if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return;

ui8 usedMemoryPercent = 100 * GetUsed() / Limit;
Expand Down
9 changes: 9 additions & 0 deletions ydb/library/yql/minikql/aligned_page_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ class TAlignedPagePoolImpl {
return IsMemoryYellowZoneReached;
}

void ForcefullySetMemoryYellowZone(bool isEnabled) noexcept {
IsMemoryYellowZoneReached = isEnabled;
IsMemoryYellowZoneForcefullyChanged = true;
}

protected:
void* Alloc(size_t size);
void Free(void* ptr, size_t size) noexcept;
Expand Down Expand Up @@ -268,6 +273,10 @@ class TAlignedPagePoolImpl {

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