@@ -60,14 +60,21 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
60
60
return this ;
61
61
}
62
62
63
-
64
63
protected:
65
64
66
- void FailOnError () {
67
- if (Error_) {
68
- LOG_E (" Error: " << *Error_);
69
- Send (SpillingActorId_, new TEvents::TEvPoison);
70
- }
65
+ void FailWithError (const TString& error) {
66
+ LOG_E (" Error: " << error);
67
+ SendInternal (SpillingActorId_, new TEvents::TEvPoison);
68
+ PassAway ();
69
+
70
+ // Currently there is no better way to handle the error.
71
+ // Since the message was not sent from the actor system, there is no one to send the error message to.
72
+ Y_ABORT (" Error: %s" , error.c_str ());
73
+ }
74
+
75
+ void SendInternal (const TActorId& recipient, IEventBase* ev, TEventFlags flags = IEventHandle::FlagTrackDelivery) {
76
+ bool isSent = Send (recipient, ev, flags);
77
+ Y_ABORT_UNLESS (isSent, " Event was not sent" );
71
78
}
72
79
73
80
private:
@@ -88,15 +95,15 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
88
95
}
89
96
90
97
void HandleWork (TEvents::TEvPoison::TPtr&) {
91
- Send (SpillingActorId_, new TEvents::TEvPoison);
98
+ SendInternal (SpillingActorId_, new TEvents::TEvPoison);
92
99
PassAway ();
93
100
}
94
101
95
102
void HandleWork (TEvPut::TPtr& ev) {
96
103
auto & msg = *ev->Get ();
97
104
ui64 size = msg.Blob_ .size ();
98
105
99
- Send (SpillingActorId_, new TEvDqSpilling::TEvWrite (NextBlobId, std::move (msg.Blob_ )));
106
+ SendInternal (SpillingActorId_, new TEvDqSpilling::TEvWrite (NextBlobId, std::move (msg.Blob_ )));
100
107
101
108
WritingBlobs_.emplace (NextBlobId, std::make_pair (size, std::move (msg.Promise_ )));
102
109
WritingBlobsSize_ += size;
@@ -117,7 +124,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
117
124
TLoadingBlobInfo loadingBlobInfo = std::make_pair (removeBlobAfterRead, std::move (msg.Promise_ ));
118
125
LoadingBlobs_.emplace (msg.Key_ , std::move (loadingBlobInfo));
119
126
120
- Send (SpillingActorId_, new TEvDqSpilling::TEvRead (msg.Key_ , removeBlobAfterRead));
127
+ SendInternal (SpillingActorId_, new TEvDqSpilling::TEvRead (msg.Key_ , removeBlobAfterRead));
121
128
}
122
129
123
130
void HandleWork (TEvDelete::TPtr& ev) {
@@ -130,7 +137,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
130
137
131
138
DeletingBlobs_.emplace (msg.Key_ , std::move (msg.Promise_ ));
132
139
133
- Send (SpillingActorId_, new TEvDqSpilling::TEvRead (msg.Key_ , true ));
140
+ SendInternal (SpillingActorId_, new TEvDqSpilling::TEvRead (msg.Key_ , true ));
134
141
}
135
142
136
143
void HandleWork (TEvDqSpilling::TEvWriteResult::TPtr& ev) {
@@ -140,11 +147,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
140
147
141
148
auto it = WritingBlobs_.find (msg.BlobId );
142
149
if (it == WritingBlobs_.end ()) {
143
- LOG_E (" Got unexpected TEvWriteResult, blobId: " << msg.BlobId );
144
-
145
- Error_ = " Internal error" ;
146
-
147
- Send (SpillingActorId_, new TEvents::TEvPoison);
150
+ FailWithError (TStringBuilder () << " [TEvWriteResult] Got unexpected TEvWriteResult, blobId: " << msg.BlobId );
148
151
return ;
149
152
}
150
153
@@ -177,11 +180,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
177
180
178
181
auto it = LoadingBlobs_.find (msg.BlobId );
179
182
if (it == LoadingBlobs_.end ()) {
180
- LOG_E (" Got unexpected TEvReadResult, blobId: " << msg.BlobId );
181
-
182
- Error_ = " Internal error" ;
183
-
184
- Send (SpillingActorId_, new TEvents::TEvPoison);
183
+ FailWithError (TStringBuilder () << " [TEvReadResult] Got unexpected TEvReadResult, blobId: " << msg.BlobId );
185
184
return ;
186
185
}
187
186
@@ -202,9 +201,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
202
201
203
202
void HandleWork (TEvDqSpilling::TEvError::TPtr& ev) {
204
203
auto & msg = *ev->Get ();
205
- LOG_D (" [TEvError] " << msg.Message );
206
-
207
- Error_.ConstructInPlace (msg.Message );
204
+ FailWithError (TStringBuilder () << " [TEvError] " << msg.Message );
208
205
}
209
206
210
207
bool HandleDelete (TKey blobId, ui64 size) {
@@ -241,8 +238,6 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
241
238
242
239
TMap<TKey, TDeletingBlobInfo> DeletingBlobs_;
243
240
244
- TMaybe<TString> Error_;
245
-
246
241
TKey NextBlobId = 0 ;
247
242
248
243
TString SpillerName_;
@@ -252,7 +247,6 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
252
247
std::function<void ()> WakeupCallback_;
253
248
254
249
TSet<TKey> StoredBlobs_;
255
-
256
250
};
257
251
258
252
} // anonymous namespace
0 commit comments