diff --git a/src/Disks/DiskSelector.cpp b/src/Disks/DiskSelector.cpp index ea5f27edfa6..30150588493 100644 --- a/src/Disks/DiskSelector.cpp +++ b/src/Disks/DiskSelector.cpp @@ -73,12 +73,12 @@ DiskSelectorPtr DiskSelector::updateFromConfig( std::shared_ptr result = std::make_shared(*this); constexpr auto default_disk_name = "default"; - DisksMap old_disks_minus_new_disks (result->getDisksMap()); + DisksMap old_disks_minus_new_disks(result->getDisksMap()); for (const auto & disk_name : keys) { if (!std::all_of(disk_name.begin(), disk_name.end(), isWordCharASCII)) - throw Exception("Disk name can contain only alphanumeric and '_' (" + disk_name + ")", ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG); + throw Exception(ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG, "Disk name can contain only alphanumeric and '_' ({})", disk_name); auto disk_config_prefix = config_prefix + "." + disk_name; if (!result->getDisksMap().contains(disk_name)) @@ -106,10 +106,15 @@ DiskSelectorPtr DiskSelector::updateFromConfig( writeString("Disks ", warning); int index = 0; - for (const auto & [name, _] : old_disks_minus_new_disks) + for (const auto & [name, disk] : old_disks_minus_new_disks) { + /// Custom disks are not present in config. + if (disk->isCustomDisk()) + continue; + if (index++ > 0) writeString(", ", warning); + writeBackQuotedString(name, warning); } diff --git a/src/Parsers/ASTSetQuery.cpp b/src/Parsers/ASTSetQuery.cpp index f85c8e8ff95..bc56690a26d 100644 --- a/src/Parsers/ASTSetQuery.cpp +++ b/src/Parsers/ASTSetQuery.cpp @@ -34,13 +34,13 @@ void ASTSetQuery::formatImpl(const FormatSettings & format, FormatState & state, first = false; formatSettingName(change.name, format.ostr); - if (it->value_ast) + if (change.value_ast) { format.ostr << " = "; - it->value_ast->formatImpl(format, state, stacked); + change.value_ast->formatImpl(format, state, stacked); } else - format.ostr << " = " << applyVisitor(FieldVisitorToString(), it->value); + format.ostr << " = " << applyVisitor(FieldVisitorToString(), change.value); } for (const auto & [name, value] : query_parameters) diff --git a/src/Storages/createDiskFromDiskAST.cpp b/src/Storages/createDiskFromDiskAST.cpp index 5b39a6d9c27..11a942beeba 100644 --- a/src/Storages/createDiskFromDiskAST.cpp +++ b/src/Storages/createDiskFromDiskAST.cpp @@ -11,11 +11,6 @@ namespace DB { -namespace ErrorCodes -{ - extern const int BAD_ARGUMENTS; -} - bool isDiskFunction(ASTPtr ast) { if (!ast) diff --git a/tests/integration/test_disk_configuration/test.py b/tests/integration/test_disk_configuration/test.py index 5933ffbd703..aca072623ed 100644 --- a/tests/integration/test_disk_configuration/test.py +++ b/tests/integration/test_disk_configuration/test.py @@ -238,6 +238,14 @@ def test_merge_tree_custom_disk_setting(start_cluster): node1.query(f"INSERT INTO {TABLE_NAME} SELECT number FROM numbers(100)") assert int(node1.query(f"SELECT count() FROM {TABLE_NAME}")) == 300 + # check reload config does not wipe custom disk + + node1.query("SYSTEM RELOAD CONFIG") + assert not node1.contains_in_log( + "disappeared from configuration, this change will be applied after restart of ClickHouse" + ) + assert int(node1.query(f"SELECT count() FROM {TABLE_NAME}")) == 300 + # check replicated merge tree on cluster replica = "{replica}"