diff options
author | Олег <150132506+iddqdex@users.noreply.github.com> | 2025-07-21 23:32:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-21 20:32:57 +0000 |
commit | b0c580550b8534f76b2268d4c82ca0af396ecdcc (patch) | |
tree | bf79984b75c219697ccfcdf38e888338255f022b | |
parent | 7832c40f62a7572f0f21912246a8a620c3b0f6d4 (diff) | |
download | ydb-b0c580550b8534f76b2268d4c82ca0af396ecdcc.tar.gz |
Check if tables exitst before init workloads (#21455)
Co-authored-by: Nikolay Perfilov <pnv1@yandex-team.ru>
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_workload.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp b/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp index 4a0011aeb90..bb634174755 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp @@ -501,6 +501,16 @@ int TWorkloadCommandInit::DoRun(NYdbWorkload::IWorkloadQueryGenerator& workloadG if (DryRun) { Cout << ddlQueries << Endl; } else { + TVector<TString> existPaths; + for (const auto& path: workloadGen.GetCleanPaths()) { + const auto fullPath = config.Database + "/" + path.c_str(); + if (SchemeClient->DescribePath(fullPath).GetValueSync().IsSuccess()) { + existPaths.emplace_back(path); + } + } + if (existPaths) { + throw yexception() << "Paths " << JoinSeq(", ", existPaths) << " already exist. Use 'ydb wokload " << Params.GetWorkloadName() << " clean' command or '--clear' option of 'init' command to cleanup tables."; + } auto result = TableClient->RetryOperationSync([ddlQueries](NTable::TSession session) { return session.ExecuteSchemeQuery(ddlQueries.c_str()).GetValueSync(); }); |