Skip to content

Check yaml version in BSC mode #15366

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

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions ydb/core/mind/bscontroller/console_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,34 @@ namespace NKikimr::NBsController {
PendingYamlConfig.reset();
}

if (PendingYamlConfig && !NYamlConfig::IsMainConfig(*PendingYamlConfig)) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
"cluster YAML config is not of MainConfig kind");
if (PendingYamlConfig) {
const ui64 expected = Self.YamlConfig
? GetVersion(*Self.YamlConfig) + 1
: 0;

if (!NYamlConfig::IsMainConfig(*PendingYamlConfig)) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
"cluster YAML config is not of MainConfig kind");
} else if (const auto& meta = NYamlConfig::GetMainMetadata(*PendingYamlConfig); meta.Version != expected) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
TStringBuilder() << "cluster YAML config version mismatch got# " << meta.Version
<< " expected# " << expected);
}
}

if (PendingStorageYamlConfig && *PendingStorageYamlConfig && !NYamlConfig::IsStorageConfig(**PendingStorageYamlConfig)) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
"storage YAML config is not of StorageConfig kind");
if (PendingStorageYamlConfig && *PendingStorageYamlConfig) {
const ui64 expected = Self.StorageYamlConfig
? Self.StorageYamlConfigVersion + 1
: 0;

if (!NYamlConfig::IsStorageConfig(**PendingStorageYamlConfig)) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
"storage YAML config is not of StorageConfig kind");
} else if (const auto& meta = NYamlConfig::GetStorageMetadata(**PendingStorageYamlConfig); meta.Version != expected) {
return IssueGRpcResponse(NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest,
TStringBuilder() << "storage YAML config version mismatch got# " << meta.Version
<< " expected# " << expected);
}
}

if (record.GetSkipConsoleValidation() || !record.HasClusterYaml()) {
Expand Down
Loading