@@ -40,7 +40,7 @@ using namespace NKMeans;
40
40
* - Mean value is calculated for each centroid and returned in the response
41
41
*/
42
42
43
- class TRecomputeKMeansScan : public TActor <TRecomputeKMeansScan>, public IActorExceptionHandler, public NTable::IScan {
43
+ class TRecomputeKMeansScan : public TActor <TRecomputeKMeansScan>, public NTable::IScan {
44
44
protected:
45
45
const ui64 TabletId = 0 ;
46
46
const ui64 BuildId = 0 ;
@@ -88,7 +88,7 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
88
88
Lead.SetTags (ScanTags);
89
89
}
90
90
91
- TInitialState Prepare (IDriver* driver, TIntrusiveConstPtr<TScheme>) final
91
+ TInitialState Prepare (IDriver* driver, TIntrusiveConstPtr<TScheme>) noexcept final
92
92
{
93
93
TActivationContext::AsActorContext ().RegisterWithSameMailbox (this );
94
94
LOG_I (" Prepare " << Debug ());
@@ -98,22 +98,13 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
98
98
return {EScan::Feed, {}};
99
99
}
100
100
101
- TAutoPtr<IDestructable> Finish (const std::exception& exc) final
102
- {
103
- Issues.AddIssue (NYql::TIssue (TStringBuilder ()
104
- << " Scan failed " << exc.what ()));
105
- return Finish (EStatus::Exception);
106
- }
107
-
108
- TAutoPtr<IDestructable> Finish (EStatus status) final
101
+ TAutoPtr<IDestructable> Finish (EAbort abort) noexcept final
109
102
{
110
103
auto & record = Response->Record ;
111
104
record.SetReadRows (ReadRows);
112
105
record.SetReadBytes (ReadBytes);
113
106
114
- if (status == EStatus::Exception) {
115
- record.SetStatus (NKikimrIndexBuilder::EBuildStatus::BUILD_ERROR);
116
- } else if (status != NTable::EStatus::Done) {
107
+ if (abort != EAbort::None) {
117
108
record.SetStatus (NKikimrIndexBuilder::EBuildStatus::ABORTED);
118
109
} else {
119
110
record.SetStatus (NKikimrIndexBuilder::EBuildStatus::DONE);
@@ -134,31 +125,28 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
134
125
return nullptr ;
135
126
}
136
127
137
- bool OnUnhandledException (const std::exception& exc) final
138
- {
139
- if (!Driver) {
140
- return false ;
141
- }
142
- Driver->Throw (exc);
143
- return true ;
144
- }
145
-
146
- void Describe (IOutputStream& out) const final
128
+ void Describe (IOutputStream& out) const noexcept final
147
129
{
148
130
out << Debug ();
149
131
}
150
132
151
- EScan Seek (TLead& lead, ui64 seq) final
133
+ EScan Seek (TLead& lead, ui64 seq) noexcept final
152
134
{
135
+ try {
153
136
LOG_T (" Seek " << seq << " " << Debug ());
154
137
155
138
lead = Lead;
156
139
157
140
return EScan::Feed;
141
+ } catch (const std::exception& exc) {
142
+ Issues.AddIssue (exc.what ());
143
+ return EScan::Final;
144
+ }
158
145
}
159
146
160
- EScan Feed (TArrayRef<const TCell> key, const TRow& row) final
147
+ EScan Feed (TArrayRef<const TCell> key, const TRow& row) noexcept final
161
148
{
149
+ try {
162
150
// LOG_T("Feed " << Debug());
163
151
164
152
++ReadRows;
@@ -167,13 +155,22 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
167
155
Feed (key, *row);
168
156
169
157
return EScan::Feed;
158
+ } catch (const std::exception& exc) {
159
+ Issues.AddIssue (exc.what ());
160
+ return EScan::Final;
161
+ }
170
162
}
171
163
172
- EScan Exhausted () final
164
+ EScan Exhausted () noexcept final
173
165
{
166
+ try {
174
167
LOG_T (" Exhausted " << Debug ());
175
168
176
169
return EScan::Final;
170
+ } catch (const std::exception& exc) {
171
+ Issues.AddIssue (exc.what ());
172
+ return EScan::Final;
173
+ }
177
174
}
178
175
179
176
protected:
@@ -198,8 +195,9 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
198
195
}
199
196
}
200
197
201
- void FillResponse ()
198
+ void FillResponse () noexcept
202
199
{
200
+ try {
203
201
auto & record = Response->Record ;
204
202
Clusters->RecomputeClusters ();
205
203
const auto & clusters = Clusters->GetClusters ();
@@ -209,6 +207,9 @@ class TRecomputeKMeansScan: public TActor<TRecomputeKMeansScan>, public IActorEx
209
207
record.AddClusterSizes (sizes[i]);
210
208
}
211
209
record.SetStatus (NKikimrIndexBuilder::EBuildStatus::DONE);
210
+ } catch (const std::exception& exc) {
211
+ Issues.AddIssue (exc.what ());
212
+ }
212
213
}
213
214
};
214
215
0 commit comments