From 54f9570401e65e17e976b6eae25a0e06d9d96839 Mon Sep 17 00:00:00 2001 From: Nikolay Perfilov Date: Thu, 13 Feb 2025 18:05:43 +0300 Subject: [PATCH] Fix saving progress if batch was not uploaded (#14537) --- ydb/apps/ydb/CHANGELOG.md | 1 + ydb/public/lib/ydb_cli/import/import.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ydb/apps/ydb/CHANGELOG.md b/ydb/apps/ydb/CHANGELOG.md index 79eaef374c66..0446f539268a 100644 --- a/ydb/apps/ydb/CHANGELOG.md +++ b/ydb/apps/ydb/CHANGELOG.md @@ -1,4 +1,5 @@ * Fixed a bug where `ydb auth get-token` command tried to authenticate twice: while listing andpoints and while executing actual token request. +* Fixed a bug where `ydb import file csv` command was saving progress even if a batch upload had been failed. * Include coordination nodes in local backups (`ydb tools dump` and `ydb tools restore`). Rate limiters that utilize the coordination node are saved in the coordination node's backup folder, preserving the existing path hierarchy. * Fixed a bug where some errors could be ignored when restoring from a local backup. * Added `ydb workload log import generator` command. diff --git a/ydb/public/lib/ydb_cli/import/import.cpp b/ydb/public/lib/ydb_cli/import/import.cpp index 98607182c993..60ce65143a4b 100644 --- a/ydb/public/lib/ydb_cli/import/import.cpp +++ b/ydb/public/lib/ydb_cli/import/import.cpp @@ -1005,10 +1005,12 @@ TStatus TImportFileClient::TImpl::UpsertCsv(IInputStream& input, UpsertTValueBuffer(dbPath, std::move(buildFunc)) .Apply([&, batchStatus](const TAsyncStatus& asyncStatus) { jobInflightManager->ReleaseJob(); - batchStatus->Completed = true; - if (!FileProgressPool->AddFunc(saveProgressIfAny) && !Failed.exchange(true)) { - ErrorStatus = MakeHolder(MakeStatus(EStatus::INTERNAL_ERROR, - "Couldn't add worker func to save progress")); + if (asyncStatus.GetValueSync().IsSuccess()) { + batchStatus->Completed = true; + if (!FileProgressPool->AddFunc(saveProgressIfAny) && !Failed.exchange(true)) { + ErrorStatus = MakeHolder(MakeStatus(EStatus::INTERNAL_ERROR, + "Couldn't add worker func to save progress")); + } } return asyncStatus; });