Skip to content

Commit

Permalink
Merge 07fff54 into a456eb6
Browse files Browse the repository at this point in the history
  • Loading branch information
zverevgeny authored Jan 31, 2024
2 parents a456eb6 + 07fff54 commit 27af424
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
12 changes: 0 additions & 12 deletions ydb/library/yql/dq/actors/compute/dq_async_compute_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,18 +461,6 @@ class TDqAsyncComputeActor : public TDqComputeActorBase<TDqAsyncComputeActor, TC
return inputChannel->FreeSpace;
}

TGuard<NKikimr::NMiniKQL::TScopedAlloc> BindAllocator() override {
return TypeEnv->BindAllocator();
}

std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> MaybeBindAllocator() override {
std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> guard;
if (TypeEnv) {
guard.emplace(TypeEnv->BindAllocator());
}
return guard;
}

void OnTaskRunnerCreated(NTaskRunnerActor::TEvTaskRunnerCreateFinished::TPtr& ev) {
const auto& secureParams = ev->Get()->SecureParams;
const auto& taskParams = ev->Get()->TaskParams;
Expand Down
12 changes: 4 additions & 8 deletions ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
}

{
auto guard = MaybeBindAllocator(); // Source/Sink could destroy mkql values inside PassAway, which requires allocator to be bound
auto guard = BindAllocator(); // Source/Sink could destroy mkql values inside PassAway, which requires allocator to be bound

for (auto& [_, source] : SourcesMap) {
if (source.Actor) {
Expand Down Expand Up @@ -1087,12 +1087,8 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
TerminateSources(TIssues({TIssue(message)}), success);
}

virtual TGuard<NKikimr::NMiniKQL::TScopedAlloc> BindAllocator() {
return TaskRunner->BindAllocator();
}

virtual std::optional<TGuard<NKikimr::NMiniKQL::TScopedAlloc>> MaybeBindAllocator() {
return TaskRunner->BindAllocator();
TGuard<NKikimr::NMiniKQL::TScopedAlloc> BindAllocator() {
return Guard(GetAllocator());
}

virtual bool SayHelloOnBootstrap() {
Expand Down Expand Up @@ -1503,7 +1499,7 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
.TypeEnv = typeEnv,
.HolderFactory = holderFactory,
.TaskCounters = TaskCounters,
.Alloc = TaskRunner ? Alloc : nullptr,
.Alloc = Alloc,
.MemoryQuotaManager = MemoryLimits.MemoryQuotaManager,
.SourceSettings = (!settings.empty() ? settings.at(inputIndex) : nullptr),
.Arena = Task.GetArena(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ class TDqSyncComputeActorBase: public TDqComputeActorBase<TDerived, TComputeActo
void PrepareTaskRunner(const IDqTaskRunnerExecutionContext& execCtx) {
YQL_ENSURE(this->TaskRunner);

auto guard = this->TaskRunner->BindAllocator(this->MemoryQuota->GetMkqlMemoryLimit());
auto guard = TBase::BindAllocator();
auto* alloc = guard.GetMutex();
alloc->SetLimit(this->MemoryQuota->GetMkqlMemoryLimit());

this->MemoryQuota->TrySetIncreaseMemoryLimitCallback(alloc);

Expand Down

0 comments on commit 27af424

Please sign in to comment.