mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
optimize file segment getCacheReadBuffer
This commit is contained in:
parent
dea1706d4e
commit
6338368a1c
@ -282,6 +282,20 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getReadBufferForFileSegment(
|
|||||||
}
|
}
|
||||||
case FileSegment::State::PARTIALLY_DOWNLOADED:
|
case FileSegment::State::PARTIALLY_DOWNLOADED:
|
||||||
{
|
{
|
||||||
|
if (file_segment->getDownloadOffset() > file_offset_of_buffer_end)
|
||||||
|
{
|
||||||
|
/// segment{k} state: PARTIALLY_DOWNLOADED
|
||||||
|
/// cache: [______|___________
|
||||||
|
/// ^
|
||||||
|
/// download_offset (in progress)
|
||||||
|
/// requested_range: [__________]
|
||||||
|
/// ^
|
||||||
|
/// file_offset_of_buffer_end
|
||||||
|
|
||||||
|
read_type = ReadType::CACHED;
|
||||||
|
return getCacheReadBuffer(range.left);
|
||||||
|
}
|
||||||
|
|
||||||
auto downloader_id = file_segment->getOrSetDownloader();
|
auto downloader_id = file_segment->getOrSetDownloader();
|
||||||
if (downloader_id == file_segment->getCallerId())
|
if (downloader_id == file_segment->getCallerId())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user