mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Update AsynchronousReadIndirectBufferFromRemoteFS.cpp
This commit is contained in:
parent
ce062d2e01
commit
37d1eb353f
@ -133,8 +133,18 @@ void AsynchronousReadIndirectBufferFromRemoteFS::prefetch()
|
||||
|
||||
void AsynchronousReadIndirectBufferFromRemoteFS::setReadUntilPosition(size_t position)
|
||||
{
|
||||
/// Do not reinitialize internal state in case the new end of range is already included.
|
||||
/// Actually it is likely that we will anyway reinitialize it as seek method is called after
|
||||
/// changing end position, but seek avoiding feature might help to avoid reinitialization,
|
||||
/// so this check is useful to save the prefetch for the time when we try to avoid seek by
|
||||
/// reading and ignoring some data.
|
||||
if (!read_until_position || position > *read_until_position)
|
||||
{
|
||||
/// We must wait on future and reset the prefetch here, because otherwise there might be
|
||||
/// a race between reading the data in the threadpool and impl->setReadUntilPosition()
|
||||
/// which reinitializes internal remote read buffer (because if we have a new read range
|
||||
/// then we need a new range request) and in case of reading from cache we need to request
|
||||
/// and hold more file segment ranges from cache.
|
||||
if (prefetch_future.valid())
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::RemoteFSCancelledPrefetches);
|
||||
|
Loading…
Reference in New Issue
Block a user