mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Better
This commit is contained in:
parent
b4bebc5977
commit
83d64f1c2d
@ -70,12 +70,12 @@ bool AsynchronousReadIndirectBufferFromRemoteFS::hasPendingDataToRead()
|
||||
if (read_until_position)
|
||||
{
|
||||
/// Everything is already read.
|
||||
if (file_offset_of_buffer_end == read_until_position)
|
||||
if (file_offset_of_buffer_end == *read_until_position)
|
||||
return false;
|
||||
|
||||
if (file_offset_of_buffer_end > read_until_position)
|
||||
if (file_offset_of_buffer_end > *read_until_position)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Read beyond last offset ({} > {})",
|
||||
file_offset_of_buffer_end, read_until_position);
|
||||
file_offset_of_buffer_end, *read_until_position);
|
||||
}
|
||||
else if (must_read_until_position)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
@ -124,7 +124,7 @@ void AsynchronousReadIndirectBufferFromRemoteFS::setReadUntilPosition(size_t pos
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Prefetch is valid in readUntilPosition");
|
||||
|
||||
read_until_position = position;
|
||||
impl->setReadUntilPosition(read_until_position);
|
||||
impl->setReadUntilPosition(*read_until_position);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ void AsynchronousReadIndirectBufferFromRemoteFS::setReadUntilEnd()
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Prefetch is valid in readUntilEnd");
|
||||
|
||||
read_until_position = impl->getFileSize();
|
||||
impl->setReadUntilPosition(read_until_position);
|
||||
impl->setReadUntilPosition(*read_until_position);
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ off_t AsynchronousReadIndirectBufferFromRemoteFS::seek(off_t offset_, int whence
|
||||
pos = working_buffer.end();
|
||||
|
||||
/// Note: we read in range [file_offset_of_buffer_end, read_until_position).
|
||||
if (file_offset_of_buffer_end < read_until_position
|
||||
if (read_until_position && file_offset_of_buffer_end < *read_until_position
|
||||
&& static_cast<off_t>(file_offset_of_buffer_end) >= getPosition()
|
||||
&& static_cast<off_t>(file_offset_of_buffer_end) < getPosition() + static_cast<off_t>(min_bytes_for_seek))
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ private:
|
||||
|
||||
size_t bytes_to_ignore = 0;
|
||||
|
||||
size_t read_until_position = 0;
|
||||
std::optional<size_t> read_until_position = 0;
|
||||
|
||||
bool must_read_until_position;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user