Skip to content

Commit 2d9e5a2

Browse files
authored
Separate build columns actor activity (#7260)
1 parent a397003 commit 2d9e5a2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

ydb/core/tx/datashard/build_index.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ class TBufferData: public IStatHolder, public TNonCopyable {
223223
TSerializedCellVec LastKey;
224224
};
225225

226-
class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
226+
template <NKikimrServices::TActivity::EType Activity>
227+
class TBuildScanUpload: public TActor<TBuildScanUpload<Activity>>, public NTable::IScan {
228+
using TThis = TBuildScanUpload<Activity>;
229+
using TBase = TActor<TThis>;
230+
227231
protected:
228232
const TUploadLimits Limits;
229233

@@ -264,7 +268,7 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
264268
const TSerializedTableRange& range,
265269
const TUserTable& tableInfo,
266270
TUploadLimits limits)
267-
: TActor(&TThis::StateWork)
271+
: TBase(&TThis::StateWork)
268272
, Limits(limits)
269273
, BuildIndexId(buildIndexId)
270274
, TargetTable(target)
@@ -300,8 +304,8 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
300304
}
301305

302306
public:
303-
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
304-
return NKikimrServices::TActivity::BUILD_INDEX_SCAN_ACTOR;
307+
static constexpr auto ActorActivityType() {
308+
return Activity;
305309
}
306310

307311
~TBuildScanUpload() override = default;
@@ -354,7 +358,7 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
354358
}
355359

356360
TAutoPtr<IDestructable> Finish(EAbort abort) noexcept override {
357-
auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
361+
auto ctx = TActivationContext::AsActorContext().MakeFor(TBase::SelfId());
358362

359363
if (Uploader) {
360364
TAutoPtr<TEvents::TEvPoisonPill> poison = new TEvents::TEvPoisonPill;
@@ -386,7 +390,7 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
386390
LOG_D("Finish " << Debug());
387391

388392
Driver = nullptr;
389-
PassAway();
393+
this->PassAway();
390394
return nullptr;
391395
}
392396

@@ -519,17 +523,17 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
519523
LOG_D("Upload, last key " << DebugPrintPoint(KeyTypes, WriteBuf.GetLastKey().GetCells(), *AppData()->TypeRegistry) << " " << Debug());
520524

521525
auto actor = NTxProxy::CreateUploadRowsInternal(
522-
SelfId(), TargetTable,
526+
TBase::SelfId(), TargetTable,
523527
UploadColumnsTypes,
524528
WriteBuf.GetRowsData(),
525529
UploadMode,
526530
true /*writeToPrivateTable*/);
527531

528-
Uploader = TActivationContext::AsActorContext().MakeFor(SelfId()).Register(actor);
532+
Uploader = TActivationContext::AsActorContext().MakeFor(TBase::SelfId()).Register(actor);
529533
}
530534
};
531535

532-
class TBuildIndexScan final: public TBuildScanUpload {
536+
class TBuildIndexScan final: public TBuildScanUpload<NKikimrServices::TActivity::BUILD_INDEX_SCAN_ACTOR> {
533537
const ui32 TargetDataColumnPos; // positon of first data column in target table
534538

535539
public:
@@ -563,7 +567,7 @@ class TBuildIndexScan final: public TBuildScanUpload {
563567
}
564568
};
565569

566-
class TBuildColumnsScan final: public TBuildScanUpload {
570+
class TBuildColumnsScan final: public TBuildScanUpload<NKikimrServices::TActivity::BUILD_COLUMNS_SCAN_ACTOR> {
567571
TString ValueSerialized;
568572

569573
public:

ydb/library/services/services.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,5 +1046,6 @@ message TActivity {
10461046
REPLICATION_CONTROLLER_TARGET_DESCRIBER = 642;
10471047
SAMPLE_K_SCAN_ACTOR = 643;
10481048
MEMORY_CONTROLLER = 644;
1049+
BUILD_COLUMNS_SCAN_ACTOR = 645;
10491050
};
10501051
};

0 commit comments

Comments
 (0)