Disable compression for Log packets. [#CLICKHOUSE-2910]

This commit is contained in:
Vitaliy Lyudvichenko 2018-06-14 18:33:59 +03:00
parent e5e73d4a9b
commit 608895d9ff
5 changed files with 22 additions and 31 deletions

View File

@ -742,7 +742,14 @@ void TCPHandler::initBlockOutput(const Block & block)
{
if (!state.block_out)
{
initOutputBuffers();
if (!state.maybe_compressed_out)
{
if (state.compression == Protocol::Compression::Enable)
state.maybe_compressed_out = std::make_shared<CompressedWriteBuffer>(
*out, CompressionSettings(query_context.getSettingsRef()));
else
state.maybe_compressed_out = out;
}
state.block_out = std::make_shared<NativeBlockOutputStream>(
*state.maybe_compressed_out,
@ -755,29 +762,15 @@ void TCPHandler::initLogsBlockOutput(const Block & block)
{
if (!state.logs_block_out)
{
initOutputBuffers();
/// Use uncompressed stream since log blocks usually contain only one row
state.logs_block_out = std::make_shared<NativeBlockOutputStream>(
*state.maybe_compressed_out,
*out,
client_revision,
block.cloneEmpty());
}
}
void TCPHandler::initOutputBuffers()
{
if (!state.maybe_compressed_out)
{
if (state.compression == Protocol::Compression::Enable)
state.maybe_compressed_out = std::make_shared<CompressedWriteBuffer>(
*out, CompressionSettings(query_context.getSettingsRef()));
else
state.maybe_compressed_out = out;
}
}
bool TCPHandler::isQueryCancelled()
{
if (state.is_cancelled || state.sent_all_data)
@ -835,7 +828,6 @@ void TCPHandler::sendLogData(const Block & block)
writeStringBinary("", *out);
state.logs_block_out->write(block);
state.maybe_compressed_out->next();
out->next();
}

View File

@ -157,7 +157,6 @@ private:
void initBlockInput();
void initBlockOutput(const Block & block);
void initLogsBlockOutput(const Block & block);
void initOutputBuffers();
bool isQueryCancelled();

View File

@ -639,13 +639,7 @@ Block Connection::receiveDataImpl(BlockInputStreamPtr & stream)
void Connection::initInputBuffers()
{
if (!maybe_compressed_in)
{
if (compression == Protocol::Compression::Enable)
maybe_compressed_in = std::make_shared<CompressedReadBuffer>(*in);
else
maybe_compressed_in = in;
}
}
@ -653,7 +647,14 @@ void Connection::initBlockInput()
{
if (!block_in)
{
initInputBuffers();
if (!maybe_compressed_in)
{
if (compression == Protocol::Compression::Enable)
maybe_compressed_in = std::make_shared<CompressedReadBuffer>(*in);
else
maybe_compressed_in = in;
}
block_in = std::make_shared<NativeBlockInputStream>(*maybe_compressed_in, server_revision);
}
}
@ -663,9 +664,8 @@ void Connection::initBlockLogsInput()
{
if (!block_logs_in)
{
initInputBuffers();
/// Have to return superset of SystemLogsQueue::getSampleBlock() columns
block_logs_in = std::make_shared<NativeBlockInputStream>(*maybe_compressed_in, server_revision);
block_logs_in = std::make_shared<NativeBlockInputStream>(*in, server_revision);
}
}

View File

@ -61,7 +61,7 @@
#define DBMS_MIN_REVISION_WITH_TABLES_STATUS 54226
#define DBMS_MIN_REVISION_WITH_TIME_ZONE_PARAMETER_IN_DATETIME_DATA_TYPE 54337
#define DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME 54372
#define DBMS_MIN_REVISION_WITH_SERVER_LOGS 54382
#define DBMS_MIN_REVISION_WITH_SERVER_LOGS 54386
/// Version of ClickHouse TCP protocol. Set to git tag with latest protocol change.
#define DBMS_TCP_PROTOCOL_VERSION 54226

View File

@ -15,7 +15,7 @@ ${CLICKHOUSE_CLIENT} --query "INSERT INTO test_truncate.test_view_depend VALUES(
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_truncate.test_view;"
${CLICKHOUSE_CLIENT} --query "SELECT '========Execute Truncate========';"
echo `${CLICKHOUSE_CLIENT} --query "TRUNCATE TABLE test_truncate.test_view;" 2>&1 | grep -c "Code: 48.*Truncate is not supported by storage View"`
echo `${CLICKHOUSE_CLIENT} --query "TRUNCATE TABLE test_truncate.test_view;" --server_logs_file=/dev/null 2>&1 | grep -c "Code: 48.*Truncate is not supported by storage View"`
${CLICKHOUSE_CLIENT} --query "SELECT '========After Truncate========';"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_truncate.test_view;"