mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Revert "[RFC] Fix memory tracking with min_bytes_to_use_mmap_io"
This commit is contained in:
parent
04fa079855
commit
1d5a4cfa32
@ -1,5 +1,4 @@
|
||||
#include <IO/MMapReadBufferFromFileWithCache.h>
|
||||
#include <Common/CurrentMemoryTracker.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -75,16 +74,4 @@ off_t MMapReadBufferFromFileWithCache::seek(off_t offset, int whence)
|
||||
return new_pos;
|
||||
}
|
||||
|
||||
void MMapReadBufferFromFileWithCache::track(size_t bytes_)
|
||||
{
|
||||
CurrentMemoryTracker::alloc(bytes_);
|
||||
tracked_bytes = bytes_;
|
||||
}
|
||||
|
||||
MMapReadBufferFromFileWithCache::~MMapReadBufferFromFileWithCache()
|
||||
{
|
||||
if (tracked_bytes)
|
||||
CurrentMemoryTracker::free(tracked_bytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,27 +16,13 @@ public:
|
||||
/// Map till end of file.
|
||||
MMapReadBufferFromFileWithCache(MMappedFileCache & cache, const std::string & file_name, size_t offset);
|
||||
|
||||
~MMapReadBufferFromFileWithCache() override;
|
||||
|
||||
off_t getPosition() override;
|
||||
std::string getFileName() const override;
|
||||
off_t seek(off_t offset, int whence) override;
|
||||
|
||||
/// Track memory with MemoryTracker.
|
||||
///
|
||||
/// NOTE: that this is not the size of mmap() region, but estimated size of
|
||||
/// data that will be read (see MergeTreeReaderStream).
|
||||
/// And from one point of view it should not be accounted here, since the
|
||||
/// kernel may unmap physical pages, but in practice firstly it will mmap it,
|
||||
/// RSS will grow, total_memory_tracker will be synced with RSS and the
|
||||
/// allocations will start to fail.
|
||||
void track(size_t bytes_);
|
||||
|
||||
private:
|
||||
MMappedFileCache::MappedPtr mapped;
|
||||
|
||||
size_t tracked_bytes = 0;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,6 @@ std::unique_ptr<ReadBufferFromFileBase> createReadBufferFromFileBase(
|
||||
try
|
||||
{
|
||||
auto res = std::make_unique<MMapReadBufferFromFileWithCache>(*mmap_cache, filename_, 0);
|
||||
res->track(estimated_size);
|
||||
ProfileEvents::increment(ProfileEvents::CreatedReadBufferMMap);
|
||||
return res;
|
||||
}
|
||||
|
@ -23,6 +23,6 @@ SELECT marks FROM system.parts WHERE table = 'adaptive_table' and database=curre
|
||||
-- If we have computed granularity incorrectly than we will exceed this limit.
|
||||
SET max_memory_usage='30M';
|
||||
|
||||
SELECT max(length(value)) FROM adaptive_table SETTINGS min_bytes_to_use_mmap_io=0;
|
||||
SELECT max(length(value)) FROM adaptive_table;
|
||||
|
||||
DROP TABLE IF EXISTS adaptive_table;
|
@ -1,5 +0,0 @@
|
||||
drop table if exists data_01818;
|
||||
|
||||
create table data_01818 (key Int, value String) engine=MergeTree() order by key settings min_bytes_for_wide_part=0 as select number, randomPrintableASCII(100) from numbers(1e6);
|
||||
select * from data_01818 format Null settings min_bytes_to_use_mmap_io=1, max_memory_usage='20Mi', max_threads=1; -- { serverError 241 }
|
||||
select * from data_01818 format Null settings min_bytes_to_use_mmap_io=1e9, max_memory_usage='20Mi', max_threads=1;
|
@ -2,8 +2,6 @@ SET max_bytes_before_external_group_by = 200000000;
|
||||
|
||||
SET max_memory_usage = 1500000000;
|
||||
SET max_threads = 12;
|
||||
SET min_bytes_to_use_mmap_io = 0;
|
||||
|
||||
SELECT URL, uniq(SearchPhrase) AS u FROM test.hits GROUP BY URL ORDER BY u DESC, URL LIMIT 10;
|
||||
|
||||
SET max_memory_usage = 300000000;
|
||||
|
Loading…
Reference in New Issue
Block a user