55#include < ydb/library/actors/core/actor.h>
66#include < ydb/library/actors/core/actorid.h>
77#include < ydb/library/actors/core/log.h>
8+ #include < ydb/library/conclusion/status.h>
89
910namespace NKikimr ::NOlap::NGroupedMemoryManager {
1011
@@ -94,8 +95,8 @@ class TPositiveControlInteger {
9495class TStageFeatures {
9596private:
9697 YDB_READONLY_DEF (TString, Name);
97- YDB_READONLY (ui64, HardLimit, 0 );
9898 YDB_READONLY (ui64, Limit, 0 );
99+ YDB_READONLY (ui64, HardLimit, 0 );
99100 YDB_ACCESSOR_DEF (TPositiveControlInteger, Usage);
100101 YDB_ACCESSOR_DEF (TPositiveControlInteger, Waiting);
101102 std::shared_ptr<TStageFeatures> Owner;
@@ -124,9 +125,9 @@ class TStageFeatures {
124125 , Counters(counters) {
125126 }
126127
127- [[nodiscard]] bool Allocate (const ui64 volume) {
128+ [[nodiscard]] TConclusionStatus Allocate (const ui64 volume) {
128129 if (HardLimit < Usage.Val () + volume) {
129- return false ;
130+ return TConclusionStatus::Fail ( TStringBuilder () << " limit: " << HardLimit << " ;val: " << Usage. Val () << " ;delta= " << volume << " ; " ) ;
130131 }
131132 Waiting.Sub (volume);
132133 Usage.Add (volume);
@@ -135,12 +136,13 @@ class TStageFeatures {
135136 Counters->Sub (volume, false );
136137 }
137138 if (Owner) {
138- if (!Owner->Allocate (volume)) {
139+ const auto ownerResult = Owner->Allocate (volume);
140+ if (ownerResult.IsFail ()) {
139141 Free (volume, true );
140- return false ;
142+ return ownerResult ;
141143 }
142144 }
143- return true ;
145+ return TConclusionStatus::Success () ;
144146 }
145147
146148 void Free (const ui64 volume, const bool allocated) {
@@ -208,7 +210,7 @@ class IAllocation {
208210 YDB_READONLY (ui64, Identifier, Counter.Inc());
209211 YDB_READONLY (ui64, Memory, 0 );
210212 bool Allocated = false ;
211- virtual void DoOnAllocationImpossible () = 0;
213+ virtual void DoOnAllocationImpossible (const TString& errorMessage ) = 0;
212214 virtual bool DoOnAllocated (
213215 std::shared_ptr<TAllocationGuard>&& guard, const std::shared_ptr<NGroupedMemoryManager::IAllocation>& allocation) = 0;
214216
@@ -226,8 +228,8 @@ class IAllocation {
226228 return Allocated;
227229 }
228230
229- void OnAllocationImpossible () {
230- DoOnAllocationImpossible ();
231+ void OnAllocationImpossible (const TString& errorMessage ) {
232+ DoOnAllocationImpossible (errorMessage );
231233 }
232234
233235 [[nodiscard]] bool OnAllocated (
0 commit comments