This commit is contained in:
kssenii 2021-12-20 17:17:02 +03:00
parent 0411fd6565
commit ebcb66a361
5 changed files with 10 additions and 4 deletions

View File

@ -257,7 +257,6 @@ off_t AsynchronousReadIndirectBufferFromRemoteFS::seek(off_t offset_, int whence
{
ProfileEvents::increment(ProfileEvents::RemoteFSLazySeeks);
bytes_to_ignore = file_offset_of_buffer_end - file_offset_before_seek;
prefetch_future = readInto(prefetch_buffer.data(), prefetch_buffer.size());
}
else
{

View File

@ -69,6 +69,11 @@ private:
size_t file_offset_of_buffer_end = 0;
/**
* File: |___________________|
* Buffer: |~~~~~~~|
* file_offset_of_buffer_end: ^
*/
size_t bytes_to_ignore = 0;
size_t read_until_position = 0;

View File

@ -91,7 +91,7 @@ bool AsynchronousReadBufferFromFileDescriptor::nextImpl()
{
/// No pending request. Do synchronous read.
auto [size, offset] = readInto(memory.data(), memory.size()).get();
auto [size, _] = readInto(memory.data(), memory.size()).get();
file_offset_of_buffer_end += size;
if (size)

View File

@ -198,7 +198,9 @@ std::vector<size_t> MergeTreeReadPool::fillPerPartInfo(const RangesInDataParts &
for (const auto i : collections::range(0, parts.size()))
{
const auto & part = parts[i];
is_part_on_remote_disk[i] = part.data_part->isStoredOnRemoteDisk();
bool part_on_remote_disk = part.data_part->isStoredOnRemoteDisk();
is_part_on_remote_disk[i] = part_on_remote_disk;
do_not_steal_tasks |= part_on_remote_disk;
/// Read marks for every data part.
size_t sum_marks = 0;

View File

@ -463,7 +463,7 @@ def test_lazy_seek_optimization_for_async_read(cluster, node_name):
node = cluster.instances[node_name]
node.query("DROP TABLE IF EXISTS s3_test NO DELAY")
node.query("CREATE TABLE s3_test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='s3';")
node.query("INSERT INTO s3_test SELECT * FROM generateRandom('key UInt32, value String') LIMIT 9000000")
node.query("INSERT INTO s3_test SELECT * FROM generateRandom('key UInt32, value String') LIMIT 10000000")
node.query("SELECT * FROM s3_test WHERE value LIKE '%abc%' ORDER BY value LIMIT 10")
node.query("DROP TABLE IF EXISTS s3_test NO DELAY")
minio = cluster.minio_client