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

YQL-17175 added maximum memory limit reached flag #4480

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
2 changes: 1 addition & 1 deletion ydb/library/yql/minikql/aligned_page_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept {

template<typename T>
void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() {
if (IncreaseMemoryLimitCallback) return;
if (Limit == 0) return;
if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return;

ui8 usedMemoryPercent = 100 * GetUsed() / Limit;
if (usedMemoryPercent >= EnableMemoryYellowZoneThreshold) {
Expand Down
12 changes: 6 additions & 6 deletions ydb/library/yql/minikql/aligned_page_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,8 @@ class TAlignedPagePoolImpl {

static void ResetGlobalsUT();

void EnableMemoryYellowZone() noexcept {
IsMemoryYellowZoneReached = true;
}

void DisableMemoryYellowZone() noexcept {
IsMemoryYellowZoneReached = false;
void SetMaximumLimitValueReached(bool isReached) noexcept {
IsMaximumLimitValueReached = isReached;
}

bool IsMemoryYellowZoneEnabled() const noexcept {
Expand Down Expand Up @@ -277,6 +273,10 @@ class TAlignedPagePoolImpl {
// The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%.
const ui8 EnableMemoryYellowZoneThreshold = 80;
const ui8 DisableMemoryYellowZoneThreshold = 50;

// This flag indicates that value of memory limit reached it's maximum.
// Next TryIncreaseLimit call most likely will return false.
bool IsMaximumLimitValueReached = false;
};

using TAlignedPagePool = TAlignedPagePoolImpl<>;
Expand Down
Loading