diff --git a/src/IO/AsynchronousWriteBuffer.h b/src/IO/AsynchronousWriteBuffer.h deleted file mode 100644 index 8c44f8c7d4a..00000000000 --- a/src/IO/AsynchronousWriteBuffer.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DB -{ - - -/** Writes data asynchronously using double buffering. - */ -class AsynchronousWriteBuffer : public WriteBuffer -{ -private: - WriteBuffer & out; /// The main buffer, responsible for writing data. - std::vector memory; /// A piece of memory for duplicating the buffer. - ThreadPool pool; /// For asynchronous data writing. - bool started; /// Has an asynchronous data write started? - - /// Swap the main and duplicate buffers. - void swapBuffers() - { - swap(out); - } - - void nextImpl() override - { - if (!offset()) - return; - - if (started) - pool.wait(); - else - started = true; - - swapBuffers(); - - /// The data will be written in separate stream. - pool.scheduleOrThrowOnError([this] { thread(); }); - } - -public: - AsynchronousWriteBuffer(WriteBuffer & out_) : WriteBuffer(nullptr, 0), out(out_), memory(out.buffer().size()), pool(1), started(false) - { - /// Data is written to the duplicate buffer. - set(memory.data(), memory.size()); - } - - ~AsynchronousWriteBuffer() override - { - /// FIXME move final flush into the caller - MemoryTracker::LockExceptionInThread lock; - - if (started) - pool.wait(); - - swapBuffers(); - out.next(); - } - - /// That is executed in a separate thread - void thread() - { - out.next(); - } -}; - -} diff --git a/src/IO/HexWriteBuffer.cpp b/src/IO/HexWriteBuffer.cpp deleted file mode 100644 index 4e3403ba74b..00000000000 --- a/src/IO/HexWriteBuffer.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include - - -namespace DB -{ - -void HexWriteBuffer::nextImpl() -{ - if (!offset()) - return; - - for (Position p = working_buffer.begin(); p != pos; ++p) - { - UInt8 byte = *p; - out.write(hexDigitUppercase(byte / 16)); - out.write(hexDigitUppercase(byte % 16)); - } -} - -HexWriteBuffer::~HexWriteBuffer() -{ - /// FIXME move final flush into the caller - MemoryTracker::LockExceptionInThread lock; - nextImpl(); -} - -} diff --git a/src/IO/HexWriteBuffer.h b/src/IO/HexWriteBuffer.h deleted file mode 100644 index a68dd29065b..00000000000 --- a/src/IO/HexWriteBuffer.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - - -/// Since HexWriteBuffer is often created in the inner loop, we'll make its buffer size small. -#define DBMS_HEX_WRITE_BUFFER_SIZE 32 - - -namespace DB -{ - -/** Everything that is written into it, translates to HEX (in capital letters) and writes to another WriteBuffer. - */ -class HexWriteBuffer final : public WriteBuffer -{ -protected: - char buf[DBMS_HEX_WRITE_BUFFER_SIZE]; //-V730 - WriteBuffer & out; - - void nextImpl() override; - -public: - HexWriteBuffer(WriteBuffer & out_) : WriteBuffer(buf, sizeof(buf)), out(out_) {} - ~HexWriteBuffer() override; -}; - -} diff --git a/src/IO/tests/CMakeLists.txt b/src/IO/tests/CMakeLists.txt index fcd59d94cb0..79800d8339c 100644 --- a/src/IO/tests/CMakeLists.txt +++ b/src/IO/tests/CMakeLists.txt @@ -25,9 +25,6 @@ target_link_libraries (var_uint PRIVATE clickhouse_common_io) add_executable (read_escaped_string read_escaped_string.cpp) target_link_libraries (read_escaped_string PRIVATE clickhouse_common_io) -add_executable (async_write async_write.cpp) -target_link_libraries (async_write PRIVATE dbms) - add_executable (parse_int_perf parse_int_perf.cpp) target_link_libraries (parse_int_perf PRIVATE clickhouse_common_io) diff --git a/src/IO/tests/async_write.cpp b/src/IO/tests/async_write.cpp deleted file mode 100644 index e3bff7cf341..00000000000 --- a/src/IO/tests/async_write.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include -#include -#include -#include -#include - - -int main(int, char **) -try -{ - DB::ReadBufferFromFileDescriptor in1(STDIN_FILENO); - DB::WriteBufferFromFileDescriptor out1(STDOUT_FILENO); - DB::AsynchronousWriteBuffer out2(out1); - DB::CompressedWriteBuffer out3(out2); - - DB::copyData(in1, out3); - - return 0; -} -catch (const DB::Exception & e) -{ - std::cerr << e.what() << ", " << e.displayText() << std::endl; - return 1; -} diff --git a/src/IO/tests/parse_int_perf.cpp b/src/IO/tests/parse_int_perf.cpp index 93f49d80258..e35a3d8a857 100644 --- a/src/IO/tests/parse_int_perf.cpp +++ b/src/IO/tests/parse_int_perf.cpp @@ -62,7 +62,6 @@ int main(int argc, char ** argv) { DB::WriteBufferFromVector wb(formatted); // DB::CompressedWriteBuffer wb2(wb1); - // DB::AsynchronousWriteBuffer wb(wb2); Stopwatch watch; UInt64 tsc = rdtsc(); diff --git a/src/IO/ya.make b/src/IO/ya.make index 980719aa74f..6605cf64277 100644 --- a/src/IO/ya.make +++ b/src/IO/ya.make @@ -29,7 +29,6 @@ SRCS( HTTPChunkedReadBuffer.cpp HTTPCommon.cpp HashingWriteBuffer.cpp - HexWriteBuffer.cpp LZMADeflatingWriteBuffer.cpp LZMAInflatingReadBuffer.cpp LimitReadBuffer.cpp diff --git a/src/Interpreters/Cluster.cpp b/src/Interpreters/Cluster.cpp index c9c56c96cbe..fb9788e84c4 100644 --- a/src/Interpreters/Cluster.cpp +++ b/src/Interpreters/Cluster.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index 2d841b98c59..d9e24581c0c 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include