**Describe the bug**
[A link to the report
](https://s3.amazonaws.com/clickhouse-test-reports/0/b4eae948898b103e8ee145c650108da4c80e2a53/stateful_tests__release__actions_.html)

**How to reproduce**
Run test `00024_random_counters.sql` with settings `--use_uncompressed_cache=1 --min_bytes_to_use_direct_io=1`

```
clickhouse-client -q "system drop uncompressed cache" && cat queries/1_stateful/00024_random_counters.sql | clickhouse-client -n --use_uncompressed_cache=1 --min_bytes_to_use_direct_io=1 > /dev/null
Received exception from server (version 22.7.1):
Code: 33. DB::Exception: Received from localhost:9000. DB::Exception: Cannot read all data. Bytes read: 0. Bytes expected: 25.: (while reading column Sign): (while reading from part ./data/datasets/visits_v1/20140317_20140323_3_4_1/ from mark 204 with max_rows_to_read = 8192): While executing MergeTreeInOrder. (CANNOT_READ_ALL_DATA)
(query: SELECT uniq(UserID), sum(Sign) FROM datasets.visits_v1 WHERE CounterID = 33436573;)
```
extern const int SEEK_POSITION_OUT_OF_BOUND;
    extern const int LOGICAL_ERROR;
}
AsynchronousReadBufferFromHDFS::AsynchronousReadBufferFromHDFS(
    AsynchronousReaderPtr reader_, const ReadSettings & settings_, std::shared_ptr<ReadBufferFromHDFS> impl_)
    : BufferWithOwnMemory<SeekableReadBuffer>(settings_.remote_fs_buffer_size)
    , reader(reader_)
    , priority(settings_.priority)
    , impl(std::move(impl_))
    , prefetch_buffer(settings_.remote_fs_buffer_size)
    , read_until_position(impl->getFileSize())
    , use_prefetch(settings_.remote_fs_prefetch)
    , log(&Poco::Logger::get("AsynchronousReadBufferFromHDFS"))
{
    ProfileEvents::increment(ProfileEvents::RemoteFSBuffers);
}
bool AsynchronousReadBufferFromHDFS::hasPendingDataToRead()
{
    if (read_until_position)
    {
        
        if (file_offset_of_buffer_end == *read_until_position)
            return false;
        if (file_offset_of_buffer_end > *read_until_position)
            throw Exception(ErrorCodes::LOGICAL_ERROR, "Read beyond last offset ({} > {}, info: {})",
                            file_offset_of_buffer_end, *read_until_position, impl->getInfoForLog());
    }
    return true;
}
std::future<IAsynchronousReader::Result> AsynchronousReadBufferFromHDFS::asyncReadInto(char * data, size_t size)