Skip to content

Separate build columns actor activity #7260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions ydb/core/tx/datashard/build_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ class TBufferData: public IStatHolder, public TNonCopyable {
TSerializedCellVec LastKey;
};

class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
template <NKikimrServices::TActivity::EType Activity>
class TBuildScanUpload: public TActor<TBuildScanUpload<Activity>>, public NTable::IScan {
using TThis = TBuildScanUpload<Activity>;
using TBase = TActor<TThis>;

protected:
const TUploadLimits Limits;

Expand Down Expand Up @@ -264,7 +268,7 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
const TSerializedTableRange& range,
const TUserTable& tableInfo,
TUploadLimits limits)
: TActor(&TThis::StateWork)
: TBase(&TThis::StateWork)
, Limits(limits)
, BuildIndexId(buildIndexId)
, TargetTable(target)
Expand Down Expand Up @@ -300,8 +304,8 @@ class TBuildScanUpload: public TActor<TBuildScanUpload>, public NTable::IScan {
}

public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::BUILD_INDEX_SCAN_ACTOR;
static constexpr auto ActorActivityType() {
return Activity;
}

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

TAutoPtr<IDestructable> Finish(EAbort abort) noexcept override {
auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
auto ctx = TActivationContext::AsActorContext().MakeFor(TBase::SelfId());

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

Driver = nullptr;
PassAway();
this->PassAway();
return nullptr;
}

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

auto actor = NTxProxy::CreateUploadRowsInternal(
SelfId(), TargetTable,
TBase::SelfId(), TargetTable,
UploadColumnsTypes,
WriteBuf.GetRowsData(),
UploadMode,
true /*writeToPrivateTable*/);

Uploader = TActivationContext::AsActorContext().MakeFor(SelfId()).Register(actor);
Uploader = TActivationContext::AsActorContext().MakeFor(TBase::SelfId()).Register(actor);
}
};

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

public:
Expand Down Expand Up @@ -563,7 +567,7 @@ class TBuildIndexScan final: public TBuildScanUpload {
}
};

class TBuildColumnsScan final: public TBuildScanUpload {
class TBuildColumnsScan final: public TBuildScanUpload<NKikimrServices::TActivity::BUILD_COLUMNS_SCAN_ACTOR> {
TString ValueSerialized;

public:
Expand Down
1 change: 1 addition & 0 deletions ydb/library/services/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@ message TActivity {
REPLICATION_CONTROLLER_TARGET_DESCRIBER = 642;
SAMPLE_K_SCAN_ACTOR = 643;
MEMORY_CONTROLLER = 644;
BUILD_COLUMNS_SCAN_ACTOR = 645;
};
};
Loading