This commit is contained in:
vdimir 2024-10-21 16:50:16 +00:00
parent a5b9083f2c
commit e8fdacdece
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
2 changed files with 5 additions and 1 deletions

View File

@ -470,6 +470,7 @@ private:
void CacheMetadata::cleanupThreadFunc()
{
LOG_DEBUG(log, "Cleanup thread started");
while (true)
{
Key key;

View File

@ -59,7 +59,7 @@ public:
explicit TemporaryFileInLocalCache(FileCache & file_cache, size_t max_file_size = 0)
{
const auto key = FileSegment::Key::random();
LOG_TRACE(getLogger("TemporaryFileOnLocalDisk"), "Creating temporary file in cache with key {}", key);
LOG_TRACE(getLogger("TemporaryFileInLocalCache"), "Creating temporary file in cache with key {}", key);
segment_holder = file_cache.set(
key, 0, std::max(10_MiB, max_file_size),
CreateFileSegmentSettings(FileSegmentKind::Ephemeral), FileCache::getCommonUser());
@ -270,6 +270,9 @@ std::unique_ptr<ReadBuffer> TemporaryDataBuffer::read()
{
finishWriting();
if (stat.compressed_size == 0 && stat.uncompressed_size == 0)
return std::make_unique<TemporaryDataReadBuffer>(std::make_unique<ReadBufferFromEmptyFile>());
/// Keep buffer size less that file size, to avoid memory overhead for large amounts of small files
size_t buffer_size = std::min<size_t>(stat.compressed_size, DBMS_DEFAULT_BUFFER_SIZE);
return std::make_unique<TemporaryDataReadBuffer>(file_holder->read(buffer_size));