Strangest fix for HDFS test

This commit is contained in:
alesapin 2022-06-30 01:21:49 +02:00
parent 67f2fa0ef0
commit 8726c7df26

View File

@ -3,6 +3,7 @@
#include <Disks/ObjectStorages/DiskObjectStorage.h>
#include <Disks/ObjectStorages/MetadataStorageFromDisk.h>
#include <Disks/DiskFactory.h>
#include <Disks/DiskRestartProxy.h>
#include <Storages/HDFS/HDFSCommon.h>
namespace DB
@ -37,11 +38,12 @@ void registerDiskHDFS(DiskFactory & factory)
/// FIXME Cache currently unsupported :(
ObjectStoragePtr hdfs_storage = std::make_unique<HDFSObjectStorage>(nullptr, uri, std::move(settings), config);
auto metadata_disk = prepareForLocalMetadata(name, config, config_prefix, context_).second;
auto [metadata_path, metadata_disk] = prepareForLocalMetadata(name, config, config_prefix, context_);
auto metadata_storage = std::make_shared<MetadataStorageFromDisk>(metadata_disk, uri);
uint64_t copy_thread_pool_size = config.getUInt(config_prefix + ".thread_pool_size", 16);
return std::make_shared<DiskObjectStorage>(
std::shared_ptr<IDisk> disk_result = std::make_shared<DiskObjectStorage>(
name,
uri,
"DiskHDFS",
@ -50,6 +52,22 @@ void registerDiskHDFS(DiskFactory & factory)
DiskType::HDFS,
/* send_metadata = */ false,
copy_thread_pool_size);
#ifdef NDEBUG
bool use_cache = true;
#else
/// Current S3 cache implementation lead to allocations in destructor of
/// read buffer.
bool use_cache = false;
#endif
if (config.getBool(config_prefix + ".cache_enabled", use_cache))
{
String cache_path = config.getString(config_prefix + ".cache_path", context_->getPath() + "disks/" + name + "/cache/");
disk_result = wrapWithCache(disk_result, "hdfs-cache", cache_path, metadata_path);
}
return std::make_shared<DiskRestartProxy>(disk_result);
};
factory.registerDiskType("hdfs", creator);