Skip to content

Commit f4e6b30

Browse files
iddqdexblinkov
authored andcommitted
Fix data race (#14517)
1 parent 33c05c4 commit f4e6b30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ydb/public/lib/ydb_cli/commands/ydb_workload_import.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ int TWorkloadCommandImport::TUploadCommand::DoRun(NYdbWorkload::IWorkloadQueryGe
6464
const auto start = Now();
6565
Cout << "Fill table " << dataGen->GetName() << "..." << Endl;
6666
Bar = MakeHolder<TProgressBar>(dataGen->GetSize());
67-
TVector<NThreading::TFuture<void>> sendings;
6867
for (ui32 t = 0; t < UploadParams.Threads; ++t) {
69-
sendings.push_back(NThreading::Async([this, dataGen] () {
68+
pool.SafeAddFunc([this, dataGen] () {
7069
ProcessDataGenerator(dataGen);
71-
}, pool));
70+
});
7271
}
73-
NThreading::WaitAll(sendings).Wait();
72+
pool.Stop();
7473
const bool wereErrors = AtomicGet(ErrorsCount);
7574
with_lock(Lock) {
7675
Cout << "Fill table " << dataGen->GetName() << " "<< (wereErrors ? "Failed" : "OK" ) << " " << Bar->GetCurProgress() << " / " << Bar->GetCapacity() << " (" << (Now() - start) << ")" << Endl;
@@ -79,6 +78,7 @@ int TWorkloadCommandImport::TUploadCommand::DoRun(NYdbWorkload::IWorkloadQueryGe
7978
break;
8079
}
8180
}
81+
TableClient->Stop();
8282
return AtomicGet(ErrorsCount) ? EXIT_FAILURE : EXIT_SUCCESS;
8383
}
8484
class TWorkloadCommandImport::TUploadCommand::TDbWriter: public IWriter {

0 commit comments

Comments
 (0)