Now stacked logs are received in appropriate way.

This commit is contained in:
Dmitry Rubashkin 2019-08-29 20:30:16 +03:00
parent 4bd79c47dc
commit 876847f3f7
3 changed files with 17 additions and 8 deletions

View File

@ -1026,14 +1026,10 @@ private:
while (true)
{
Block block = async_block_input->read();
auto packet_type = connection->checkPacket();
/// Check if server send Log packet
if (packet_type && *packet_type == Protocol::Server::Log)
receiveAndProcessPacket();
receiveLogs();
/// Check if server send Exception packet
packet_type = connection->checkPacket();
auto packet_type = connection->checkPacket();
if (packet_type && *packet_type == Protocol::Server::Exception)
return;
@ -1255,6 +1251,17 @@ private:
}
}
/// Process Log packets, used when inserting data by blocks
void receiveLogs()
{
auto packet_type = connection->checkPacket();
while (packet_type && *packet_type == Protocol::Server::Log)
{
receiveAndProcessPacket();
packet_type = connection->checkPacket();
}
}
void initBlockOutputStream(const Block & block)
{

View File

@ -1 +1 @@
Got exception on client.
OK

View File

@ -3,10 +3,12 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
CLICKHOUSE_CLIENT=`echo ${CLICKHOUSE_CLIENT} | sed 's/'"--send_logs_level=${CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL}"'/--send_logs_level=none/g'`
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS check;"
$CLICKHOUSE_CLIENT --query="CREATE TABLE check (x UInt64, y UInt64 DEFAULT throwIf(x > 10000000)) ENGINE = Memory;"
seq 1 11000000 | $CLICKHOUSE_CLIENT --query="INSERT INTO check(x) FORMAT TSV" 2>&1 | grep -q "Value passed to 'throwIf' function is non zero." && echo "Got exception on client." ||:
seq 1 11000000 | $CLICKHOUSE_CLIENT --query="INSERT INTO check(x) FORMAT TSV" 2>&1 | grep -q "Value passed to 'throwIf' function is non zero." && echo 'OK' || echo 'FAIL' ||:
$CLICKHOUSE_CLIENT --query="DROP TABLE check;"