Skip to content

Commit

Permalink
DqPqReadActorTest has been fixed (#6785)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorooleg authored Jul 18, 2024
1 parent b87f203 commit 302e204
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ydb/library/yql/providers/common/ut_helpers/dq_fake_ca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void TFakeActor::InitAsyncInput(IDqComputeActorAsyncInput* dqAsyncInput, IActor*
DqAsyncInputAsActor = dqAsyncInputAsActor;
}

void TFakeActor::Terminate() {
void TFakeActor::Terminate(std::shared_ptr<std::atomic<bool>> done) {
if (DqAsyncInputActorId) {
DqAsyncInput->PassAway();

Expand All @@ -71,6 +71,7 @@ void TFakeActor::Terminate() {
DqAsyncOutput = nullptr;
DqAsyncOutputAsActor = nullptr;
}
done->store(true);
}

TFakeActor::TAsyncOutputCallbacks& TFakeActor::GetAsyncOutputCallbacks() {
Expand Down Expand Up @@ -101,9 +102,14 @@ TFakeCASetup::TFakeCASetup()
}

TFakeCASetup::~TFakeCASetup() {
Execute([](TFakeActor& actor) {
actor.Terminate();
auto shouldStop = std::make_shared<std::atomic<bool>>();
Execute([shouldStop](TFakeActor& actor) {
actor.Terminate(shouldStop);
});

while (!*shouldStop) {
Sleep(TDuration::MilliSeconds(200));
}
}

void TFakeCASetup::AsyncOutputWrite(const TWriteValueProducer valueProducer, TMaybe<NDqProto::TCheckpoint> checkpoint, bool finish) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/yql/providers/common/ut_helpers/dq_fake_ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class TFakeActor : public NActors::TActor<TFakeActor> {

void InitAsyncOutput(IDqComputeActorAsyncOutput* dqAsyncOutput, IActor* dqAsyncOutputAsActor);
void InitAsyncInput(IDqComputeActorAsyncInput* dqAsyncInput, IActor* dqAsyncInputAsActor);
void Terminate();
void Terminate(std::shared_ptr<std::atomic<bool>> done);

TAsyncOutputCallbacks& GetAsyncOutputCallbacks();
NKikimr::NMiniKQL::THolderFactory& GetHolderFactory();
Expand Down

0 comments on commit 302e204

Please sign in to comment.