Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ydb/core/blobstorage/nodewarden/distconf_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace NKikimr::NStorage {
if (!fetched) { // fill in 'to-be-fetched' version of config with version incremented by one
try {
auto metadata = NYamlConfig::GetMainMetadata(yaml);
metadata.Cluster = metadata.Cluster.value_or("unknown"); // TODO: fix this
metadata.Cluster = metadata.Cluster.value_or(AppData()->ClusterName);
metadata.Version = metadata.Version.value_or(0) + 1;
temp = NYamlConfig::ReplaceMetadata(yaml, metadata);
} catch (const std::exception& ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ namespace NKikimr::NStorage {
void TInvokeRequestHandlerActor::FetchStorageConfig(bool manual, bool fetchMain, bool fetchStorage) {
if (!Self->StorageConfig) {
FinishWithError(TResult::ERROR, "no agreed StorageConfig");
} else if (!Self->MainConfigFetchYaml) {
} else if (!Self->MainConfigYaml) {
FinishWithError(TResult::ERROR, "no stored YAML for storage config");
} else {
auto ev = PrepareResult(TResult::OK, std::nullopt);
auto *record = &ev->Record;
auto *res = record->MutableFetchStorageConfig();
if (fetchMain) {
res->SetYAML(Self->MainConfigFetchYaml);
res->SetYAML(Self->MainConfigYaml);
}
if (fetchStorage && Self->StorageConfigYaml) {
auto metadata = NYamlConfig::GetStorageMetadata(*Self->StorageConfigYaml);
metadata.Cluster = metadata.Cluster.value_or("unknown"); // TODO: fix this
metadata.Version = metadata.Version.value_or(0) + 1;
res->SetStorageYAML(NYamlConfig::ReplaceMetadata(*Self->StorageConfigYaml, metadata));
res->SetStorageYAML(*Self->StorageConfigYaml);
}

if (manual) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/cms/console/console_configs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void TConfigsManager::ReplaceMainConfigMetadata(const TString &config, bool forc
try {
if (!force) {
auto metadata = NYamlConfig::GetMainMetadata(config);
opCtx.Cluster = metadata.Cluster.value_or(TString("unknown"));
opCtx.Cluster = metadata.Cluster.value_or(ClusterName);
opCtx.Version = metadata.Version.value_or(0);
} else {
opCtx.Cluster = ClusterName;
Expand Down
5 changes: 2 additions & 3 deletions ydb/core/mind/bscontroller/console_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,16 @@ namespace NKikimr::NBsController {
response->Record.SetErrorReason("configuration is locked by distconf");
} else if (Self.StorageYamlConfig) {
if (record.GetDedicatedStorageSection()) {
// TODO(alexvru): increment generation
response->Record.SetStorageYaml(*Self.StorageYamlConfig);
}
if (record.GetDedicatedClusterSection() && Self.YamlConfig) {
const auto& [yaml, configVersion, yamlReturnedByFetch] = *Self.YamlConfig;
response->Record.SetClusterYaml(yamlReturnedByFetch);
response->Record.SetClusterYaml(yaml);
}
} else {
if (!record.GetDedicatedClusterSection() && !record.GetDedicatedStorageSection() && Self.YamlConfig) {
const auto& [yaml, configVersion, yamlReturnedByFetch] = *Self.YamlConfig;
response->Record.SetClusterYaml(yamlReturnedByFetch);
response->Record.SetClusterYaml(yaml);
}
}
auto h = std::make_unique<IEventHandle>(ev->Sender, Self.SelfId(), response.release(), 0, ev->Cookie);
Expand Down
3 changes: 1 addition & 2 deletions ydb/services/config/bsconfig_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,12 @@ selector_config: []
port: 12001
host_config_id: 2
)";
TString yamlConfigExpected = SubstGlobalCopy(yamlConfig, "version: 0", "version: 1");
ReplaceConfig(server.GetChannel(), yamlConfig, std::nullopt, std::nullopt, false);
std::optional<TString> yamlConfigFetched, storageYamlConfigFetched;
FetchConfig(server.GetChannel(), false, false, yamlConfigFetched, storageYamlConfigFetched);
UNIT_ASSERT(yamlConfigFetched);
UNIT_ASSERT(!storageYamlConfigFetched);
UNIT_ASSERT_VALUES_EQUAL(yamlConfigExpected, *yamlConfigFetched);
UNIT_ASSERT_VALUES_EQUAL(yamlConfig, *yamlConfigFetched);
}

Y_UNIT_TEST(FetchConfig) {
Expand Down
1 change: 0 additions & 1 deletion ydb/tests/functional/config/test_config_with_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ def test_config_stored_in_config_store(self):

for node in self.cluster.nodes.values():
node_config = node.read_node_config()
node_config['metadata']['version'] = get_config_version(yaml.dump(node_config)) + 1
assert_that(
yaml.dump(yaml.safe_load(fetched_config), sort_keys=True) ==
yaml.dump(yaml.safe_load(yaml.dump(node_config)), sort_keys=True)
Expand Down
Loading