Merge pull request #11953 from ClickHouse/revive-mmap

Revive mmap IO + add a test
This commit is contained in:
alexey-milovidov 2020-06-26 03:15:07 +03:00 committed by GitHub
commit 178a5217bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View File

@ -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
}; };

View File

@ -33,4 +33,5 @@ struct MergeTreeWriterSettings
size_t estimated_size = 0; size_t estimated_size = 0;
}; };
} }

View File

@ -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_);

View File

@ -0,0 +1,2 @@
Hello, world
1

View 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;