Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Disks/DiskSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ catch (...)
}

DiskSelectorPtr DiskSelector::updateFromConfig(
const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context) const
const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context, const NameSet & disks_to_skip) const
{
assertInitialized();

Expand All @@ -166,6 +166,14 @@ DiskSelectorPtr DiskSelector::updateFromConfig(
auto disk_config_prefix = config_prefix + "." + disk_name;
if (!result->getDisksMap().contains(disk_name))
{
if (disks_to_skip.contains(disk_name))
{
LOG_WARNING(
getLogger("DiskSelector"),
"Disk {} is not created from the configuration: a custom disk with this name is being created",
backQuote(disk_name));
continue;
}
auto created_disk = factory.create(
disk_name, config, disk_config_prefix, context, result->getDisksMap(), /*attach*/ false, /*custom_disk*/ false, skip_types);
if (created_disk)
Expand Down
5 changes: 4 additions & 1 deletion src/Disks/DiskSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ class DiskSelector
using DiskValidator = std::function<bool(const Poco::Util::AbstractConfiguration & config, const String & disk_config_prefix, const String & disk_name)>;
void initialize(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context, DiskValidator disk_validator = {});

/// Configured disks named in `disks_to_skip` are not created by this reload: their names are being
/// created as custom disks, and creating them here could open the same storage twice.
DiskSelectorPtr updateFromConfig(
const Poco::Util::AbstractConfiguration & config,
const String & config_prefix,
ContextPtr context) const;
ContextPtr context,
const NameSet & disks_to_skip = {}) const;

/// Get disk by name
DiskPtr get(const String & name) const;
Expand Down
Loading
Loading