@@ -141,26 +141,46 @@ NActors::NLog::EPriority PriorityForStatusOutbound(NKikimrProto::EReplyStatus st
141
141
NActors::NLog::EPriority PriorityForStatusResult (NKikimrProto::EReplyStatus status);
142
142
NActors::NLog::EPriority PriorityForStatusInbound (NKikimrProto::EReplyStatus status);
143
143
144
+ #define DSPROXY_ENUM_EVENTS (XX ) \
145
+ XX (TEvBlobStorage::TEvPut) \
146
+ XX(TEvBlobStorage::TEvGet) \
147
+ XX(TEvBlobStorage::TEvBlock) \
148
+ XX(TEvBlobStorage::TEvDiscover) \
149
+ XX(TEvBlobStorage::TEvRange) \
150
+ XX(TEvBlobStorage::TEvCollectGarbage) \
151
+ XX(TEvBlobStorage::TEvStatus) \
152
+ XX(TEvBlobStorage::TEvPatch) \
153
+ XX(TEvBlobStorage::TEvAssimilate) \
154
+ //
155
+
156
+ #define DSPROXY_ENUM_DISK_EVENTS (XX ) \
157
+ XX (TEvBlobStorage::TEvVMovedPatch) \
158
+ XX(TEvBlobStorage::TEvVPatchStart) \
159
+ XX(TEvBlobStorage::TEvVPatchDiff) \
160
+ XX(TEvBlobStorage::TEvVPatchXorDiff) \
161
+ XX(TEvBlobStorage::TEvVPut) \
162
+ XX(TEvBlobStorage::TEvVMultiPut) \
163
+ XX(TEvBlobStorage::TEvVGet) \
164
+ XX(TEvBlobStorage::TEvVBlock) \
165
+ XX(TEvBlobStorage::TEvVGetBlock) \
166
+ XX(TEvBlobStorage::TEvVCollectGarbage) \
167
+ XX(TEvBlobStorage::TEvVGetBarrier) \
168
+ XX(TEvBlobStorage::TEvVStatus) \
169
+ XX(TEvBlobStorage::TEvVAssimilate) \
170
+ //
171
+
144
172
inline void SetExecutionRelay(IEventBase& ev, std::shared_ptr<TEvBlobStorage::TExecutionRelay> executionRelay) {
145
173
switch (const ui32 type = ev.Type ()) {
146
174
#define XX (T ) \
147
- case TEvBlobStorage::Ev##T : \
148
- static_cast <TEvBlobStorage::TEv## T&>(ev).ExecutionRelay = std::move (executionRelay); \
175
+ case T::EventType : \
176
+ static_cast <T&>(ev).ExecutionRelay = std::move (executionRelay); \
149
177
break ; \
150
- case TEvBlobStorage::Ev## T##Result: \
151
- static_cast <TEvBlobStorage::TEv## T##Result&>(ev).ExecutionRelay = std::move (executionRelay); \
178
+ case T##Result::EventType : \
179
+ static_cast <T##Result&>(ev).ExecutionRelay = std::move (executionRelay); \
152
180
break ; \
153
181
//
154
182
155
- XX (Put)
156
- XX (Get)
157
- XX (Block)
158
- XX (Discover)
159
- XX (Range)
160
- XX (CollectGarbage)
161
- XX (Status)
162
- XX (Patch)
163
- XX (Assimilate)
183
+ DSPROXY_ENUM_EVENTS (XX)
164
184
#undef XX
165
185
166
186
default :
@@ -220,96 +240,26 @@ class TBlobStorageGroupRequestActor : public TActor<TBlobStorageGroupRequestActo
220
240
221
241
void BootstrapImpl ();
222
242
223
- template <typename T>
224
- void CountEvent (const T &ev) const {
225
- ERequestType request = GetRequestType ();
226
- Mon->CountEvent (request, ev);
227
- }
243
+ void CountEvent (IEventBase *ev, ui32 type) const ;
244
+
245
+ void CountPut (ui32 bufferBytes);
228
246
229
247
TActorId GetVDiskActorId (const TVDiskIdShort &shortId) const ;
230
248
249
+ bool CheckForTermErrors (bool suppressCommonErrors, const NProtoBuf::Message& record, ui32 type,
250
+ NKikimrProto::EReplyStatus status, TVDiskID vdiskId, const NKikimrBlobStorage::TGroupInfo *group,
251
+ bool & setErrorAndPostpone, bool & setRaceToError);
231
252
bool ProcessEvent (TAutoPtr<IEventHandle>& ev, bool suppressCommonErrors = false );
232
253
233
- template <typename TEv>
234
- void CountPut (const std::unique_ptr<TEv>& ev) {
235
- ++GeneratedSubrequests;
236
- GeneratedSubrequestBytes += ev->GetBufferBytes ();
237
- }
238
-
239
- template <typename TEv>
240
- void CountPuts (const TDeque<std::unique_ptr<TEv>>& q) {
241
- for (const auto & item : q) {
242
- CountPut (item);
243
- }
244
- }
245
-
246
- template <typename ... TOptions>
247
- void CountPuts (const TDeque<std::variant<TOptions...>>& q) {
248
- for (const auto & item : q) {
249
- std::visit ([&](auto & item) { CountPut (item); }, item);
250
- }
251
- }
252
-
253
- template <typename T>
254
- void SendToQueue (std::unique_ptr<T> event, ui64 cookie, bool timeStatsEnabled = false ) {
255
- if constexpr (
256
- !std::is_same_v<T, TEvBlobStorage::TEvVGetBlock>
257
- && !std::is_same_v<T, TEvBlobStorage::TEvVBlock>
258
- && !std::is_same_v<T, TEvBlobStorage::TEvVStatus>
259
- && !std::is_same_v<T, TEvBlobStorage::TEvVCollectGarbage>
260
- && !std::is_same_v<T, TEvBlobStorage::TEvVAssimilate>
261
- ) {
262
- const ui64 cyclesPerUs = NHPTimer::GetCyclesPerSecond () / 1000000 ;
263
- event->Record .MutableTimestamps ()->SetSentByDSProxyUs (GetCycleCountFast () / cyclesPerUs);
264
- }
265
-
266
- if constexpr (!std::is_same_v<T, TEvBlobStorage::TEvVStatus> && !std::is_same_v<T, TEvBlobStorage::TEvVAssimilate>) {
267
- event->MessageRelevanceTracker = MessageRelevanceTracker;
268
- ui64 cost;
269
- if constexpr (std::is_same_v<T, TEvBlobStorage::TEvVMultiPut>) {
270
- bool internalQueue;
271
- cost = CostModel->GetCost (*event, &internalQueue);
272
- } else {
273
- cost = CostModel->GetCost (*event);
274
- }
275
- *PoolCounters->DSProxyDiskCostCounter += cost;
276
-
277
- LOG_TRACE_S (TActivationContext::AsActorContext (), NKikimrServices::BS_REQUEST_COST,
278
- " DSProxy Request Type# " << TypeName (*event) << " Cost# " << cost);
279
- }
254
+ void SendToQueue (std::unique_ptr<IEventBase> event, ui64 cookie, bool timeStatsEnabled = false );
280
255
281
- const TActorId queueId = GroupQueues->Send (*this , Info->GetTopology (), std::move (event), cookie, Span.GetTraceId (),
282
- timeStatsEnabled);
283
- ++RequestsInFlight;
284
- }
285
-
286
- void SendToQueues (TDeque<std::unique_ptr<TEvBlobStorage::TEvVGet>> &vGets, bool timeStatsEnabled);
287
-
288
- template <typename TEvent>
289
- void SendToQueues (TDeque<std::unique_ptr<TEvent>> &events, bool timeStatsEnabled) {
290
- for (auto & request : events) {
291
- ui64 messageCookie = request->Record .GetCookie ();
292
- CountEvent (*request);
293
- TLogoBlobID id = GetBlobId (request);
294
- TVDiskID vDiskId = VDiskIDFromVDiskID (request->Record .GetVDiskID ());
295
- LWTRACK (DSProxyPutVPutIsSent, request->Orbit , Info->GetFailDomainOrderNumber (vDiskId),
296
- Info->GroupID .GetRawId (), id.Channel (), id.PartId (), id.ToString (), id.BlobSize ());
297
- SendToQueue (std::move (request), messageCookie, timeStatsEnabled);
298
- }
299
- }
300
-
301
- template <typename TPtr>
302
- void ProcessReplyFromQueue (const TPtr& /* ev*/ ) {
303
- Y_ABORT_UNLESS (RequestsInFlight);
304
- --RequestsInFlight;
305
- CheckPostponedQueue ();
306
- }
256
+ void ProcessReplyFromQueue (IEventBase *ev);
307
257
308
- TLogoBlobID GetBlobId (std::unique_ptr< TEvBlobStorage::TEvVPut> & ev);
309
- TLogoBlobID GetBlobId (std::unique_ptr< TEvBlobStorage::TEvVMultiPut> & ev);
310
- TLogoBlobID GetBlobId (std::unique_ptr< TEvBlobStorage::TEvVMovedPatch> & ev);
311
- TLogoBlobID GetBlobId (std::unique_ptr< TEvBlobStorage::TEvVPatchStart> & ev);
312
- TLogoBlobID GetBlobId (std::unique_ptr< TEvBlobStorage::TEvVPatchDiff> & ev);
258
+ static TLogoBlobID GetBlobId (TEvBlobStorage::TEvVPut& ev);
259
+ static TLogoBlobID GetBlobId (TEvBlobStorage::TEvVMultiPut& ev);
260
+ static TLogoBlobID GetBlobId (TEvBlobStorage::TEvVMovedPatch& ev);
261
+ static TLogoBlobID GetBlobId (TEvBlobStorage::TEvVPatchStart& ev);
262
+ static TLogoBlobID GetBlobId (TEvBlobStorage::TEvVPatchDiff& ev);
313
263
314
264
void SendToProxy (std::unique_ptr<IEventBase> event, ui64 cookie = 0 , NWilson::TTraceId traceId = {});
315
265
void SendResponseAndDie (std::unique_ptr<IEventBase>&& ev, TBlobStorageGroupProxyTimeStats *timeStats, TActorId source, ui64 cookie);
0 commit comments