From 82948ac843a9573e4105b47e36d342d66a26e4e1 Mon Sep 17 00:00:00 2001 From: kssenii Date: Sat, 2 Sep 2023 13:52:15 +0200 Subject: [PATCH] Review fixes --- src/Common/ProfileEvents.cpp | 4 ++-- src/Disks/IO/AsynchronousBoundedReadBuffer.cpp | 3 ++- src/Disks/IO/ThreadPoolRemoteFSReader.cpp | 3 +-- src/Disks/IO/ThreadPoolRemoteFSReader.h | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Common/ProfileEvents.cpp b/src/Common/ProfileEvents.cpp index 30f469540a5..017edf882b8 100644 --- a/src/Common/ProfileEvents.cpp +++ b/src/Common/ProfileEvents.cpp @@ -451,8 +451,8 @@ The server successfully detected this situation and will download merged part fr M(ThreadPoolReaderPageCacheMissBytes, "Number of bytes read inside ThreadPoolReader when read was not done from page cache and was hand off to thread pool.") \ M(ThreadPoolReaderPageCacheMissElapsedMicroseconds, "Time spent reading data inside the asynchronous job in ThreadPoolReader - when read was not done from page cache.") \ \ - M(AsynchronousReadWaitMicroseconds, "Time spent in waiting for asynchronous reads.") \ - M(SynchronousReadWaitMicroseconds, "Time spent in waiting for synchronous reads.") \ + M(AsynchronousReadWaitMicroseconds, "Time spent in waiting for asynchronous reads in asynchronous local read.") \ + M(SynchronousReadWaitMicroseconds, "Time spent in waiting for synchronous reads in asynchronous local read.") \ M(AsynchronousRemoteReadWaitMicroseconds, "Time spent in waiting for asynchronous remote reads.") \ M(SynchronousRemoteReadWaitMicroseconds, "Time spent in waiting for synchronous remote reads.") \ \ diff --git a/src/Disks/IO/AsynchronousBoundedReadBuffer.cpp b/src/Disks/IO/AsynchronousBoundedReadBuffer.cpp index 6b903153fc4..86739fb38c6 100644 --- a/src/Disks/IO/AsynchronousBoundedReadBuffer.cpp +++ b/src/Disks/IO/AsynchronousBoundedReadBuffer.cpp @@ -200,11 +200,12 @@ bool AsynchronousBoundedReadBuffer::nextImpl() prefetch_future = {}; prefetch_buffer.swap(memory); - last_prefetch_info = {}; if (read_settings.enable_filesystem_read_prefetches_log) appendToPrefetchLog(FilesystemPrefetchState::USED, result.size, result.execution_watch); + last_prefetch_info = {}; + ProfileEvents::increment(ProfileEvents::RemoteFSPrefetchedReads); ProfileEvents::increment(ProfileEvents::RemoteFSPrefetchedBytes, result.size); } diff --git a/src/Disks/IO/ThreadPoolRemoteFSReader.cpp b/src/Disks/IO/ThreadPoolRemoteFSReader.cpp index cf2114bf145..0ec5e0fd6c1 100644 --- a/src/Disks/IO/ThreadPoolRemoteFSReader.cpp +++ b/src/Disks/IO/ThreadPoolRemoteFSReader.cpp @@ -86,8 +86,7 @@ IAsynchronousReader::Result ThreadPoolRemoteFSReader::execute(Request request) auto watch = std::make_unique(CLOCK_REALTIME); reader.set(request.buf, request.size); - if (request.offset) - reader.seek(request.offset, SEEK_SET); + reader.seek(request.offset, SEEK_SET); if (request.ignore) reader.ignore(request.ignore); diff --git a/src/Disks/IO/ThreadPoolRemoteFSReader.h b/src/Disks/IO/ThreadPoolRemoteFSReader.h index 1ff3c1091e8..192a12370e3 100644 --- a/src/Disks/IO/ThreadPoolRemoteFSReader.h +++ b/src/Disks/IO/ThreadPoolRemoteFSReader.h @@ -38,6 +38,7 @@ public: std::shared_ptr getReadCounters() const { return async_read_counters; } private: + /// Reader is used for reading only by RemoteFSFileDescriptor. SeekableReadBuffer & reader; std::shared_ptr async_read_counters; };