@@ -60,10 +60,10 @@ class TLocalKMeansScanBase: public TActor<TLocalKMeansScanBase>, public NTable::
60
60
61
61
TLead Lead;
62
62
63
- // Sample
64
- TStats ReadStats;
65
- // TODO(mbkkt) Sent or Upload stats?
63
+ ui64 ReadRows = 0 ;
64
+ ui64 ReadBytes = 0 ;
66
65
66
+ // Sample
67
67
ui64 MaxProbability = std::numeric_limits<ui64>::max();
68
68
TReallyFastRng32 Rng;
69
69
@@ -101,6 +101,9 @@ class TLocalKMeansScanBase: public TActor<TLocalKMeansScanBase>, public NTable::
101
101
102
102
TUploadStatus UploadStatus;
103
103
104
+ ui64 UploadRows = 0 ;
105
+ ui64 UploadBytes = 0 ;
106
+
104
107
// Response
105
108
TActorId ResponseActorId;
106
109
TAutoPtr<TEvDataShard::TEvLocalKMeansResponse> Response;
@@ -163,6 +166,10 @@ class TLocalKMeansScanBase: public TActor<TLocalKMeansScanBase>, public NTable::
163
166
}
164
167
165
168
auto & record = Response->Record ;
169
+ record.SetReadRows (ReadRows);
170
+ record.SetReadBytes (ReadBytes);
171
+ record.SetUploadRows (UploadRows);
172
+ record.SetUploadBytes (UploadBytes);
166
173
if (abort != EAbort::None) {
167
174
record.SetStatus (NKikimrIndexBuilder::EBuildStatus::ABORTED);
168
175
} else if (UploadStatus.IsSuccess ()) {
@@ -243,6 +250,8 @@ class TLocalKMeansScanBase: public TActor<TLocalKMeansScanBase>, public NTable::
243
250
UploadStatus.StatusCode = ev->Get ()->Status ;
244
251
UploadStatus.Issues = ev->Get ()->Issues ;
245
252
if (UploadStatus.IsSuccess ()) {
253
+ UploadRows += WriteBuf.GetRows ();
254
+ UploadBytes += WriteBuf.GetBytes ();
246
255
WriteBuf.Clear ();
247
256
if (!ReadBuf.IsEmpty () && ReadBuf.IsReachLimits (Limits)) {
248
257
ReadBuf.FlushTo (WriteBuf);
@@ -366,6 +375,9 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
366
375
if (!InitAggregatedClusters ()) {
367
376
// We don't need to do anything,
368
377
// because this datashard doesn't have valid embeddings for this parent
378
+ if (UploadStatus.IsNone ()) {
379
+ UploadStatus.StatusCode = Ydb::StatusIds::SUCCESS;
380
+ }
369
381
return EScan::Final;
370
382
}
371
383
++Round;
@@ -391,6 +403,8 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
391
403
EScan Feed (TArrayRef<const TCell> key, const TRow& row) noexcept final
392
404
{
393
405
LOG_T (" Feed " << Debug ());
406
+ ++ReadRows;
407
+ ReadBytes += CountBytes (key, row);
394
408
switch (State) {
395
409
case EState::SAMPLE:
396
410
return FeedSample (row);
@@ -467,8 +481,6 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
467
481
{
468
482
Y_ASSERT (row.Size () == 1 );
469
483
const auto embedding = row.Get (0 ).AsRef ();
470
- ReadStats.Rows += 1 ;
471
- ReadStats.Bytes += embedding.size (); // TODO(mbkkt) add some constant overhead?
472
484
if (!this ->IsExpectedSize (embedding)) {
473
485
return EScan::Feed;
474
486
}
@@ -495,14 +507,14 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
495
507
EScan FeedKMeans (const TRow& row) noexcept
496
508
{
497
509
Y_ASSERT (row.Size () == 1 );
498
- const ui32 pos = FeedEmbedding (*this , Clusters, row, 0 , ReadStats );
510
+ const ui32 pos = FeedEmbedding (*this , Clusters, row, 0 );
499
511
AggregateToCluster (pos, row.Get (0 ).Data ());
500
512
return EScan::Feed;
501
513
}
502
514
503
515
EScan FeedUploadMain2Build (TArrayRef<const TCell> key, const TRow& row) noexcept
504
516
{
505
- const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos, ReadStats );
517
+ const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos);
506
518
if (pos > K) {
507
519
return EScan::Feed;
508
520
}
@@ -512,7 +524,7 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
512
524
513
525
EScan FeedUploadMain2Posting (TArrayRef<const TCell> key, const TRow& row) noexcept
514
526
{
515
- const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos, ReadStats );
527
+ const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos);
516
528
if (pos > K) {
517
529
return EScan::Feed;
518
530
}
@@ -522,7 +534,7 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
522
534
523
535
EScan FeedUploadBuild2Build (TArrayRef<const TCell> key, const TRow& row) noexcept
524
536
{
525
- const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos, ReadStats );
537
+ const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos);
526
538
if (pos > K) {
527
539
return EScan::Feed;
528
540
}
@@ -532,7 +544,7 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation<
532
544
533
545
EScan FeedUploadBuild2Posting (TArrayRef<const TCell> key, const TRow& row) noexcept
534
546
{
535
- const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos, ReadStats );
547
+ const ui32 pos = FeedEmbedding (*this , Clusters, row, EmbeddingPos);
536
548
if (pos > K) {
537
549
return EScan::Feed;
538
550
}
0 commit comments