MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getKeeperPath

Function getKeeperPath

programs/keeper/Keeper.cpp:305–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305String getKeeperPath(Poco::Util::LayeredConfiguration & config)
306{
307 String path;
308 if (config.has("keeper_server.storage_path"))
309 {
310 path = config.getString("keeper_server.storage_path");
311 }
312 else if (config.has("keeper_server.log_storage_path"))
313 {
314 path = std::filesystem::path(config.getString("keeper_server.log_storage_path")).parent_path();
315 }
316 else if (config.has("keeper_server.snapshot_storage_path"))
317 {
318 path = std::filesystem::path(config.getString("keeper_server.snapshot_storage_path")).parent_path();
319 }
320 else if (std::filesystem::is_directory(std::filesystem::path{config.getString("path", DBMS_DEFAULT_PATH)} / "coordination"))
321 {
322 throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG,
323 "By default 'keeper_server.storage_path' could be assigned to {}, but the directory {} already exists. Please specify 'keeper_server.storage_path' in the keeper configuration explicitly",
324 KEEPER_DEFAULT_PATH, String{std::filesystem::path{config.getString("path", DBMS_DEFAULT_PATH)} / "coordination"});
325 }
326 else
327 {
328 path = KEEPER_DEFAULT_PATH;
329 }
330 return path;
331}
332
333
334}

Callers 1

mainMethod · 0.85

Calls 4

parent_pathMethod · 0.80
ExceptionClass · 0.50
hasMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected