mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix path to data on disk
This commit is contained in:
parent
0b8aec469f
commit
b0fce77c3d
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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<DiskSpace::DiskSelector>(config, config_name, getPath() + "data/");
|
||||
shared->merge_tree_disk_selector = std::make_unique<DiskSpace::DiskSelector>(config, config_name, getPath());
|
||||
}
|
||||
return *shared->merge_tree_disk_selector;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user