Skip to content

Commit b1afccd

Browse files
committed
YQ WM fixed databse checking (ydb-platform#8251)
1 parent 0559195 commit b1afccd

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

ydb/core/kqp/workload_service/actors/scheme_actors.cpp

+16-4
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,12 @@ class TDatabaseFetcherActor : public TSchemeActorBase<TDatabaseFetcherActor> {
483483
}
484484
return;
485485
case EStatus::Ok:
486+
if (!IsSubDomainPath(result)) {
487+
Reply(Ydb::StatusIds::UNSUPPORTED, TStringBuilder() << "Invalid database path " << Database << ", please check the correctness of the path");
488+
return;
489+
}
486490
if (result.DomainInfo) {
487491
Serverless = result.DomainInfo->IsServerless();
488-
if (result.Self->Info.GetPathId() != result.DomainInfo->DomainKey.LocalPathId) {
489-
Reply(Ydb::StatusIds::UNSUPPORTED, TStringBuilder() << "Invalid database " << Database << ", domain path id is different");
490-
return;
491-
}
492492
}
493493
Reply(Ydb::StatusIds::SUCCESS);
494494
return;
@@ -541,6 +541,18 @@ class TDatabaseFetcherActor : public TSchemeActorBase<TDatabaseFetcherActor> {
541541
PassAway();
542542
}
543543

544+
static bool IsSubDomainPath(const NSchemeCache::TSchemeCacheNavigate::TEntry& entry) {
545+
switch (entry.Kind) {
546+
case NSchemeCache::TSchemeCacheNavigate::EKind::KindSubdomain:
547+
case NSchemeCache::TSchemeCacheNavigate::EKind::KindExtSubdomain:
548+
return true;
549+
case NSchemeCache::TSchemeCacheNavigate::EKind::KindPath:
550+
return entry.Self->Info.GetPathId() == NSchemeShard::RootPathId;
551+
default:
552+
return false;
553+
}
554+
}
555+
544556
private:
545557
const TActorId ReplyActorId;
546558
const TString Database;

0 commit comments

Comments
 (0)