diff --git a/dbms/src/Common/DiskSpaceMonitor.cpp b/dbms/src/Common/DiskSpaceMonitor.cpp index 5ab6ce269c3..5b07e11f31b 100644 --- a/dbms/src/Common/DiskSpaceMonitor.cpp +++ b/dbms/src/Common/DiskSpaceMonitor.cpp @@ -161,7 +161,7 @@ void Reservation::update(UInt64 new_size) disk_ptr->reserved_bytes += size; } -DiskSelector::DiskSelector(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix, String default_path) +DiskSelector::DiskSelector(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix, const String & default_path) { Poco::Util::AbstractConfiguration::Keys keys; config.keys(config_prefix, keys); diff --git a/dbms/src/Common/DiskSpaceMonitor.h b/dbms/src/Common/DiskSpaceMonitor.h index 7b15dc12376..dccffd469de 100644 --- a/dbms/src/Common/DiskSpaceMonitor.h +++ b/dbms/src/Common/DiskSpaceMonitor.h @@ -111,10 +111,10 @@ public: UInt64 getAvailableSpace() const; }; - Disk(String name_, String path_, UInt64 keep_free_space_bytes_) - : name(std::move(name_)), - path(std::move(path_)), - keep_free_space_bytes(keep_free_space_bytes_) + Disk(const String & name_, const String & path_, UInt64 keep_free_space_bytes_) + : name(name_) + , path(path_) + , keep_free_space_bytes(keep_free_space_bytes_) { if (path.back() != '/') throw Exception("Disk path must ends with '/', but '" + path + "' doesn't.", ErrorCodes::LOGICAL_ERROR); @@ -129,8 +129,8 @@ public: /// Path on fs to disk const String & getPath() const { return path; } - /// Path to clickhouse data folder on this disk - String getClickHouseDataPath() const { return path + "clickhouse/data/"; } + /// Path to clickhouse data directory on this disk + String getClickHouseDataPath() const { return path + "data/"; } /// Amount of bytes which should be kept free on this disk UInt64 getKeepingFreeSpace() const { return keep_free_space_bytes; } @@ -206,7 +206,7 @@ class DiskSelector { public: DiskSelector(const Poco::Util::AbstractConfiguration & config, - const std::string & config_prefix, String default_path); + const std::string & config_prefix, const String & default_path); /// Get disk by name const DiskPtr & operator[](const String & name) const; diff --git a/dbms/src/Interpreters/Context.cpp b/dbms/src/Interpreters/Context.cpp index a85d54fcb3c..d34128cc2b0 100644 --- a/dbms/src/Interpreters/Context.cpp +++ b/dbms/src/Interpreters/Context.cpp @@ -1783,7 +1783,7 @@ DiskSpace::DiskSelector & Context::getDiskSelector() const constexpr auto config_name = "storage_configuration.disks"; auto & config = getConfigRef(); - shared->merge_tree_disk_selector = std::make_unique(config, config_name, getPath() + "data/"); + shared->merge_tree_disk_selector = std::make_unique(config, config_name, getPath()); } return *shared->merge_tree_disk_selector; } diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index c442961d396..3538ad4c843 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -2910,7 +2910,7 @@ MergeTreeData::getDetachedParts() const void MergeTreeData::validateDetachedPartName(const String & name) const { if (name.find('/') != std::string::npos || name == "." || name == "..") - throw DB::Exception("Invalid part name", ErrorCodes::INCORRECT_FILE_NAME); + throw DB::Exception("Invalid part name '" + name + "'", ErrorCodes::INCORRECT_FILE_NAME); String full_path = getFullPathForPart(name, "detached/"); @@ -3299,7 +3299,7 @@ void MergeTreeData::freezePartitionsByMatcher(MatcherFn matcher, const String & if (!matcher(part)) continue; - String shadow_path = part->disk->getPath() + "clickhouse/shadow/"; + String shadow_path = part->disk->getPath() + "shadow/"; Poco::File(shadow_path).createDirectories(); String backup_path = shadow_path diff --git a/dbms/tests/integration/test_multiple_disks/test.py b/dbms/tests/integration/test_multiple_disks/test.py index 89e35524f61..afad78cdc8c 100644 --- a/dbms/tests/integration/test_multiple_disks/test.py +++ b/dbms/tests/integration/test_multiple_disks/test.py @@ -40,7 +40,7 @@ def test_system_tables(start_cluster): expected_disks_data = [ { "name": "default", - "path": "/var/lib/clickhouse/data/", + "path": "/var/lib/clickhouse/", "keep_free_space": '1024', }, { @@ -884,8 +884,8 @@ def test_freeze(start_cluster): node1.query("ALTER TABLE freezing_table FREEZE PARTITION 201903") # check shadow files (backups) exists - node1.exec_in_container(["bash", "-c", "find /jbod1/clickhouse/shadow -name '*.mrk2' | grep '.*'"]) - node1.exec_in_container(["bash", "-c", "find /external/clickhouse/shadow -name '*.mrk2' | grep '.*'"]) + node1.exec_in_container(["bash", "-c", "find /jbod1/shadow -name '*.mrk2' | grep '.*'"]) + node1.exec_in_container(["bash", "-c", "find /external/shadow -name '*.mrk2' | grep '.*'"]) finally: