Skip to content

Rename config-store to config-dir #14998

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
Feb 25, 2025
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/node_warden.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace NKikimr {
NKikimrConfig::TStaticNameserviceConfig NameserviceConfig;
std::optional<NKikimrConfig::TDomainsConfig> DomainsConfig;
std::optional<NKikimrConfig::TSelfManagementConfig> SelfManagementConfig;
TString ConfigStorePath;
TString ConfigDirPath;
std::optional<NKikimrBlobStorage::TYamlConfig> YamlConfig;
TString StartupConfigYaml;
std::optional<TString> StartupStorageYaml;
Expand Down
14 changes: 7 additions & 7 deletions ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ void TNodeWarden::ProcessShredStatus(ui64 cookie, ui64 generation, std::optional

void TNodeWarden::PersistConfig(std::optional<TString> mainYaml, ui64 mainYamlVersion, std::optional<TString> storageYaml,
std::optional<ui64> storageYamlVersion) {
if (!Cfg->ConfigStorePath) {
if (!Cfg->ConfigDirPath) {
// no storage directory specified
return;
} else if (auto *appData = AppData(); appData->DynamicNameserviceConfig &&
Expand All @@ -658,7 +658,7 @@ void TNodeWarden::PersistConfig(std::optional<TString> mainYaml, ui64 mainYamlVe
}

struct TSaveContext {
TString ConfigStorePath;
TString ConfigDirPath;
std::optional<TString> MainYaml;
ui64 MainYamlVersion;
std::optional<TString> StorageYaml;
Expand All @@ -669,7 +669,7 @@ void TNodeWarden::PersistConfig(std::optional<TString> mainYaml, ui64 mainYamlVe
};

auto saveCtx = std::make_shared<TSaveContext>(TSaveContext{
.ConfigStorePath = Cfg->ConfigStorePath,
.ConfigDirPath = Cfg->ConfigDirPath,
.MainYaml = std::move(mainYaml),
.MainYamlVersion = mainYamlVersion,
.StorageYaml = std::move(storageYaml),
Expand All @@ -682,16 +682,16 @@ void TNodeWarden::PersistConfig(std::optional<TString> mainYaml, ui64 mainYamlVe
EnqueueSyncOp([this, saveCtx](const TActorContext&) {
bool success = true;
try {
MakePathIfNotExist(saveCtx->ConfigStorePath.c_str());
MakePathIfNotExist(saveCtx->ConfigDirPath.c_str());
} catch (const yexception& e) {
STLOG(PRI_ERROR, BS_NODE, NW91, "Failed to create config store path", (Error, e.what()));
success = false;
}

auto saveConfig = [&](const TString& yaml, const TString& configFileName) -> bool {
try {
TString tempPath = TStringBuilder() << saveCtx->ConfigStorePath << "/temp_" << configFileName;
TString configPath = TStringBuilder() << saveCtx->ConfigStorePath << "/" << configFileName;
TString tempPath = TStringBuilder() << saveCtx->ConfigDirPath << "/temp_" << configFileName;
TString configPath = TStringBuilder() << saveCtx->ConfigDirPath << "/" << configFileName;

{
TFileOutput tempFile(tempPath);
Expand Down Expand Up @@ -725,7 +725,7 @@ void TNodeWarden::PersistConfig(std::optional<TString> mainYaml, ui64 mainYamlVe
}

if (saveCtx->DeleteStorage) {
std::filesystem::remove(std::filesystem::path(saveCtx->ConfigStorePath.c_str()) / StorageConfigFileName);
std::filesystem::remove(std::filesystem::path(saveCtx->ConfigDirPath.c_str()) / StorageConfigFileName);
} else if (success && saveCtx->UpdateStorage) {
success = saveConfig(*saveCtx->StorageYaml, StorageConfigFileName);
if (success) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/blobstorage/nodewarden/node_warden_pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void TNodeWarden::SendRegisterNode() {
}
}

if (!Cfg->ConfigStorePath.empty() && YamlConfig) {
if (!Cfg->ConfigDirPath.empty() && YamlConfig) {
ev->Record.SetMainConfigVersion(YamlConfig->GetMainConfigVersion());
ev->Record.SetMainConfigHash(NYaml::GetConfigHash(YamlConfig->GetMainConfig()));
if (YamlConfig->HasStorageConfigVersion()) {
Expand Down
10 changes: 5 additions & 5 deletions ydb/core/config/init/init_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ struct TCommonAppOptions {
TString PathToInterconnectPrivateKeyFile;
TString PathToInterconnectCaFile;
TString YamlConfigFile;
TString ConfigStorePath;
TString ConfigDirPath;
bool SysLogEnabled = false;
bool TcpEnabled = false;
bool SuppressVersionCheck = false;
Expand Down Expand Up @@ -427,7 +427,7 @@ struct TCommonAppOptions {
opts.AddLongOption("body", "body name (used to describe dynamic node location)")
.RequiredArgument("NUM").StoreResult(&Body);
opts.AddLongOption("yaml-config", "Yaml config").OptionalArgument("PATH").StoreResult(&YamlConfigFile);
opts.AddLongOption("config-store", "Directory to store Yaml config").RequiredArgument("PATH").StoreResult(&ConfigStorePath);
opts.AddLongOption("config-dir", "Directory to store Yaml config").RequiredArgument("PATH").StoreResult(&ConfigDirPath);

opts.AddLongOption("tiny-mode", "Start in a tiny mode")
.NoArgument().SetFlag(&TinyMode);
Expand Down Expand Up @@ -1068,10 +1068,10 @@ class TInitialConfiguratorImpl
TString storageYamlConfigFile;
bool loadedFromStore = false;

if (CommonAppOptions.ConfigStorePath) {
AppConfig.SetConfigStorePath(CommonAppOptions.ConfigStorePath);
if (CommonAppOptions.ConfigDirPath) {
AppConfig.SetConfigDirPath(CommonAppOptions.ConfigDirPath);

auto dir = fs::path(CommonAppOptions.ConfigStorePath.c_str());
auto dir = fs::path(CommonAppOptions.ConfigDirPath.c_str());

if (auto path = dir / STORAGE_CONFIG_NAME; fs::is_regular_file(path)) {
storageYamlConfigFile = path.c_str();
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/driver_lib/run/kikimr_services_initializers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,8 @@ void TBSNodeWardenInitializer::InitializeServices(NActors::TActorSystemSetup* se
nodeWardenConfig->SelfManagementConfig.emplace(Config.GetSelfManagementConfig());
}

if (Config.HasConfigStorePath()) {
nodeWardenConfig->ConfigStorePath = Config.GetConfigStorePath();
if (Config.HasConfigDirPath()) {
nodeWardenConfig->ConfigDirPath = Config.GetConfigDirPath();
}

if (Config.HasStoredConfigYaml()) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/protos/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,7 @@ message TAppConfig {
optional TConfigVersion Version = 102;
repeated TLabel Labels = 103;

optional string ConfigStorePath = 104;
optional string ConfigDirPath = 104;
optional NKikimrBlobStorage.TYamlConfig StoredConfigYaml = 105;
optional string StartupConfigYaml = 107;
optional string StartupStorageYaml = 108;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_generate_dynamic_config(self):
)


class TestGenerateDynamicConfigFromConfigStore(AbstractKiKiMRTest):
class TestGenerateDynamicConfigFromConfigDir(AbstractKiKiMRTest):
erasure = Erasure.BLOCK_4_2

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion ydb/tests/library/harness/kikimr_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __make_run_command(self):
command.append("--suppress-version-check")

if self.__configurator.use_config_store:
command.append("--config-store=%s" % self.__config_path)
command.append("--config-dir=%s" % self.__config_path)
else:
command.append("--yaml-config=%s" % os.path.join(self.__config_path, "config.yaml"))

Expand Down
Loading