@@ -16,7 +16,7 @@ constexpr TDuration IDLE_DURATION = TDuration::Seconds(60);
16
16
17
17
18
18
struct TDatabaseState {
19
- NActors::TActorContext ActorContext ;
19
+ TActorId SelfId ;
20
20
bool & EnabledResourcePoolsOnServerless;
21
21
22
22
std::vector<TEvPlaceRequestIntoPool::TPtr> PendingRequersts = {};
@@ -33,7 +33,7 @@ struct TDatabaseState {
33
33
const TString& poolId = ev->Get ()->PoolId ;
34
34
auto & subscribers = PendingSubscriptions[poolId];
35
35
if (subscribers.empty ()) {
36
- ActorContext. Register (CreatePoolFetcherActor (ActorContext. SelfID , ev->Get ()->DatabaseId , poolId, nullptr ));
36
+ TActivationContext:: Register (CreatePoolFetcherActor (SelfId , ev->Get ()->DatabaseId , poolId, nullptr ));
37
37
}
38
38
39
39
subscribers.emplace (ev->Sender );
@@ -45,7 +45,7 @@ struct TDatabaseState {
45
45
PendingRequersts.emplace_back (std::move (ev));
46
46
47
47
if (!EnabledResourcePoolsOnServerless && (TInstant::Now () - LastUpdateTime) > IDLE_DURATION) {
48
- ActorContext. Register (CreateDatabaseFetcherActor (ActorContext. SelfID , DatabaseIdToDatabase (databaseId)));
48
+ TActivationContext:: Register (CreateDatabaseFetcherActor (SelfId , DatabaseIdToDatabase (databaseId)));
49
49
} else if (!DatabaseUnsupported) {
50
50
StartPendingRequests ();
51
51
} else {
@@ -61,11 +61,11 @@ struct TDatabaseState {
61
61
}
62
62
63
63
if (ev->Get ()->Status == Ydb::StatusIds::SUCCESS && poolHandler) {
64
- ActorContext. Send (poolHandler, new TEvPrivate::TEvUpdatePoolSubscription (ev->Get ()->PathId , subscribers));
64
+ TActivationContext:: Send (poolHandler, std::make_unique< TEvPrivate::TEvUpdatePoolSubscription> (ev->Get ()->PathId , subscribers));
65
65
} else {
66
66
const TString& databaseId = ev->Get ()->DatabaseId ;
67
67
for (const auto & subscriber : subscribers) {
68
- ActorContext. Send (subscriber, new TEvUpdatePoolInfo (databaseId, poolId, std::nullopt, std::nullopt));
68
+ TActivationContext:: Send (subscriber, std::make_unique< TEvUpdatePoolInfo> (databaseId, poolId, std::nullopt, std::nullopt));
69
69
}
70
70
}
71
71
subscribers.clear ();
@@ -79,7 +79,7 @@ struct TDatabaseState {
79
79
}
80
80
81
81
if (Serverless != ev->Get ()->Serverless ) {
82
- ActorContext. Send (MakeKqpProxyID (ActorContext. SelfID . NodeId ()), new TEvKqp::TEvUpdateDatabaseInfo (ev->Get ()->Database , ev->Get ()->DatabaseId , ev->Get ()->Serverless ));
82
+ TActivationContext:: Send (MakeKqpProxyID (SelfId. NodeId ()), std::make_unique< TEvKqp::TEvUpdateDatabaseInfo> (ev->Get ()->Database , ev->Get ()->DatabaseId , ev->Get ()->Serverless ));
83
83
}
84
84
85
85
LastUpdateTime = TInstant::Now ();
@@ -103,25 +103,24 @@ struct TDatabaseState {
103
103
}
104
104
105
105
for (auto & ev : PendingRequersts) {
106
- ActorContext. Register (CreatePoolResolverActor (std::move (ev), HasDefaultPool));
106
+ TActivationContext:: Register (CreatePoolResolverActor (std::move (ev), HasDefaultPool));
107
107
}
108
108
PendingRequersts.clear ();
109
109
}
110
110
111
111
void ReplyContinueError (Ydb::StatusIds::StatusCode status, NYql::TIssues issues) {
112
112
for (const auto & ev : PendingRequersts) {
113
- RemovePendingSession (ev->Get ()->SessionId , [this ](TEvCleanupRequest::TPtr event) {
114
- ActorContext. Send (event->Sender , new TEvCleanupResponse (Ydb::StatusIds::NOT_FOUND, {NYql::TIssue (TStringBuilder () << " Pool " << event->Get ()->PoolId << " not found" )}));
113
+ RemovePendingSession (ev->Get ()->SessionId , [actorSystem = TActivationContext::ActorSystem () ](TEvCleanupRequest::TPtr event) {
114
+ actorSystem-> Send (event->Sender , new TEvCleanupResponse (Ydb::StatusIds::NOT_FOUND, NYql::TIssues {NYql::TIssue (TStringBuilder () << " Pool " << event->Get ()->PoolId << " not found" )}));
115
115
});
116
- ActorContext. Send (ev->Sender , new TEvContinueRequest (status, {}, {}, issues));
116
+ TActivationContext:: Send (ev->Sender , std::make_unique< TEvContinueRequest> (status, TString {}, NResourcePool::TPoolSettings {}, issues));
117
117
}
118
118
PendingRequersts.clear ();
119
119
}
120
120
};
121
121
122
122
struct TPoolState {
123
123
NActors::TActorId PoolHandler;
124
- NActors::TActorContext ActorContext;
125
124
126
125
std::queue<TEvPrivate::TEvResolvePoolResponse::TPtr> PendingRequests = {};
127
126
bool WaitingInitialization = false ;
@@ -137,7 +136,7 @@ struct TPoolState {
137
136
return ;
138
137
}
139
138
140
- ActorContext. Send (PoolHandler, new TEvPrivate::TEvStopPoolHandler (false ));
139
+ TActivationContext:: Send (PoolHandler, std::make_unique< TEvPrivate::TEvStopPoolHandler> (false ));
141
140
PreviousPoolHandlers.insert (PoolHandler);
142
141
PoolHandler = *NewPoolHandler;
143
142
NewPoolHandler = std::nullopt;
@@ -151,7 +150,7 @@ struct TPoolState {
151
150
152
151
PlaceRequestRunning = true ;
153
152
InFlightRequests++;
154
- ActorContext. Send (PendingRequests.front ()->Forward (PoolHandler));
153
+ TActivationContext:: Send (PendingRequests.front ()->Forward (PoolHandler));
155
154
PendingRequests.pop ();
156
155
}
157
156
@@ -163,31 +162,29 @@ struct TPoolState {
163
162
164
163
void DoCleanupRequest (TEvCleanupRequest::TPtr event) {
165
164
for (const auto & poolHandler : PreviousPoolHandlers) {
166
- ActorContext. Send (poolHandler, new TEvCleanupRequest (
165
+ TActivationContext:: Send (poolHandler, std::make_unique< TEvCleanupRequest> (
167
166
event->Get ()->DatabaseId , event->Get ()->SessionId ,
168
167
event->Get ()->PoolId , event->Get ()->Duration , event->Get ()->CpuConsumed
169
168
));
170
169
}
171
- ActorContext. Send (event->Forward (PoolHandler));
170
+ TActivationContext:: Send (event->Forward (PoolHandler));
172
171
}
173
172
};
174
173
175
174
struct TCpuQuotaManagerState {
176
175
TCpuQuotaManager CpuQuotaManager;
177
- NActors::TActorContext ActorContext;
178
176
bool CpuLoadRequestRunning = false ;
179
177
TInstant CpuLoadRequestTime = TInstant::Zero();
180
178
181
- TCpuQuotaManagerState (NActors::TActorContext actorContext, NMonitoring::TDynamicCounterPtr subComponent)
179
+ TCpuQuotaManagerState (NMonitoring::TDynamicCounterPtr subComponent)
182
180
: CpuQuotaManager(TDuration::Seconds(1 ), TDuration::Seconds(10 ), IDLE_DURATION, 0.1, true, 0, subComponent)
183
- , ActorContext(actorContext)
184
181
{}
185
182
186
183
void RequestCpuQuota (TActorId poolHandler, double maxClusterLoad, ui64 coockie) {
187
184
auto response = CpuQuotaManager.RequestCpuQuota (0.0 , maxClusterLoad);
188
185
189
186
bool quotaAccepted = response.Status == NYdb::EStatus::SUCCESS;
190
- ActorContext. Send (poolHandler, new TEvPrivate::TEvCpuQuotaResponse (quotaAccepted, maxClusterLoad, std::move (response.Issues )), 0 , coockie);
187
+ TActivationContext:: Send (poolHandler, std::make_unique< TEvPrivate::TEvCpuQuotaResponse> (quotaAccepted, maxClusterLoad, std::move (response.Issues )), 0 , coockie);
191
188
192
189
// Schedule notification
193
190
if (!quotaAccepted) {
@@ -238,7 +235,7 @@ struct TCpuQuotaManagerState {
238
235
}
239
236
240
237
for (const TActorId& poolHandler : poolHandlers) {
241
- ActorContext. Send (poolHandler, new TEvPrivate::TEvRefreshPoolState ());
238
+ TActivationContext:: Send (poolHandler, std::make_unique< TEvPrivate::TEvRefreshPoolState> ());
242
239
HandlersLimits.erase (poolHandler);
243
240
}
244
241
PendingHandlers.erase (PendingHandlers.begin ());
0 commit comments