Skip to content

Commit af288e5

Browse files
authored
YQ-4207 used database name from table by default (#16297)
1 parent e383618 commit af288e5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ydb/core/fq/libs/compute/ydb/control_plane/compute_database_control_plane_service.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,13 @@ class TCreateDatabaseRequestActor : public NActors::TActorBootstrapped<TCreateDa
289289
void FillRequest(TEvYdbCompute::TEvCreateDatabaseRequest::TPtr& ev, const NConfig::TComputeDatabaseConfig& config) {
290290
NYdb::NFq::TScope scope(ev.Get()->Get()->Scope);
291291
ev.Get()->Get()->BasePath = config.GetControlPlaneConnection().GetDatabase();
292-
const TString databaseName = TStringBuilder{} << Config.GetYdb().GetControlPlane().GetDatabasePrefix() << (config.GetId() ? config.GetId() + "_" : TString{}) << scope.ParseFolder();
293-
ev.Get()->Get()->Path = config.GetTenant() ? config.GetTenant() + "/" + databaseName: databaseName;
292+
293+
const auto& tenant = config.GetTenant();
294+
if (const auto& previousPath = Result.connection().database(); previousPath && (!tenant || previousPath.StartsWith(tenant + "/"))) {
295+
ev.Get()->Get()->Path = previousPath;
296+
} else {
297+
ev.Get()->Get()->Path = TStringBuilder() << (tenant ? tenant + "/" : TString{}) << Config.GetYdb().GetControlPlane().GetDatabasePrefix() << (config.GetId() ? config.GetId() + "_" : TString{}) << scope.ParseFolder();
298+
}
294299
}
295300

296301
private:

0 commit comments

Comments
 (0)