Skip to content

Commit 75b7c7c

Browse files
authored
25-1 Increase TotalCPU to avoid backup restore dead locks (#18545) (#18585)
2 parents 1468e22 + 2374e66 commit 75b7c7c

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

ydb/core/tablet/resource_broker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ NKikimrResourceBroker::TResourceBrokerConfig MakeDefaultConfig()
13021302

13031303
const ui64 DefaultQueueCPU = 2;
13041304
const ui64 KqpRmQueueCPU = 4;
1305-
const ui64 TotalCPU = 20;
1305+
const ui64 TotalCPU = 256; // means unlimited
13061306

13071307
// Note: these memory limits will be overwritten by MemoryController
13081308
const ui64 KqpRmQueueMemory = 10_GB;

ydb/core/tablet/resource_broker_ut.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace NKikimr {
1515
using namespace NKikimrResourceBroker;
1616
using namespace NResourceBroker;
1717

18-
static void SetupLogging(TTestActorRuntime& runtime) {
18+
static void SetupLogging(TTestActorRuntime& runtime)
19+
{
1920
NActors::NLog::EPriority priority = ENABLE_DETAILED_RESOURCE_BROKER_LOG ? NLog::PRI_DEBUG : NLog::PRI_ERROR;
2021
runtime.SetLogPriority(NKikimrServices::RESOURCE_BROKER, priority);
2122
}
2223

23-
static NKikimrResourceBroker::TResourceBrokerConfig
24-
MakeTestConfig()
24+
static NKikimrResourceBroker::TResourceBrokerConfig MakeTestConfig()
2525
{
2626
NKikimrResourceBroker::TResourceBrokerConfig config;
2727

@@ -71,16 +71,14 @@ MakeTestConfig()
7171
return config;
7272
}
7373

74-
static void
75-
WaitForBootstrap(TTestActorRuntime &runtime)
74+
static void WaitForBootstrap(TTestActorRuntime &runtime)
7675
{
7776
TDispatchOptions options;
7877
options.FinalEvents.emplace_back(TEvents::TSystem::Bootstrap, 1);
7978
UNIT_ASSERT(runtime.DispatchEvents(options));
8079
}
8180

82-
static void
83-
SubmitTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
81+
static void SubmitTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
8482
ui64 id, ui64 cpu, ui64 memory, const TString &type,
8583
ui32 priority, TIntrusivePtr<TThrRefBase> cookie = nullptr)
8684
{
@@ -94,8 +92,7 @@ SubmitTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
9492
runtime.Send(new IEventHandle(broker, sender, event.Release()));
9593
}
9694

97-
static void
98-
UpdateTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
95+
static void UpdateTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
9996
ui64 id, ui64 cpu, ui64 memory, ui32 priority, const TString &type,
10097
bool resubmit = false)
10198
{
@@ -107,8 +104,7 @@ UpdateTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
107104
runtime.Send(new IEventHandle(broker, sender, event.Release()));
108105
}
109106

110-
static void
111-
UpdateTaskCookie(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
107+
static void UpdateTaskCookie(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
112108
ui64 id, TIntrusivePtr<TThrRefBase> cookie)
113109
{
114110
TAutoPtr<TEvResourceBroker::TEvUpdateTaskCookie> event
@@ -117,17 +113,15 @@ UpdateTaskCookie(TTestActorRuntime &runtime, TActorId broker, TActorId sender,
117113
runtime.Send(new IEventHandle(broker, sender, event.Release()));
118114
}
119115

120-
static void
121-
RemoveTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender, ui64 id)
116+
static void RemoveTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender, ui64 id)
122117
{
123118
TAutoPtr<TEvResourceBroker::TEvRemoveTask> event
124119
= new TEvResourceBroker::TEvRemoveTask(id);
125120

126121
runtime.Send(new IEventHandle(broker, sender, event.Release()));
127122
}
128123

129-
static void
130-
FinishTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender, ui64 id)
124+
static void FinishTask(TTestActorRuntime &runtime, TActorId broker, TActorId sender, ui64 id)
131125
{
132126
TAutoPtr<TEvResourceBroker::TEvFinishTask> event
133127
= new TEvResourceBroker::TEvFinishTask(id);
@@ -147,8 +141,7 @@ WaitForResourceAllocation(TTestActorRuntime &runtime, ui64 id,
147141
return reply->TaskId;
148142
}
149143

150-
static void
151-
WaitForError(TTestActorRuntime &runtime, ui64 id, TEvResourceBroker::TStatus::ECode code,
144+
static void WaitForError(TTestActorRuntime &runtime, ui64 id, TEvResourceBroker::TStatus::ECode code,
152145
TIntrusivePtr<TThrRefBase> cookie = nullptr)
153146
{
154147
TAutoPtr<IEventHandle> handle;
@@ -158,8 +151,7 @@ WaitForError(TTestActorRuntime &runtime, ui64 id, TEvResourceBroker::TStatus::EC
158151
UNIT_ASSERT_VALUES_EQUAL(reply->Cookie, cookie);
159152
}
160153

161-
static void
162-
CheckCounters(::NMonitoring::TDynamicCounterPtr counters, const TString &group, const TString &name,
154+
static void CheckCounters(::NMonitoring::TDynamicCounterPtr counters, const TString &group, const TString &name,
163155
ui64 cpu, ui64 memory, ui64 finished, ui64 enqueued, ui64 infly)
164156
{
165157
auto g = counters->GetSubgroup(group, name);
@@ -185,14 +177,14 @@ static void CheckConfigure(TTestActorRuntime &runtime, TActorId broker, TActorId
185177
UNIT_ASSERT_VALUES_EQUAL((int)rec.GetSuccess(), (int)success);
186178
}
187179

188-
static
189-
TIntrusivePtr<IResourceBroker> GetInstantResourceBroker(TTestActorRuntime &runtime, TActorId broker, TActorId sender) {
180+
static TIntrusivePtr<IResourceBroker> GetInstantResourceBroker(TTestActorRuntime &runtime, TActorId broker, TActorId sender) {
190181
runtime.Send(new IEventHandle(broker, sender, new TEvResourceBroker::TEvResourceBrokerRequest));
191182
auto answer = runtime.GrabEdgeEvent<TEvResourceBroker::TEvResourceBrokerResponse>(sender);
192183
return answer->Get()->ResourceBroker;
193184
}
194185

195186
Y_UNIT_TEST_SUITE(TResourceBroker) {
187+
196188
Y_UNIT_TEST(TestErrors) {
197189
TTestBasicRuntime runtime;
198190
SetupTabletServices(runtime);
@@ -894,6 +886,7 @@ Y_UNIT_TEST_SUITE(TResourceBroker) {
894886
};
895887

896888
Y_UNIT_TEST_SUITE(TResourceBrokerInstant) {
889+
897890
Y_UNIT_TEST(Test) {
898891
TTestBasicRuntime runtime;
899892
SetupTabletServices(runtime);
@@ -1007,6 +1000,7 @@ Y_UNIT_TEST_SUITE(TResourceBrokerInstant) {
10071000
CheckCounters(counters, "queue", "total", 210, 320, 1, 0, 2);
10081001
}
10091002
}
1003+
10101004
};
10111005

10121006
Y_UNIT_TEST_SUITE(TResourceBrokerConfig) {
@@ -1130,6 +1124,21 @@ Y_UNIT_TEST_SUITE(TResourceBrokerConfig) {
11301124
UNIT_ASSERT_VALUES_EQUAL(config.ShortDebugString(), "ResourceLimit { Cpu: 20 Memory: 2048 }");
11311125
}
11321126

1127+
Y_UNIT_TEST(DefaultConfig) {
1128+
auto config = MakeDefaultConfig();
1129+
1130+
Cerr << config.DebugString() << Endl;
1131+
1132+
ui64 queuesCpu = 0;
1133+
for (const auto& q : config.GetQueues()) {
1134+
queuesCpu += q.GetLimit().GetCpu();
1135+
}
1136+
Cerr << "Total queues cpu: " << queuesCpu;
1137+
1138+
// see https://github.com/ydb-platform/ydb/issues/18513
1139+
UNIT_ASSERT_LE(queuesCpu, config.GetResourceLimit().GetCpu());
1140+
}
1141+
11331142
} // TResourceBrokerConfig
11341143

11351144
} // NKikimr

0 commit comments

Comments
 (0)