From 6318927fba01ab4e9a914586e83f899a7f2b2eea Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Fri, 15 Jul 2022 18:37:50 +0200 Subject: [PATCH] addressed review comment: ForkWriteBuffer for loop --- src/IO/ForkWriteBuffer.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/IO/ForkWriteBuffer.cpp b/src/IO/ForkWriteBuffer.cpp index e91f6ca433b..dd910f7fdf4 100644 --- a/src/IO/ForkWriteBuffer.cpp +++ b/src/IO/ForkWriteBuffer.cpp @@ -1,7 +1,5 @@ #include #include -#include - namespace DB { @@ -28,14 +26,14 @@ void ForkWriteBuffer::nextImpl() try { - for (const WriteBufferPtr & write_buffer : sources | std::views::reverse) + auto & source_buffer = sources.front(); + for (auto it = sources.begin() + 1; it != sources.end(); ++it) { - if (write_buffer != sources.front()) - { - write_buffer->write(sources.front()->buffer().begin(), sources.front()->offset()); - } - write_buffer->next(); + auto & buffer = *it; + buffer->write(source_buffer->buffer().begin(), source_buffer->offset()); + buffer->next(); } + source_buffer->next(); } catch (Exception & exception) {