@@ -264,6 +264,10 @@ class TKqpResourceManager : public IKqpResourceManager {
264
264
// all other requests are not guaranteed to be satisfied.
265
265
// In the nearest future we need to implement several layers of memory requests.
266
266
bool isFirstAllocationRequest = (resources.ExecutionUnits > 0 && resources.MemoryPool == EKqpMemoryPool::DataQuery);
267
+ if (resources.ExecutionUnits > 0 ) {
268
+ Counters->RmOnStartAllocs ->Inc ();
269
+ }
270
+
267
271
if (isFirstAllocationRequest) {
268
272
auto & txBucket = TxBucket (txId);
269
273
with_lock (txBucket.Lock ) {
@@ -370,6 +374,12 @@ class TKqpResourceManager : public IKqpResourceManager {
370
374
371
375
auto & txBucket = TxBucket (txId);
372
376
377
+ if (resources.ReleaseAllResources ) {
378
+ Counters->RmOnCompleteFree ->Inc ();
379
+ } else {
380
+ Counters->RmExtraMemFree ->Inc ();
381
+ }
382
+
373
383
{
374
384
TMaybe<TGuard<TMutex>> guard;
375
385
guard.ConstructInPlace (txBucket.Lock );
@@ -435,9 +445,11 @@ class TKqpResourceManager : public IKqpResourceManager {
435
445
Y_DEBUG_ABORT_UNLESS (Counters->RmMemory ->Val () >= 0 );
436
446
} // with_lock (txBucket.Lock)
437
447
438
- with_lock (Lock) {
439
- ScanQueryMemoryResource.Release (releaseScanQueryMemory);
440
- } // with_lock (Lock)
448
+ if (releaseScanQueryMemory > 0 ) {
449
+ with_lock (Lock) {
450
+ ScanQueryMemoryResource.Release (releaseScanQueryMemory);
451
+ } // with_lock (Lock)
452
+ }
441
453
442
454
LOG_AS_D (" TxId: " << txId << " , taskId: " << taskId << " . Released resources, "
443
455
<< " ScanQueryMemory: " << releaseScanQueryMemory << " , "
0 commit comments