-
Notifications
You must be signed in to change notification settings - Fork 695
YQ fixed kqprun grpc endpoints #19790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GrigoriyPA
wants to merge
1
commit into
ydb-platform:main
Choose a base branch
from
GrigoriyPA:YQ-fix-kqprun-grpc-endpoints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+46
−42
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,7 +198,7 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
return serverSettings; | ||
} | ||
|
||
void CreateTenant(Ydb::Cms::CreateDatabaseRequest&& request, const TString& relativePath, const TString& type, TStorageMeta::TTenant tenantInfo, ui32 grpcPort) { | ||
void CreateTenant(Ydb::Cms::CreateDatabaseRequest&& request, const TString& relativePath, const TString& type, TStorageMeta::TTenant tenantInfo) { | ||
const auto absolutePath = request.path(); | ||
const auto [it, inserted] = StorageMeta_.MutableTenants()->emplace(relativePath, tenantInfo); | ||
if (inserted || it->second.GetCreationInProgress()) { | ||
|
@@ -231,24 +231,14 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
Tenants_->Run(absolutePath, tenantInfo.GetNodesCount()); | ||
} | ||
} | ||
|
||
if (tenantInfo.GetType() != TStorageMeta::TTenant::SERVERLESS) { | ||
if (Settings_.GrpcEnabled) { | ||
Server_->EnableGRpc(grpcPort, GetNodeIndexForDatabase(absolutePath), absolutePath); | ||
} else if (Settings_.MonitoringEnabled) { | ||
ui32 nodeIndex = GetNodeIndexForDatabase(absolutePath); | ||
NActors::TActorId edgeActor = GetRuntime()->AllocateEdgeActor(nodeIndex); | ||
GetRuntime()->Register(NKikimr::CreateBoardPublishActor(NKikimr::MakeEndpointsBoardPath(absolutePath), "", edgeActor, 0, true), nodeIndex, GetRuntime()->GetAppData(nodeIndex).UserPoolId); | ||
} | ||
} | ||
} | ||
|
||
static void AddTenantStoragePool(Ydb::Cms::StorageUnits* storage, const TString& name) { | ||
storage->set_unit_kind(name); | ||
storage->set_count(1); | ||
} | ||
|
||
void CreateTenants(TPortGenerator& grpcPortGen) { | ||
void CreateTenants() { | ||
std::set<TString> sharedTenants; | ||
std::map<TString, TStorageMeta::TTenant> serverlessTenants; | ||
for (const auto& [tenantPath, tenantInfo] : Settings_.Tenants) { | ||
|
@@ -258,13 +248,13 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
switch (tenantInfo.GetType()) { | ||
case TStorageMeta::TTenant::DEDICATED: | ||
AddTenantStoragePool(request.mutable_resources()->add_storage_units(), tenantPath); | ||
CreateTenant(std::move(request), tenantPath, "dedicated", tenantInfo, grpcPortGen.GetPort()); | ||
CreateTenant(std::move(request), tenantPath, "dedicated", tenantInfo); | ||
break; | ||
|
||
case TStorageMeta::TTenant::SHARED: | ||
sharedTenants.emplace(tenantPath); | ||
AddTenantStoragePool(request.mutable_shared_resources()->add_storage_units(), tenantPath); | ||
CreateTenant(std::move(request), tenantPath, "shared", tenantInfo, grpcPortGen.GetPort()); | ||
CreateTenant(std::move(request), tenantPath, "shared", tenantInfo); | ||
break; | ||
|
||
case TStorageMeta::TTenant::SERVERLESS: | ||
|
@@ -292,12 +282,11 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
request.set_path(GetTenantPath(tenantPath)); | ||
request.mutable_serverless_resources()->set_shared_database_path(GetTenantPath(tenantInfo.GetSharedTenant())); | ||
ServerlessToShared_[request.path()] = request.serverless_resources().shared_database_path(); | ||
CreateTenant(std::move(request), tenantPath, "serverless", tenantInfo, 0); | ||
CreateTenant(std::move(request), tenantPath, "serverless", tenantInfo); | ||
} | ||
} | ||
|
||
void InitializeServer() { | ||
TPortGenerator grpcPortGen(PortManager, Settings_.FirstGrpcPort); | ||
void InitializeServer(TPortGenerator& grpcPortGen) { | ||
const ui32 domainGrpcPort = grpcPortGen.GetPort(); | ||
NKikimr::Tests::TServerSettings serverSettings = GetServerSettings(domainGrpcPort); | ||
|
||
|
@@ -316,7 +305,7 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
Client_->InitRootScheme(); | ||
|
||
Tenants_ = MakeHolder<NKikimr::Tests::TTenants>(Server_); | ||
CreateTenants(grpcPortGen); | ||
CreateTenants(); | ||
} | ||
|
||
void InitializeYqlLogger() { | ||
|
@@ -328,7 +317,7 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
NYql::NLog::InitLogger(NActors::CreateNullBackend()); | ||
} | ||
|
||
NThreading::TFuture<void> RunHealthCheck(const TString& database) const { | ||
NThreading::TFuture<void> InitializeTenantNodes(const TString& database, TPortGenerator& grpcPortGen) const { | ||
EHealthCheck level = Settings_.HealthCheckLevel; | ||
i32 nodesCount = Settings_.NodeCount; | ||
TVector<ui32> tenantNodesIdx; | ||
|
@@ -337,17 +326,29 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
nodesCount = tenantNodesIdx.size(); | ||
} | ||
|
||
const auto& absolutePath = NKikimr::CanonizePath(database); | ||
const TWaitResourcesSettings settings = { | ||
.ExpectedNodeCount = nodesCount, | ||
.HealthCheckLevel = level, | ||
.HealthCheckTimeout = Settings_.HealthCheckTimeout, | ||
.VerboseLevel = Settings_.VerboseLevel, | ||
.Database = NKikimr::CanonizePath(database) | ||
.Database = absolutePath | ||
}; | ||
|
||
std::vector<NThreading::TFuture<void>> futures; | ||
futures.reserve(nodesCount); | ||
for (i32 nodeIdx = 0; nodeIdx < nodesCount; ++nodeIdx) { | ||
const auto node = tenantNodesIdx ? tenantNodesIdx[nodeIdx] : nodeIdx; | ||
if (Settings_.GrpcEnabled) { | ||
if (node > 0) { | ||
// Port for first static node also used in cluster initialization | ||
Server_->EnableGRpc(grpcPortGen.GetPort(), node, absolutePath); | ||
} | ||
} else if (Settings_.MonitoringEnabled) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А тут точно должен быть |
||
NActors::TActorId edgeActor = GetRuntime()->AllocateEdgeActor(node); | ||
GetRuntime()->Register(NKikimr::CreateBoardPublishActor(NKikimr::MakeEndpointsBoardPath(absolutePath), "", edgeActor, 0, true), node, GetRuntime()->GetAppData(node).UserPoolId); | ||
} | ||
|
||
const auto promise = NThreading::NewPromise(); | ||
GetRuntime()->Register(CreateResourcesWaiterActor(promise, settings), tenantNodesIdx ? tenantNodesIdx[nodeIdx] : nodeIdx, GetRuntime()->GetAppData().SystemPoolId); | ||
futures.emplace_back(promise.GetFuture()); | ||
|
@@ -356,11 +357,13 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
return NThreading::WaitAll(futures); | ||
} | ||
|
||
void WaitResourcesPublishing() const { | ||
std::vector<NThreading::TFuture<void>> futures(1, RunHealthCheck(Settings_.DomainName)); | ||
void InitializeTenants(TPortGenerator& grpcPortGen) const { | ||
std::vector<NThreading::TFuture<void>> futures(1, InitializeTenantNodes(Settings_.DomainName, grpcPortGen)); | ||
futures.reserve(StorageMeta_.GetTenants().size() + 1); | ||
for (const auto& [tenantName, _] : StorageMeta_.GetTenants()) { | ||
futures.emplace_back(RunHealthCheck(GetTenantPath(tenantName))); | ||
for (const auto& [tenantName, tenantInfo] : StorageMeta_.GetTenants()) { | ||
if (tenantInfo.GetType() != TStorageMeta::TTenant::SERVERLESS) { | ||
futures.emplace_back(InitializeTenantNodes(GetTenantPath(tenantName), grpcPortGen)); | ||
} | ||
} | ||
|
||
try { | ||
|
@@ -375,9 +378,10 @@ class TYdbSetup::TImpl : public TKikimrSetupBase { | |
: Settings_(settings) | ||
, CoutColors_(NColorizer::AutoColors(Cout)) | ||
{ | ||
TPortGenerator grpcPortGen(PortManager, Settings_.FirstGrpcPort); | ||
InitializeYqlLogger(); | ||
InitializeServer(); | ||
WaitResourcesPublishing(); | ||
InitializeServer(grpcPortGen); | ||
InitializeTenants(grpcPortGen); | ||
|
||
if (Settings_.MonitoringEnabled && Settings_.VerboseLevel >= EVerbose::Info) { | ||
for (ui32 nodeIndex = 0; nodeIndex < Settings_.NodeCount; ++nodeIndex) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.