Merge branch 'master' of github.com:ClickHouse/ClickHouse into cache-dictionary

This commit is contained in:
Nikita Mikhaylov 2019-12-26 12:29:32 +03:00
commit 230694e17d
2 changed files with 18 additions and 0 deletions

View File

@ -11,6 +11,10 @@
#include <Processors/ISource.h>
#include <Common/setThreadName.h>
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <sched.h>
#endif
namespace DB
{
@ -452,6 +456,17 @@ void PipelineExecutor::execute(size_t num_threads)
void PipelineExecutor::executeSingleThread(size_t thread_num, size_t num_threads)
{
#if !defined(__APPLE__) && !defined(__FreeBSD__)
/// Specify CPU core for thread if can.
/// It may reduce the number of context swithches.
cpu_set_t cpu_set;
CPU_ZERO(&cpu_set);
CPU_SET(thread_num, &cpu_set);
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpu_set) == -1)
LOG_TRACE(log, "Cannot set affinity for thread " << num_threads);
#endif
UInt64 total_time_ns = 0;
UInt64 execution_time_ns = 0;
UInt64 processing_time_ns = 0;

View File

@ -47,6 +47,9 @@ void MySQLOutputFormat::initialize()
void MySQLOutputFormat::consume(Chunk chunk)
{
initialize();
for (size_t i = 0; i < chunk.getNumRows(); i++)
{
ProtocolText::ResultsetRow row_packet(data_types, chunk.getColumns(), i);