From 16d6c4f9e73f22aaf917193b8866d925066740a9 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 16 Aug 2017 23:27:35 +0300 Subject: [PATCH] Removed very old protocol compatibility features [#CLICKHOUSE-2]. --- dbms/src/Client/Connection.cpp | 23 ++++--------------- dbms/src/Core/Defines.h | 3 --- dbms/src/Core/Progress.cpp | 8 ++----- .../DataStreams/NativeBlockInputStream.cpp | 2 +- dbms/src/DataStreams/NativeBlockInputStream.h | 3 +-- .../DataStreams/NativeBlockOutputStream.cpp | 2 +- .../src/DataStreams/NativeBlockOutputStream.h | 3 +-- dbms/src/Server/TCPHandler.cpp | 15 ++++-------- 8 files changed, 16 insertions(+), 43 deletions(-) diff --git a/dbms/src/Client/Connection.cpp b/dbms/src/Client/Connection.cpp index d66571a664..8054699c7e 100644 --- a/dbms/src/Client/Connection.cpp +++ b/dbms/src/Client/Connection.cpp @@ -351,8 +351,8 @@ void Connection::sendQuery( block_in.reset(); block_out.reset(); - /// If server version is new enough, send empty block which meand end of data. - if (server_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES && !with_pending_data) + /// Send empty block which means end of data. + if (!with_pending_data) { sendData(Block()); out->next(); @@ -384,9 +384,7 @@ void Connection::sendData(const Block & block, const String & name) } writeVarUInt(Protocol::Client::Data, *out); - - if (server_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - writeStringBinary(name, *out); + writeStringBinary(name, *out); size_t prev_bytes = out->count(); @@ -405,9 +403,7 @@ void Connection::sendPreparedData(ReadBuffer & input, size_t size, const String /// NOTE 'Throttler' is not used in this method (could use, but it's not important right now). writeVarUInt(Protocol::Client::Data, *out); - - if (server_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - writeStringBinary(name, *out); + writeStringBinary(name, *out); if (0 == size) copyData(input, *out); @@ -419,13 +415,6 @@ void Connection::sendPreparedData(ReadBuffer & input, size_t size, const String void Connection::sendExternalTablesData(ExternalTablesData & data) { - /// If working with older server, don't send any info. - if (server_revision < DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - { - out->next(); - return; - } - if (data.empty()) { /// Send empty block, which means end of data transfer. @@ -552,9 +541,7 @@ Block Connection::receiveData() initBlockInput(); String external_table_name; - - if (server_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - readStringBinary(external_table_name, *in); + readStringBinary(external_table_name, *in); size_t prev_bytes = in->count(); diff --git a/dbms/src/Core/Defines.h b/dbms/src/Core/Defines.h index 08184f55f8..10ba703083 100644 --- a/dbms/src/Core/Defines.h +++ b/dbms/src/Core/Defines.h @@ -61,9 +61,6 @@ /// Name suffix for the column containing the array offsets. #define ARRAY_SIZES_COLUMN_NAME_SUFFIX ".size" -#define DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES 50264 -#define DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS 51554 -#define DBMS_MIN_REVISION_WITH_BLOCK_INFO 51903 #define DBMS_MIN_REVISION_WITH_CLIENT_INFO 54032 #define DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE 54058 #define DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO 54060 diff --git a/dbms/src/Core/Progress.cpp b/dbms/src/Core/Progress.cpp index c96038ba29..540be33f6f 100644 --- a/dbms/src/Core/Progress.cpp +++ b/dbms/src/Core/Progress.cpp @@ -17,9 +17,7 @@ void Progress::read(ReadBuffer & in, UInt64 server_revision) readVarUInt(new_rows, in); readVarUInt(new_bytes, in); - - if (server_revision >= DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS) - readVarUInt(new_total_rows, in); + readVarUInt(new_total_rows, in); rows = new_rows; bytes = new_bytes; @@ -31,9 +29,7 @@ void Progress::write(WriteBuffer & out, UInt64 client_revision) const { writeVarUInt(rows.load(), out); writeVarUInt(bytes.load(), out); - - if (client_revision >= DBMS_MIN_REVISION_WITH_TOTAL_ROWS_IN_PROGRESS) - writeVarUInt(total_rows.load(), out); + writeVarUInt(total_rows.load(), out); } diff --git a/dbms/src/DataStreams/NativeBlockInputStream.cpp b/dbms/src/DataStreams/NativeBlockInputStream.cpp index b153cf2bd5..a65cd6719e 100644 --- a/dbms/src/DataStreams/NativeBlockInputStream.cpp +++ b/dbms/src/DataStreams/NativeBlockInputStream.cpp @@ -106,7 +106,7 @@ Block NativeBlockInputStream::readImpl() } /// Additional information about the block. - if (server_revision >= DBMS_MIN_REVISION_WITH_BLOCK_INFO) + if (server_revision > 0) res.info.read(istr); /// Dimensions diff --git a/dbms/src/DataStreams/NativeBlockInputStream.h b/dbms/src/DataStreams/NativeBlockInputStream.h index 2efbf7cd3c..b1df20a782 100644 --- a/dbms/src/DataStreams/NativeBlockInputStream.h +++ b/dbms/src/DataStreams/NativeBlockInputStream.h @@ -60,8 +60,7 @@ struct IndexForNativeFormat class NativeBlockInputStream : public IProfilingBlockInputStream { public: - /** If a non-zero server_revision is specified, additional block information may be expected and read, - * depending on what is supported for the specified revision. + /** If a non-zero server_revision is specified, additional block information may be expected and read. * * `index` is not required parameter. If set, only parts of columns specified in the index will be read. */ diff --git a/dbms/src/DataStreams/NativeBlockOutputStream.cpp b/dbms/src/DataStreams/NativeBlockOutputStream.cpp index 763ffabb7e..b9cfc0fbac 100644 --- a/dbms/src/DataStreams/NativeBlockOutputStream.cpp +++ b/dbms/src/DataStreams/NativeBlockOutputStream.cpp @@ -116,7 +116,7 @@ void NativeBlockOutputStream::writeData(const IDataType & type, const ColumnPtr void NativeBlockOutputStream::write(const Block & block) { /// Additional information about the block. - if (client_revision >= DBMS_MIN_REVISION_WITH_BLOCK_INFO) + if (client_revision > 0) block.info.write(ostr); /// Dimensions diff --git a/dbms/src/DataStreams/NativeBlockOutputStream.h b/dbms/src/DataStreams/NativeBlockOutputStream.h index 16ba2415cc..d76cb82786 100644 --- a/dbms/src/DataStreams/NativeBlockOutputStream.h +++ b/dbms/src/DataStreams/NativeBlockOutputStream.h @@ -20,8 +20,7 @@ class CompressedWriteBuffer; class NativeBlockOutputStream : public IBlockOutputStream { public: - /** If non-zero client_revision is specified, additional block information can be written, - * depending on what is supported for the specified revision. + /** If non-zero client_revision is specified, additional block information can be written. */ NativeBlockOutputStream( WriteBuffer & ostr_, UInt64 client_revision_ = 0, diff --git a/dbms/src/Server/TCPHandler.cpp b/dbms/src/Server/TCPHandler.cpp index d93d60bd61..011454a515 100644 --- a/dbms/src/Server/TCPHandler.cpp +++ b/dbms/src/Server/TCPHandler.cpp @@ -144,8 +144,7 @@ void TCPHandler::runImpl() continue; /// Get blocks of temporary tables - if (client_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - readData(global_settings); + readData(global_settings); /// Reset the input stream, as we received an empty block while receiving external table data. /// So, the stream has been marked as cancelled and we can't read from it anymore. @@ -416,8 +415,7 @@ void TCPHandler::sendTotals() initBlockOutput(); writeVarUInt(Protocol::Server::Totals, *out); - if (client_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - writeStringBinary("", *out); + writeStringBinary("", *out); state.block_out->write(totals); state.maybe_compressed_out->next(); @@ -438,8 +436,7 @@ void TCPHandler::sendExtremes() initBlockOutput(); writeVarUInt(Protocol::Server::Extremes, *out); - if (client_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - writeStringBinary("", *out); + writeStringBinary("", *out); state.block_out->write(extremes); state.maybe_compressed_out->next(); @@ -612,8 +609,7 @@ bool TCPHandler::receiveData() /// The name of the temporary table for writing data, default to empty string String external_table_name; - if (client_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - readStringBinary(external_table_name, *in); + readStringBinary(external_table_name, *in); /// Read one block from the network and write it down Block block = state.block_in->read(); @@ -717,8 +713,7 @@ void TCPHandler::sendData(Block & block) initBlockOutput(); writeVarUInt(Protocol::Server::Data, *out); - if (client_revision >= DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES) - writeStringBinary("", *out); + writeStringBinary("", *out); state.block_out->write(block); state.maybe_compressed_out->next();