| 303 | } |
| 304 | |
| 305 | String 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 | } |
no test coverage detected