From 5c6f1ca64c2ebae7b6e9c02df91c378ade2e1a5d Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Mon, 25 Mar 2024 19:27:44 +0100 Subject: [PATCH 01/12] Updated to use azure download to buffer function --- src/Backups/BackupIO_AzureBlobStorage.cpp | 4 +- .../IO/ReadBufferFromAzureBlobStorage.cpp | 58 +++++-------------- src/Disks/IO/ReadBufferFromAzureBlobStorage.h | 6 +- .../AzureBlobStorage/AzureObjectStorage.cpp | 3 +- .../copyAzureBlobStorageFile.cpp | 2 +- 5 files changed, 19 insertions(+), 54 deletions(-) diff --git a/src/Backups/BackupIO_AzureBlobStorage.cpp b/src/Backups/BackupIO_AzureBlobStorage.cpp index b9b208e321cf..af443c133a9c 100644 --- a/src/Backups/BackupIO_AzureBlobStorage.cpp +++ b/src/Backups/BackupIO_AzureBlobStorage.cpp @@ -89,7 +89,7 @@ std::unique_ptr BackupReaderAzureBlobStorage::readFile(const key = file_name; } return std::make_unique( - client, key, read_settings, settings->max_single_read_retries, + client, key, read_settings, settings->max_single_download_retries); } @@ -258,7 +258,7 @@ std::unique_ptr BackupWriterAzureBlobStorage::readFile(const String } return std::make_unique( - client, key, read_settings, settings->max_single_read_retries, + client, key, read_settings, settings->max_single_download_retries); } diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 5947b742339e..2900473fd4e7 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -31,7 +31,6 @@ ReadBufferFromAzureBlobStorage::ReadBufferFromAzureBlobStorage( std::shared_ptr blob_container_client_, const String & path_, const ReadSettings & read_settings_, - size_t max_single_read_retries_, size_t max_single_download_retries_, bool use_external_buffer_, bool restricted_seek_, @@ -39,7 +38,6 @@ ReadBufferFromAzureBlobStorage::ReadBufferFromAzureBlobStorage( : ReadBufferFromFileBase(use_external_buffer_ ? 0 : read_settings_.remote_fs_buffer_size, nullptr, 0) , blob_container_client(blob_container_client_) , path(path_) - , max_single_read_retries(max_single_read_retries_) , max_single_download_retries(max_single_download_retries_) , read_settings(read_settings_) , tmp_buffer_size(read_settings.remote_fs_buffer_size) @@ -78,6 +76,7 @@ void ReadBufferFromAzureBlobStorage::setReadUntilPosition(size_t position) bool ReadBufferFromAzureBlobStorage::nextImpl() { + size_t bytes_read = 0; if (read_until_position) { if (read_until_position == offset) @@ -87,46 +86,14 @@ bool ReadBufferFromAzureBlobStorage::nextImpl() throw Exception(ErrorCodes::LOGICAL_ERROR, "Attempt to read beyond right offset ({} > {})", offset, read_until_position - 1); } - if (!initialized) - initialize(); - if (use_external_buffer) { data_ptr = internal_buffer.begin(); data_capacity = internal_buffer.size(); } - size_t to_read_bytes = std::min(static_cast(total_size - offset), data_capacity); - size_t bytes_read = 0; - - size_t sleep_time_with_backoff_milliseconds = 100; - - auto handle_exception = [&, this](const auto & e, size_t i) - { - LOG_DEBUG(log, "Exception caught during Azure Read for file {} at attempt {}/{}: {}", path, i + 1, max_single_read_retries, e.Message); - if (i + 1 == max_single_read_retries) - throw; - - sleepForMilliseconds(sleep_time_with_backoff_milliseconds); - sleep_time_with_backoff_milliseconds *= 2; - initialized = false; - initialize(); - }; - - for (size_t i = 0; i < max_single_read_retries; ++i) - { - try - { - bytes_read = data_stream->ReadToCount(reinterpret_cast(data_ptr), to_read_bytes); - if (read_settings.remote_throttler) - read_settings.remote_throttler->add(bytes_read, ProfileEvents::RemoteReadThrottlerBytes, ProfileEvents::RemoteReadThrottlerSleepMicroseconds); - break; - } - catch (const Azure::Core::RequestFailedException & e) - { - handle_exception(e, i); - } - } + if (!initialized) + bytes_read = initialize(); if (bytes_read == 0) return false; @@ -195,12 +162,12 @@ off_t ReadBufferFromAzureBlobStorage::getPosition() return offset - available(); } -void ReadBufferFromAzureBlobStorage::initialize() +size_t ReadBufferFromAzureBlobStorage::initialize() { if (initialized) - return; + return 0; - Azure::Storage::Blobs::DownloadBlobOptions download_options; + Azure::Storage::Blobs::DownloadBlobToOptions download_options; Azure::Nullable length {}; if (read_until_position != 0) @@ -223,12 +190,15 @@ void ReadBufferFromAzureBlobStorage::initialize() sleep_time_with_backoff_milliseconds *= 2; }; + long read_bytes = 0; + for (size_t i = 0; i < max_single_download_retries; ++i) { try { - auto download_response = blob_client->Download(download_options); - data_stream = std::move(download_response.Value.BodyStream); + LOG_INFO(log, "Intialize buffer offset {} read_until_position {} data_capacity {} ",offset, read_until_position, data_capacity); + auto download_response = blob_client->DownloadTo(reinterpret_cast(data_ptr), data_capacity, download_options); + read_bytes = download_response.Value.ContentRange.Length.Value(); break; } catch (const Azure::Core::RequestFailedException & e) @@ -237,12 +207,10 @@ void ReadBufferFromAzureBlobStorage::initialize() } } - if (data_stream == nullptr) - throw Exception(ErrorCodes::RECEIVED_EMPTY_DATA, "Null data stream obtained while downloading file {} from Blob Storage", path); - - total_size = data_stream->Length() + offset; + total_size = read_bytes + offset; initialized = true; + return read_bytes; } size_t ReadBufferFromAzureBlobStorage::getFileSize() diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h index d328195cc26e..5a364e981bef 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h @@ -21,7 +21,6 @@ class ReadBufferFromAzureBlobStorage : public ReadBufferFromFileBase std::shared_ptr blob_container_client_, const String & path_, const ReadSettings & read_settings_, - size_t max_single_read_retries_, size_t max_single_download_retries_, bool use_external_buffer_ = false, bool restricted_seek_ = false, @@ -38,6 +37,7 @@ class ReadBufferFromAzureBlobStorage : public ReadBufferFromFileBase String getFileName() const override { return path; } void setReadUntilPosition(size_t position) override; + void setReadUntilEnd() override; bool supportsRightBoundedReads() const override { return true; } @@ -50,14 +50,12 @@ class ReadBufferFromAzureBlobStorage : public ReadBufferFromFileBase private: - void initialize(); + size_t initialize(); - std::unique_ptr data_stream; std::shared_ptr blob_container_client; std::unique_ptr blob_client; const String path; - size_t max_single_read_retries; size_t max_single_download_retries; ReadSettings read_settings; std::vector tmp_buffer; diff --git a/src/Disks/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp b/src/Disks/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp index b5c2bfab8b9c..f8d42f8e1002 100644 --- a/src/Disks/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp +++ b/src/Disks/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp @@ -190,7 +190,7 @@ std::unique_ptr AzureObjectStorage::readObject( /// NOLI auto settings_ptr = settings.get(); return std::make_unique( - client.get(), object.remote_path, patchSettings(read_settings), settings_ptr->max_single_read_retries, + client.get(), object.remote_path, patchSettings(read_settings), settings_ptr->max_single_download_retries); } @@ -212,7 +212,6 @@ std::unique_ptr AzureObjectStorage::readObjects( /// NOL client.get(), path, disk_read_settings, - settings_ptr->max_single_read_retries, settings_ptr->max_single_download_retries, /* use_external_buffer */true, restricted_seek); diff --git a/src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp b/src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp index 4714c7959278..fe07327c732f 100644 --- a/src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp +++ b/src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp @@ -326,7 +326,7 @@ void copyAzureBlobStorageFile( LOG_TRACE(&Poco::Logger::get("copyAzureBlobStorageFile"), "Reading from Container: {}, Blob: {}", src_container_for_logging, src_blob); auto create_read_buffer = [&] { - return std::make_unique(src_client, src_blob, read_settings, settings->max_single_read_retries, + return std::make_unique(src_client, src_blob, read_settings, settings->max_single_download_retries); }; From 35cc40b3e0484fc57acaa473e23e0325f26ba964 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Mon, 25 Mar 2024 19:45:05 +0100 Subject: [PATCH 02/12] Fix style check --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 2900473fd4e7..41cb2496228d 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -23,7 +23,6 @@ namespace ErrorCodes { extern const int CANNOT_SEEK_THROUGH_FILE; extern const int SEEK_POSITION_OUT_OF_BOUND; - extern const int RECEIVED_EMPTY_DATA; extern const int LOGICAL_ERROR; } @@ -196,7 +195,6 @@ size_t ReadBufferFromAzureBlobStorage::initialize() { try { - LOG_INFO(log, "Intialize buffer offset {} read_until_position {} data_capacity {} ",offset, read_until_position, data_capacity); auto download_response = blob_client->DownloadTo(reinterpret_cast(data_ptr), data_capacity, download_options); read_bytes = download_response.Value.ContentRange.Length.Value(); break; From e5cbc9fa5c8f711cb1d17b52dad8858ded5d8b76 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 26 Mar 2024 11:41:25 +0100 Subject: [PATCH 03/12] Fix test fails by adjusting read size to data capacity --- .../IO/ReadBufferFromAzureBlobStorage.cpp | 19 ++++++++++++------- src/Disks/IO/ReadBufferFromAzureBlobStorage.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 41cb2496228d..1ded7337e045 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -91,8 +91,7 @@ bool ReadBufferFromAzureBlobStorage::nextImpl() data_capacity = internal_buffer.size(); } - if (!initialized) - bytes_read = initialize(); + bytes_read = readBytes(); if (bytes_read == 0) return false; @@ -161,17 +160,23 @@ off_t ReadBufferFromAzureBlobStorage::getPosition() return offset - available(); } -size_t ReadBufferFromAzureBlobStorage::initialize() +size_t ReadBufferFromAzureBlobStorage::readBytes() { - if (initialized) - return 0; - Azure::Storage::Blobs::DownloadBlobToOptions download_options; Azure::Nullable length {}; + + /// 0 means read full file + size_t to_read_bytes = 0; if (read_until_position != 0) - length = {static_cast(read_until_position - offset)}; + to_read_bytes = std::min(read_until_position - offset, data_capacity); + + auto file_size = getFileSize(); + if (!to_read_bytes && (file_size > data_capacity)) + to_read_bytes = std::min(file_size, data_capacity); + if (to_read_bytes) + length = {static_cast(to_read_bytes)}; download_options.Range = {static_cast(offset), length}; if (!blob_client) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h index 5a364e981bef..2a664ff9781a 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h @@ -50,7 +50,7 @@ class ReadBufferFromAzureBlobStorage : public ReadBufferFromFileBase private: - size_t initialize(); + size_t readBytes(); std::shared_ptr blob_container_client; std::unique_ptr blob_client; From 67bbf886d21a81b26e10c01308b67d0c7b794033 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 26 Mar 2024 12:03:21 +0100 Subject: [PATCH 04/12] Fix build --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 1ded7337e045..758c2eb16f5f 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -169,7 +169,10 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() /// 0 means read full file size_t to_read_bytes = 0; if (read_until_position != 0) - to_read_bytes = std::min(read_until_position - offset, data_capacity); + { + to_read_bytes = read_until_position - offset; + to_read_bytes = std::min(to_read_bytes, data_capacity); + } auto file_size = getFileSize(); if (!to_read_bytes && (file_size > data_capacity)) From 32ee02a3ed7f72255ed98d5481bc6e5f3b49a7f2 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 26 Mar 2024 15:26:44 +0100 Subject: [PATCH 05/12] Fix parallel read --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 758c2eb16f5f..1c9ddd71c721 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -205,6 +205,10 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() { auto download_response = blob_client->DownloadTo(reinterpret_cast(data_ptr), data_capacity, download_options); read_bytes = download_response.Value.ContentRange.Length.Value(); + + if (read_settings.remote_throttler) + read_settings.remote_throttler->add(read_bytes, ProfileEvents::RemoteReadThrottlerBytes, ProfileEvents::RemoteReadThrottlerSleepMicroseconds); + break; } catch (const Azure::Core::RequestFailedException & e) @@ -242,12 +246,10 @@ size_t ReadBufferFromAzureBlobStorage::readBigAt(char * to, size_t n, size_t ran size_t bytes_copied = 0; try { - Azure::Storage::Blobs::DownloadBlobOptions download_options; + Azure::Storage::Blobs::DownloadBlobToOptions download_options; download_options.Range = {static_cast(range_begin), n}; - auto download_response = blob_client->Download(download_options); - - std::unique_ptr body_stream = std::move(download_response.Value.BodyStream); - bytes_copied = body_stream->ReadToCount(reinterpret_cast(to), body_stream->Length()); + auto download_response = blob_client->DownloadTo(reinterpret_cast(to), n, download_options); + bytes_copied = download_response.Value.ContentRange.Length.Value(); LOG_TEST(log, "AzureBlobStorage readBigAt read bytes {}", bytes_copied); From f8e75a00bdc5612e5e7d8cfc60444e903c7b2570 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Thu, 28 Mar 2024 18:21:53 +0100 Subject: [PATCH 06/12] Fix out of range issue --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 13 ++++++------- src/Disks/IO/ReadBufferFromAzureBlobStorage.h | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 1c9ddd71c721..a42c8ad14b99 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -167,20 +167,21 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() Azure::Nullable length {}; /// 0 means read full file - size_t to_read_bytes = 0; + int64_t to_read_bytes = 0; if (read_until_position != 0) { to_read_bytes = read_until_position - offset; - to_read_bytes = std::min(to_read_bytes, data_capacity); + to_read_bytes = std::min(to_read_bytes, static_cast(offset)); } - auto file_size = getFileSize(); - if (!to_read_bytes && (file_size > data_capacity)) - to_read_bytes = std::min(file_size, data_capacity); + if (!to_read_bytes && (getFileSize() > data_capacity)) + to_read_bytes = data_capacity; if (to_read_bytes) length = {static_cast(to_read_bytes)}; download_options.Range = {static_cast(offset), length}; + LOG_INFO(log, "Read bytes range is offset = {} and to_read_bytes = {}", offset, to_read_bytes); + if (!blob_client) blob_client = std::make_unique(blob_container_client->GetBlobClient(path)); @@ -217,8 +218,6 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() } } - total_size = read_bytes + offset; - initialized = true; return read_bytes; } diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h index 2a664ff9781a..04b022ecbbea 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.h +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.h @@ -70,7 +70,6 @@ class ReadBufferFromAzureBlobStorage : public ReadBufferFromFileBase off_t read_until_position = 0; off_t offset = 0; - size_t total_size; bool initialized = false; char * data_ptr; size_t data_capacity; From 689d0ae94a88f1a4c60bc25279d64e3ab89ed84f Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Mon, 1 Apr 2024 12:03:54 +0200 Subject: [PATCH 07/12] Fixed typo for calculating to_read_bytes --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index a42c8ad14b99..1731b4686695 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -171,7 +171,7 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() if (read_until_position != 0) { to_read_bytes = read_until_position - offset; - to_read_bytes = std::min(to_read_bytes, static_cast(offset)); + to_read_bytes = std::min(to_read_bytes, static_cast(data_capacity)); } if (!to_read_bytes && (getFileSize() > data_capacity)) From ccb055ccc56f1f829f2bb207836a8cc201b23465 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 2 Apr 2024 16:46:54 +0200 Subject: [PATCH 08/12] Fix updating offset after being initialized --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 1731b4686695..bffbe92a2a79 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -70,6 +70,8 @@ void ReadBufferFromAzureBlobStorage::setReadUntilEnd() void ReadBufferFromAzureBlobStorage::setReadUntilPosition(size_t position) { read_until_position = position; + offset = getPosition(); + resetWorkingBuffer(); initialized = false; } From 5c75f9076797c93b09bdf5a083644793347ad88e Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 2 Apr 2024 18:29:37 +0200 Subject: [PATCH 09/12] Updated log --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index bffbe92a2a79..829b5d2724cd 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -182,7 +182,7 @@ size_t ReadBufferFromAzureBlobStorage::readBytes() if (to_read_bytes) length = {static_cast(to_read_bytes)}; download_options.Range = {static_cast(offset), length}; - LOG_INFO(log, "Read bytes range is offset = {} and to_read_bytes = {}", offset, to_read_bytes); + LOG_INFO(log, "Read bytes range is offset = {}, read_until_position = {}, to_read_bytes = {}, data_capacity = {}, file_size = {}", offset, read_until_position, to_read_bytes, data_capacity, getFileSize()); if (!blob_client) From 54e86b364c70fd7a1d3470b13507f59860f64fed Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 2 Apr 2024 20:47:01 +0200 Subject: [PATCH 10/12] Fix issue for reading beyond fix size --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 829b5d2724cd..8dc7f70ac814 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -93,6 +93,9 @@ bool ReadBufferFromAzureBlobStorage::nextImpl() data_capacity = internal_buffer.size(); } + if (offset == getFileSize()) + return false; + bytes_read = readBytes(); if (bytes_read == 0) From 2dfe6b2d0fd6d36277e16d042e12a432e13879a6 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 2 Apr 2024 21:11:36 +0200 Subject: [PATCH 11/12] Fix build --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 8dc7f70ac814..9222fe73b54d 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -93,7 +93,7 @@ bool ReadBufferFromAzureBlobStorage::nextImpl() data_capacity = internal_buffer.size(); } - if (offset == getFileSize()) + if (static_cast(offset) == getFileSize()) return false; bytes_read = readBytes(); From fa4d205ad943c7db334dc8788538d08b5cbdaa32 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Wed, 3 Apr 2024 09:47:48 +0200 Subject: [PATCH 12/12] Update offset check --- src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp index 9222fe73b54d..9cd17061722b 100644 --- a/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp +++ b/src/Disks/IO/ReadBufferFromAzureBlobStorage.cpp @@ -93,7 +93,7 @@ bool ReadBufferFromAzureBlobStorage::nextImpl() data_capacity = internal_buffer.size(); } - if (static_cast(offset) == getFileSize()) + if (static_cast(offset) >= getFileSize()) return false; bytes_read = readBytes();