This commit is contained in:
Nikita Mikhaylov 2021-03-12 13:58:03 +03:00
parent 38e1cb41cc
commit e4b4665ff5
4 changed files with 16 additions and 5 deletions

View File

@ -2096,9 +2096,9 @@ private:
current_format = "Vertical"; current_format = "Vertical";
/// It is not clear how to write progress with parallel formatting. It may increase code complexity significantly. /// It is not clear how to write progress with parallel formatting. It may increase code complexity significantly.
if (!need_render_progress) // if (!need_render_progress)
block_out_stream = context.getOutputStreamParallelIfPossible(current_format, *out_buf, block); // block_out_stream = context.getOutputStreamParallelIfPossible(current_format, *out_buf, block);
else // else
block_out_stream = context.getOutputStream(current_format, *out_buf, block); block_out_stream = context.getOutputStream(current_format, *out_buf, block);
block_out_stream->writePrefix(); block_out_stream->writePrefix();

View File

@ -6,6 +6,9 @@
#include <Common/ThreadPool.h> #include <Common/ThreadPool.h>
#include <common/logger_useful.h> #include <common/logger_useful.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include "IO/ReadBuffer.h"
#include "IO/ReadBufferFromString.h"
#include "IO/WriteBufferFromString.h"
#include <Formats/FormatFactory.h> #include <Formats/FormatFactory.h>
#include <Poco/Event.h> #include <Poco/Event.h>
#include <IO/BufferWithOwnMemory.h> #include <IO/BufferWithOwnMemory.h>
@ -104,6 +107,12 @@ public:
/// There are no formats which support parallel formatting and progress writing at the same time /// There are no formats which support parallel formatting and progress writing at the same time
void onProgress(const Progress &) override {} void onProgress(const Progress &) override {}
String getContentType() const override
{
WriteBufferFromOwnString buffer;
return internal_formatter_creator(buffer)->getContentType();
}
protected: protected:
void consume(Chunk chunk) override final void consume(Chunk chunk) override final
{ {

View File

@ -149,6 +149,8 @@ void WriteBufferFromHTTPServerResponse::onProgress(const Progress & progress)
{ {
std::lock_guard lock(mutex); std::lock_guard lock(mutex);
std::cout << StackTrace().toString() << std::endl;
/// Cannot add new headers if body was started to send. /// Cannot add new headers if body was started to send.
if (headers_finished_sending) if (headers_finished_sending)
return; return;

View File

@ -7,7 +7,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&max_block_size=5&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0" -d 'SELECT max(number) FROM numbers(10)' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse-Progress|^[0-9]' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&max_block_size=5&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0" -d 'SELECT max(number) FROM numbers(10)' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse-Progress|^[0-9]'
# This test will fail with external poco (progress not supported) # This test will fail with external poco (progress not supported)
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0" -d 'SELECT number FROM numbers(10)' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse-Progress|^[0-9]' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&output_format_parallel_formatting=0" -d 'SELECT number FROM numbers(10)' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse-Progress|^[0-9]'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d
# 'send_progress_in_http_headers' is false by default # 'send_progress_in_http_headers' is false by default