@@ -69,7 +69,7 @@ class TWithMemoryControllerServer : public TServer {
69
69
for (ui32 nodeIndex = 0 ; nodeIndex < Runtime->GetNodeCount (); ++nodeIndex) {
70
70
Runtime->AddLocalService (MakeMemoryControllerId (nodeIndex),
71
71
TActorSetupCmd (
72
- CreateMemoryController (TDuration::Seconds (1 ), (TIntrusivePtr<IProcessMemoryInfoProvider>)ProcessMemoryInfoProvider,
72
+ CreateMemoryController (TDuration::Seconds (1 ), (TIntrusivePtr<IProcessMemoryInfoProvider>)ProcessMemoryInfoProvider,
73
73
Settings->AppConfig ->GetMemoryControllerConfig (), resourceBrokerSelfConfig,
74
74
Runtime->GetDynamicCounters ()),
75
75
TMailboxType::ReadAsFilled,
@@ -221,7 +221,7 @@ Y_UNIT_TEST(Config_ConsumerLimits) {
221
221
memoryControllerConfig->SetSharedCacheMaxPercent (30 );
222
222
memoryControllerConfig->SetSharedCacheMinBytes (100_MB);
223
223
memoryControllerConfig->SetSharedCacheMaxBytes (500_MB);
224
-
224
+
225
225
memoryControllerConfig->SetMemTableMinPercent (10 );
226
226
memoryControllerConfig->SetMemTableMaxPercent (20 );
227
227
memoryControllerConfig->SetMemTableMinBytes (10_MB);
@@ -232,7 +232,7 @@ Y_UNIT_TEST(Config_ConsumerLimits) {
232
232
233
233
auto server = MakeIntrusive<TWithMemoryControllerServer>(serverSettings);
234
234
auto & runtime = *server->GetRuntime ();
235
-
235
+
236
236
server->ProcessMemoryInfo ->CGroupLimit = 1000_MB;
237
237
runtime.SimulateSleep (TDuration::Seconds (2 ));
238
238
UNIT_ASSERT_VALUES_EQUAL (server->MemoryControllerCounters ->GetCounter (" Consumer/SharedCache/LimitMin" )->Val (), 200_MB);
@@ -399,7 +399,7 @@ Y_UNIT_TEST(ResourceBroker) {
399
399
400
400
auto memoryControllerConfig = serverSettings.AppConfig ->MutableMemoryControllerConfig ();
401
401
memoryControllerConfig->SetQueryExecutionLimitPercent (15 );
402
-
402
+
403
403
auto resourceBrokerConfig = serverSettings.AppConfig ->MutableResourceBrokerConfig ();
404
404
auto queue = resourceBrokerConfig->AddQueues ();
405
405
queue->SetName (" queue_cs_ttl" );
@@ -410,33 +410,42 @@ Y_UNIT_TEST(ResourceBroker) {
410
410
auto & runtime = *server->GetRuntime ();
411
411
TAutoPtr<IEventHandle> handle;
412
412
auto sender = runtime.AllocateEdgeActor ();
413
+ auto senderSubscriber = runtime.AllocateEdgeActor ();
413
414
414
415
InitRoot (server, sender);
415
-
416
+
416
417
runtime.SimulateSleep (TDuration::Seconds (2 ));
417
418
runtime.Send (new IEventHandle (MakeResourceBrokerID (), sender, new TEvResourceBroker::TEvConfigRequest (NLocalDb::KqpResourceManagerQueue)));
418
- auto config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(handle );
419
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetMemory (), 150_MB);
419
+ auto config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(sender );
420
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetMemory (), 150_MB);
420
421
UNIT_ASSERT_VALUES_EQUAL (server->MemoryControllerCounters ->GetCounter (" Consumer/QueryExecution/Limit" )->Val (), 150_MB);
421
422
UNIT_ASSERT_VALUES_EQUAL (server->MemoryControllerCounters ->GetCounter (" Stats/ActivitiesLimitBytes" )->Val (), 300_MB);
422
423
424
+ runtime.SimulateSleep (TDuration::Seconds (2 ));
425
+ runtime.Send (new IEventHandle (MakeResourceBrokerID (), senderSubscriber, new TEvResourceBroker::TEvConfigRequest (NLocalDb::KqpResourceManagerQueue, /* subscribe=*/ true )));
426
+ config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(senderSubscriber);
427
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()->QueueConfig ->GetLimit ().GetMemory (), 150_MB);
428
+
423
429
server->ProcessMemoryInfo ->CGroupLimit = 500_MB;
424
430
runtime.SimulateSleep (TDuration::Seconds (2 ));
425
431
runtime.Send (new IEventHandle (MakeResourceBrokerID (), sender, new TEvResourceBroker::TEvConfigRequest (NLocalDb::KqpResourceManagerQueue)));
426
- config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(handle );
427
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetMemory (), 75_MB);
432
+ config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(sender );
433
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetMemory (), 75_MB);
428
434
UNIT_ASSERT_VALUES_EQUAL (server->MemoryControllerCounters ->GetCounter (" Consumer/QueryExecution/Limit" )->Val (), 75_MB);
429
435
UNIT_ASSERT_VALUES_EQUAL (server->MemoryControllerCounters ->GetCounter (" Stats/ActivitiesLimitBytes" )->Val (), 150_MB);
430
436
437
+ config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(senderSubscriber);
438
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()->QueueConfig ->GetLimit ().GetMemory (), 75_MB);
439
+
431
440
// ensure that other settings are not affected:
432
441
runtime.Send (new IEventHandle (MakeResourceBrokerID (), sender, new TEvResourceBroker::TEvConfigRequest (" queue_cs_ttl" )));
433
- config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(handle );
434
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetCpu (), 3 );
435
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetMemory (), 13_MB);
442
+ config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(sender );
443
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetCpu (), 3 );
444
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetMemory (), 13_MB);
436
445
runtime.Send (new IEventHandle (MakeResourceBrokerID (), sender, new TEvResourceBroker::TEvConfigRequest (" queue_cs_general" )));
437
- config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(handle );
438
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetCpu (), 3 );
439
- UNIT_ASSERT_VALUES_EQUAL (config->QueueConfig ->GetLimit ().GetMemory (), 3221225472 );
446
+ config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(sender );
447
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetCpu (), 3 );
448
+ UNIT_ASSERT_VALUES_EQUAL (config->Get ()-> QueueConfig ->GetLimit ().GetMemory (), 3221225472 );
440
449
}
441
450
442
451
Y_UNIT_TEST (ResourceBroker_ConfigLimit) {
@@ -449,7 +458,7 @@ Y_UNIT_TEST(ResourceBroker_ConfigLimit) {
449
458
450
459
auto memoryControllerConfig = serverSettings.AppConfig ->MutableMemoryControllerConfig ();
451
460
memoryControllerConfig->SetQueryExecutionLimitPercent (15 );
452
-
461
+
453
462
auto resourceBrokerConfig = serverSettings.AppConfig ->MutableResourceBrokerConfig ();
454
463
resourceBrokerConfig->MutableResourceLimit ()->SetMemory (1000_MB);
455
464
auto queue = resourceBrokerConfig->AddQueues ();
@@ -466,7 +475,7 @@ Y_UNIT_TEST(ResourceBroker_ConfigLimit) {
466
475
auto sender = runtime.AllocateEdgeActor ();
467
476
468
477
InitRoot (server, sender);
469
-
478
+
470
479
runtime.SimulateSleep (TDuration::Seconds (2 ));
471
480
runtime.Send (new IEventHandle (MakeResourceBrokerID (), sender, new TEvResourceBroker::TEvConfigRequest (NLocalDb::KqpResourceManagerQueue)));
472
481
auto config = runtime.GrabEdgeEvent <TEvResourceBroker::TEvConfigResponse>(handle);
0 commit comments