This commit is contained in:
kssenii 2023-05-30 20:56:48 +02:00
parent 55b2e42150
commit 7fcafaabd5
3 changed files with 31 additions and 1 deletions

View File

@ -298,7 +298,7 @@ off_t AsynchronousBoundedReadBuffer::seek(off_t offset, int whence)
* Lazy ignore. Save number of bytes to ignore and ignore it either for prefetch buffer or current buffer.
* Note: we read in range [file_offset_of_buffer_end, read_until_position).
*/
if (read_until_position && new_pos < *read_until_position
if (file_offset_of_buffer_end && read_until_position && new_pos < *read_until_position
&& new_pos > file_offset_of_buffer_end
&& new_pos < file_offset_of_buffer_end + read_settings.remote_read_min_bytes_for_seek)
{

View File

@ -0,0 +1 @@
4 66446 66446

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS test_optimize_exception"
${CLICKHOUSE_CLIENT} -nm --query "
DROP TABLE IF EXISTS test_s3;
CREATE TABLE test_s3 (a UInt64, b UInt64)
ENGINE = MergeTree ORDER BY a
SETTINGS storage_policy = 's3', min_bytes_for_wide_part = 0;
INSERT INTO test_s3 SELECT number, number FROM numbers(1000000);
"
query="SELECT sum(b) FROM test_s3 WHERE a >= 100000 AND a <= 102000"
query_id=$(${CLICKHOUSE_CLIENT} --query "select queryID() from ($query) limit 1" 2>&1)
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS"
${CLICKHOUSE_CLIENT} -nm --query "
SELECT
ProfileEvents['S3ReadRequestsCount'],
ProfileEvents['ReadBufferFromS3Bytes'],
ProfileEvents['ReadCompressedBytes']
FROM system.query_log
WHERE type = 'QueryFinish'
AND current_database = currentDatabase()
AND query_id='$query_id';
"