mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
fix
This commit is contained in:
parent
a5b9083f2c
commit
e8fdacdece
@ -470,6 +470,7 @@ private:
|
|||||||
|
|
||||||
void CacheMetadata::cleanupThreadFunc()
|
void CacheMetadata::cleanupThreadFunc()
|
||||||
{
|
{
|
||||||
|
LOG_DEBUG(log, "Cleanup thread started");
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Key key;
|
Key key;
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
explicit TemporaryFileInLocalCache(FileCache & file_cache, size_t max_file_size = 0)
|
explicit TemporaryFileInLocalCache(FileCache & file_cache, size_t max_file_size = 0)
|
||||||
{
|
{
|
||||||
const auto key = FileSegment::Key::random();
|
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(
|
segment_holder = file_cache.set(
|
||||||
key, 0, std::max(10_MiB, max_file_size),
|
key, 0, std::max(10_MiB, max_file_size),
|
||||||
CreateFileSegmentSettings(FileSegmentKind::Ephemeral), FileCache::getCommonUser());
|
CreateFileSegmentSettings(FileSegmentKind::Ephemeral), FileCache::getCommonUser());
|
||||||
@ -270,6 +270,9 @@ std::unique_ptr<ReadBuffer> TemporaryDataBuffer::read()
|
|||||||
{
|
{
|
||||||
finishWriting();
|
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
|
/// 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);
|
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));
|
return std::make_unique<TemporaryDataReadBuffer>(file_holder->read(buffer_size));
|
||||||
|
Loading…
Reference in New Issue
Block a user