mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Handle decorator checking tmp disk type
This commit is contained in:
parent
0605f6ed7f
commit
1234b70118
@ -107,6 +107,13 @@ public:
|
||||
bool supportsChmod() const override { return delegate->supportsChmod(); }
|
||||
void chmod(const String & path, mode_t mode) override { delegate->chmod(path, mode); }
|
||||
|
||||
const IDisk & getNestedDisk() const
|
||||
{
|
||||
if (const auto * decorator = dynamic_cast<const DiskDecorator *>(delegate.get()))
|
||||
return decorator->getNestedDisk();
|
||||
return *delegate;
|
||||
}
|
||||
|
||||
protected:
|
||||
Executor & getExecutor() override;
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <Storages/CompressionCodecSelector.h>
|
||||
#include <Storages/StorageS3Settings.h>
|
||||
#include <Disks/DiskLocal.h>
|
||||
#include <Disks/DiskDecorator.h>
|
||||
#include <Disks/ObjectStorages/IObjectStorage.h>
|
||||
#include <Disks/IO/ThreadPoolRemoteFSReader.h>
|
||||
#include <Disks/IO/ThreadPoolReader.h>
|
||||
@ -758,9 +759,20 @@ VolumePtr Context::setTemporaryStorage(const String & path, const String & polic
|
||||
|
||||
for (const auto & disk : volume->getDisks())
|
||||
{
|
||||
if (std::dynamic_pointer_cast<DiskLocal>(disk) == nullptr)
|
||||
if (!disk)
|
||||
throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "Temporary disk is null");
|
||||
|
||||
/// Check that underlying disk is local (can be wrapped in decorator)
|
||||
const IDisk * disk_ptr = disk.get();
|
||||
if (auto disk_decorator = dynamic_cast<const DiskDecorator *>(disk_ptr))
|
||||
disk_ptr = &disk_decorator->getNestedDisk();
|
||||
|
||||
if (dynamic_cast<const DiskLocal *>(disk_ptr) == nullptr)
|
||||
{
|
||||
throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG,
|
||||
"Disk '{}' is not local and can't be used for temporary files", disk->getName());
|
||||
"Disk '{}' ({}) is not local and can't be used for temporary files",
|
||||
disk_ptr->getName(), typeid(*disk_ptr).name());
|
||||
}
|
||||
}
|
||||
|
||||
shared->temp_data_on_disk = std::make_shared<TemporaryDataOnDiskScope>(volume, max_size);
|
||||
|
Loading…
Reference in New Issue
Block a user