Revive mmap IO

This commit is contained in:
Alexey Milovidov 2020-06-25 22:15:41 +03:00
parent f886fed08b
commit 5608f15749
5 changed files with 19 additions and 3 deletions

View File

@ -608,6 +608,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
MergeTreeReaderSettings reader_settings =
{
.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,
.save_marks_in_cache = true
};

View File

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

View File

@ -57,7 +57,7 @@ MergeTreeReaderCompact::MergeTreeReaderCompact(
buffer_size,
0,
settings.min_bytes_to_use_direct_io,
0);
settings.min_bytes_to_use_mmap_io);
},
uncompressed_cache);
@ -71,7 +71,8 @@ MergeTreeReaderCompact::MergeTreeReaderCompact(
{
auto buffer =
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_)
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;