@@ -14,15 +14,13 @@ struct TMemoryQuotaManager : public NYql::NDq::TGuaranteeQuotaManager {
14
14
, std::shared_ptr<IKqpNodeState> state
15
15
, TIntrusivePtr<NRm::TTxState> tx
16
16
, TIntrusivePtr<NRm::TTaskState> task
17
- , ui64 limit
18
- , ui64 reasonableSpillingTreshold)
17
+ , ui64 limit)
19
18
: NYql::NDq::TGuaranteeQuotaManager(limit, limit)
20
19
, ResourceManager(std::move(resourceManager))
21
20
, MemoryPool(memoryPool)
22
21
, State(std::move(state))
23
22
, Tx(std::move(tx))
24
23
, Task(std::move(task))
25
- , ReasonableSpillingTreshold(reasonableSpillingTreshold)
26
24
{
27
25
}
28
26
@@ -57,7 +55,7 @@ struct TMemoryQuotaManager : public NYql::NDq::TGuaranteeQuotaManager {
57
55
}
58
56
59
57
bool IsReasonableToUseSpilling () const override {
60
- return Tx-> GetExtraMemoryAllocatedSize () >= ReasonableSpillingTreshold ;
58
+ return Task-> IsReasonableToStartSpilling () ;
61
59
}
62
60
63
61
TString MemoryConsumptionDetails () const override {
@@ -88,7 +86,6 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory {
88
86
std::atomic<ui64> MkqlLightProgramMemoryLimit = 0 ;
89
87
std::atomic<ui64> MkqlHeavyProgramMemoryLimit = 0 ;
90
88
std::atomic<ui64> MinChannelBufferSize = 0 ;
91
- std::atomic<ui64> ReasonableSpillingTreshold = 0 ;
92
89
std::atomic<ui64> MinMemAllocSize = 8_MB;
93
90
std::atomic<ui64> MinMemFreeSize = 32_MB;
94
91
@@ -109,7 +106,6 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory {
109
106
MkqlLightProgramMemoryLimit.store (config.GetMkqlLightProgramMemoryLimit ());
110
107
MkqlHeavyProgramMemoryLimit.store (config.GetMkqlHeavyProgramMemoryLimit ());
111
108
MinChannelBufferSize.store (config.GetMinChannelBufferSize ());
112
- ReasonableSpillingTreshold.store (config.GetReasonableSpillingTreshold ());
113
109
MinMemAllocSize.store (config.GetMinMemAllocSize ());
114
110
MinMemFreeSize.store (config.GetMinMemFreeSize ());
115
111
}
@@ -164,14 +160,17 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory {
164
160
std::move (args.State ),
165
161
std::move (args.TxInfo ),
166
162
std::move (task),
167
- limit,
168
- ReasonableSpillingTreshold.load ());
163
+ limit);
169
164
170
165
auto runtimeSettings = args.RuntimeSettings ;
171
166
runtimeSettings.ExtraMemoryAllocationPool = args.MemoryPool ;
172
167
runtimeSettings.UseSpilling = args.WithSpilling ;
173
168
runtimeSettings.StatsMode = args.StatsMode ;
174
169
170
+ if (runtimeSettings.UseSpilling ) {
171
+ args.Task ->SetEnableSpilling (runtimeSettings.UseSpilling );
172
+ }
173
+
175
174
if (args.Deadline ) {
176
175
runtimeSettings.Timeout = args.Deadline - TAppData::TimeProvider->Now ();
177
176
}
0 commit comments