diff --git a/dbms/src/Common/CurrentMetrics.cpp b/dbms/src/Common/CurrentMetrics.cpp index 070afd3b231..b8e30f3cccd 100644 --- a/dbms/src/Common/CurrentMetrics.cpp +++ b/dbms/src/Common/CurrentMetrics.cpp @@ -45,6 +45,10 @@ M(RWLockWaitingWriters, "Number of threads waiting for write on a table RWLock.") \ M(RWLockActiveReaders, "Number of threads holding read lock in a table RWLock.") \ M(RWLockActiveWriters, "Number of threads holding write lock in a table RWLock.") \ + M(GlobalThread, "Number of threads in global thread pool.") \ + M(GlobalThreadActive, "Number of threads in global thread pool running a task.") \ + M(LocalThread, "Number of threads in local thread pools. Should be similar to GlobalThreadActive.") \ + M(LocalThreadActive, "Number of threads in local thread pools running a task.") \ namespace CurrentMetrics diff --git a/dbms/src/Common/ThreadPool.cpp b/dbms/src/Common/ThreadPool.cpp index 91ec29dc188..cb08fa944a9 100644 --- a/dbms/src/Common/ThreadPool.cpp +++ b/dbms/src/Common/ThreadPool.cpp @@ -13,6 +13,14 @@ namespace DB } } +namespace CurrentMetrics +{ + extern const Metric GlobalThread; + extern const Metric GlobalThreadActive; + extern const Metric LocalThread; + extern const Metric LocalThreadActive; +} + template ThreadPoolImpl::ThreadPoolImpl(size_t max_threads) @@ -148,6 +156,9 @@ size_t ThreadPoolImpl::active() const template void ThreadPoolImpl::worker(typename std::list::iterator thread_it) { + CurrentMetrics::Increment metric_all_threads( + std::is_same_v ? CurrentMetrics::GlobalThread : CurrentMetrics::LocalThread); + while (true) { Job job; @@ -174,6 +185,9 @@ void ThreadPoolImpl::worker(typename std::list::iterator thread_ { try { + CurrentMetrics::Increment metric_active_threads( + std::is_same_v ? CurrentMetrics::GlobalThreadActive : CurrentMetrics::LocalThreadActive); + job(); } catch (...) diff --git a/dbms/src/Interpreters/PartLog.cpp b/dbms/src/Interpreters/PartLog.cpp index 509be3b9c25..a10f6a5cadc 100644 --- a/dbms/src/Interpreters/PartLog.cpp +++ b/dbms/src/Interpreters/PartLog.cpp @@ -22,11 +22,11 @@ Block PartLogElement::createBlock() auto event_type_datatype = std::make_shared( DataTypeEnum8::Values { - {"NEW_PART", static_cast(NEW_PART)}, - {"MERGE_PARTS", static_cast(MERGE_PARTS)}, - {"DOWNLOAD_PART", static_cast(DOWNLOAD_PART)}, - {"REMOVE_PART", static_cast(REMOVE_PART)}, - {"MUTATE_PART", static_cast(MUTATE_PART)}, + {"NewPart", static_cast(NEW_PART)}, + {"MergeParts", static_cast(MERGE_PARTS)}, + {"DownloadPart", static_cast(DOWNLOAD_PART)}, + {"RemovePart", static_cast(REMOVE_PART)}, + {"MutatePart", static_cast(MUTATE_PART)}, }); return diff --git a/dbms/src/Interpreters/QueryLog.cpp b/dbms/src/Interpreters/QueryLog.cpp index 2bc49c42b4b..52e552d833f 100644 --- a/dbms/src/Interpreters/QueryLog.cpp +++ b/dbms/src/Interpreters/QueryLog.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -20,11 +21,22 @@ namespace DB { +template <> struct NearestFieldTypeImpl { using Type = UInt64; }; + Block QueryLogElement::createBlock() { + auto query_status_datatype = std::make_shared( + DataTypeEnum8::Values + { + {"QueryStart", static_cast(QUERY_START)}, + {"QueryFinish", static_cast(QUERY_FINISH)}, + {"ExceptionBeforeStart", static_cast(EXCEPTION_BEFORE_START)}, + {"ExceptionWhileProcessing", static_cast(EXCEPTION_WHILE_PROCESSING)} + }); + return { - {std::make_shared(), "type"}, + {std::move(query_status_datatype), "type"}, {std::make_shared(), "event_date"}, {std::make_shared(), "event_time"}, {std::make_shared(), "query_start_time"}, @@ -80,7 +92,7 @@ void QueryLogElement::appendToBlock(Block & block) const size_t i = 0; - columns[i++]->insert(UInt64(type)); + columns[i++]->insert(type); columns[i++]->insert(DateLUT::instance().toDayNum(event_time)); columns[i++]->insert(event_time); columns[i++]->insert(query_start_time); diff --git a/docs/en/interfaces/formats.md b/docs/en/interfaces/formats.md index 8c9badaa02f..46a553089d9 100644 --- a/docs/en/interfaces/formats.md +++ b/docs/en/interfaces/formats.md @@ -173,7 +173,7 @@ Empty unquoted input values are replaced with default values for the respective [input_format_defaults_for_omitted_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) is enabled. -`NULL` is formatted as `\N` or `NULL` or an empty unquoted string (see settings [input_format_csv_unquoted_null_literal_as_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) and [input_format_defaults_for_omitted_fields](../operations/settings/settings.md#settings-input_format_defaults_for_omitted_fields)). +`NULL` is formatted as `\N` or `NULL` or an empty unquoted string (see settings [input_format_csv_unquoted_null_literal_as_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) and [input_format_defaults_for_omitted_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). The CSV format supports the output of totals and extremes the same way as `TabSeparated`. diff --git a/docs/en/operations/table_engines/aggregatingmergetree.md b/docs/en/operations/table_engines/aggregatingmergetree.md index 0a3b1dcf35d..bab352d5cb5 100644 --- a/docs/en/operations/table_engines/aggregatingmergetree.md +++ b/docs/en/operations/table_engines/aggregatingmergetree.md @@ -21,6 +21,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] [PARTITION BY expr] [ORDER BY expr] [SAMPLE BY expr] +[TTL expr] [SETTINGS name=value, ...] ``` diff --git a/docs/ru/interfaces/formats.md b/docs/ru/interfaces/formats.md index 14d6408b7e7..20aa78630b7 100644 --- a/docs/ru/interfaces/formats.md +++ b/docs/ru/interfaces/formats.md @@ -165,7 +165,7 @@ clickhouse-client --format_csv_delimiter="|" --query="INSERT INTO test.csv FORMA При парсинге, все значения могут парситься как в кавычках, так и без кавычек. Поддерживаются как двойные, так и одинарные кавычки. Строки также могут быть без кавычек. В этом случае они парсятся до символа-разделителя или перевода строки (CR или LF). В нарушение RFC, в случае парсинга строк не в кавычках, начальные и конечные пробелы и табы игнорируются. В качестве перевода строки, поддерживаются как Unix (LF), так и Windows (CR LF) и Mac OS Classic (LF CR) варианты. -`NULL` форматируется в виде `\N` или `NULL` или пустой неэкранированной строки (см. настройки [input_format_csv_unquoted_null_literal_as_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) и [input_format_defaults_for_omitted_fields](../operations/settings/settings.md#settings-input_format_defaults_for_omitted_fields)). +`NULL` форматируется в виде `\N` или `NULL` или пустой неэкранированной строки (см. настройки [input_format_csv_unquoted_null_literal_as_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) и [input_format_defaults_for_omitted_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). Если установлена настройка [input_format_defaults_for_omitted_fields = 1](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) и тип столбца не `Nullable(T)`, то пустые значения без кавычек заменяются значениями по умолчанию для типа данных столбца.