Skip to content

Commit

Permalink
YQ WM fixed cleanup table retries (#8369)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA authored Aug 28, 2024
1 parent b7f353a commit 9616f55
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions ydb/core/kqp/workload_service/tables/table_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,15 @@ class TCleanupTablesActor : public TSchemeActorBase<TCleanupTablesActor> {

TablePathsToCheck.clear();
for (const auto& result : results) {
const TString& path = CanonizePath(result.Path);
LOG_D("Describe table " << path << " status " << result.Status);
const TString& fullPath = CanonizePath(result.Path);
LOG_D("Describe table " << fullPath << " status " << result.Status);

std::pair<TString, TString> pathPair;
if (TString error; !TrySplitPathByDb(fullPath, AppData()->TenantName, pathPair, error)) {
TablesExists = false;
AddError(TStringBuilder() << "Failed to describe table path " << fullPath << ", " << error);
continue;
}

switch (result.Status) {
case EStatus::Unknown:
Expand All @@ -188,20 +195,20 @@ class TCleanupTablesActor : public TSchemeActorBase<TCleanupTablesActor> {
case EStatus::AccessDenied:
case EStatus::RedirectLookupError:
TablesExists = false;
AddError(TStringBuilder() << "Failed to describe table path " << path << ", " << result.Status);
AddError(TStringBuilder() << "Failed to describe table path " << fullPath << ", " << result.Status);
break;
case EStatus::LookupError:
RetryPathCheck(result.Path, result.Status);
RetryPathCheck(pathPair.second, result.Status);
break;
case EStatus::RootUnknown:
case EStatus::PathErrorUnknown:
case EStatus::TableCreationNotComplete:
TablesExists = false;
break;
case EStatus::Ok:
LOG_D("Start cleanup for table " << path);
LOG_D("Start cleanup for table " << fullPath);
CleanupQueriesInFlight++;
Register(new TCleanupTablesRetryQuery(SelfId(), path));
Register(new TCleanupTablesRetryQuery(SelfId(), fullPath));
break;
}
}
Expand Down Expand Up @@ -251,14 +258,14 @@ class TCleanupTablesActor : public TSchemeActorBase<TCleanupTablesActor> {
}

private:
void RetryPathCheck(const TVector<TString>& path, EStatus status) {
if (TablePathsToCheck.empty() && !ScheduleRetry(TStringBuilder() << "Retry " << status << " for table " << CanonizePath(path))) {
void RetryPathCheck(const TString& path, EStatus status) {
if (TablePathsToCheck.empty() && !ScheduleRetry(TStringBuilder() << "Retry " << status << " for table " << path)) {
TablesExists = false;
AddError(TStringBuilder() << "Retry limit exceeded for table " << CanonizePath(path) << ", " << status);
AddError(TStringBuilder() << "Retry limit exceeded for table " << path << ", " << status);
return;
}

TablePathsToCheck.emplace_back(path);
TablePathsToCheck.emplace_back(SplitPath(path));
}

template <typename TMessage>
Expand Down

0 comments on commit 9616f55

Please sign in to comment.