mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge pull request #11953 from ClickHouse/revive-mmap
Revive mmap IO + add a test
This commit is contained in:
commit
178a5217bc
@ -608,6 +608,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
|
|||||||
MergeTreeReaderSettings reader_settings =
|
MergeTreeReaderSettings reader_settings =
|
||||||
{
|
{
|
||||||
.min_bytes_to_use_direct_io = settings.min_bytes_to_use_direct_io,
|
.min_bytes_to_use_direct_io = settings.min_bytes_to_use_direct_io,
|
||||||
|
.min_bytes_to_use_mmap_io = settings.min_bytes_to_use_mmap_io,
|
||||||
.max_read_buffer_size = settings.max_read_buffer_size,
|
.max_read_buffer_size = settings.max_read_buffer_size,
|
||||||
.save_marks_in_cache = true
|
.save_marks_in_cache = true
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ struct MergeTreeReaderSettings
|
|||||||
size_t min_bytes_to_use_direct_io = 0;
|
size_t min_bytes_to_use_direct_io = 0;
|
||||||
size_t min_bytes_to_use_mmap_io = 0;
|
size_t min_bytes_to_use_mmap_io = 0;
|
||||||
size_t max_read_buffer_size = DBMS_DEFAULT_BUFFER_SIZE;
|
size_t max_read_buffer_size = DBMS_DEFAULT_BUFFER_SIZE;
|
||||||
/// If save_marks_in_cache is false, then, if marks are not in cache,
|
/// If save_marks_in_cache is false, then, if marks are not in cache,
|
||||||
/// we will load them but won't save in the cache, to avoid evicting other data.
|
/// we will load them but won't save in the cache, to avoid evicting other data.
|
||||||
bool save_marks_in_cache = false;
|
bool save_marks_in_cache = false;
|
||||||
};
|
};
|
||||||
@ -33,4 +33,5 @@ struct MergeTreeWriterSettings
|
|||||||
|
|
||||||
size_t estimated_size = 0;
|
size_t estimated_size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ MergeTreeReaderCompact::MergeTreeReaderCompact(
|
|||||||
buffer_size,
|
buffer_size,
|
||||||
0,
|
0,
|
||||||
settings.min_bytes_to_use_direct_io,
|
settings.min_bytes_to_use_direct_io,
|
||||||
0);
|
settings.min_bytes_to_use_mmap_io);
|
||||||
},
|
},
|
||||||
uncompressed_cache);
|
uncompressed_cache);
|
||||||
|
|
||||||
@ -71,7 +71,8 @@ MergeTreeReaderCompact::MergeTreeReaderCompact(
|
|||||||
{
|
{
|
||||||
auto buffer =
|
auto buffer =
|
||||||
std::make_unique<CompressedReadBufferFromFile>(
|
std::make_unique<CompressedReadBufferFromFile>(
|
||||||
data_part->volume->getDisk()->readFile(full_data_path, buffer_size, 0, settings.min_bytes_to_use_direct_io, 0));
|
data_part->volume->getDisk()->readFile(
|
||||||
|
full_data_path, buffer_size, 0, settings.min_bytes_to_use_direct_io, settings.min_bytes_to_use_mmap_io));
|
||||||
|
|
||||||
if (profile_callback_)
|
if (profile_callback_)
|
||||||
buffer->setProfileCallback(profile_callback_, clock_type_);
|
buffer->setProfileCallback(profile_callback_, clock_type_);
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
Hello, world
|
||||||
|
1
|
11
tests/queries/0_stateless/01343_min_bytes_to_use_mmap_io.sql
Normal file
11
tests/queries/0_stateless/01343_min_bytes_to_use_mmap_io.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
DROP TABLE IF EXISTS test;
|
||||||
|
CREATE TABLE test (x String) ENGINE = MergeTree ORDER BY tuple();
|
||||||
|
INSERT INTO test VALUES ('Hello, world');
|
||||||
|
|
||||||
|
SET min_bytes_to_use_mmap_io = 1;
|
||||||
|
SELECT * FROM test;
|
||||||
|
|
||||||
|
SYSTEM FLUSH LOGS;
|
||||||
|
SELECT PE.Values FROM system.query_log ARRAY JOIN ProfileEvents AS PE WHERE event_date >= yesterday() AND event_time >= now() - 300 AND query LIKE 'SELECT * FROM test%' AND PE.Names = 'CreatedReadBufferMMap' AND type = 2 ORDER BY event_time DESC LIMIT 1;
|
||||||
|
|
||||||
|
DROP TABLE test;
|
Loading…
Reference in New Issue
Block a user