mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-30 05:30:51 +00:00
Merge branch 'master' into database_atomic
This commit is contained in:
commit
615aec8f4d
128
.clang-tidy
128
.clang-tidy
@ -1,2 +1,128 @@
|
|||||||
Checks: '-*,google-readability-avoid-underscore-in-googletest-name,misc-throw-by-value-catch-by-reference,misc-misplaced-const,misc-unconventional-assign-operator,modernize-avoid-bind,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-random-shuffle,modernize-use-bool-literals,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-for-range-copy,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-convert-member-functions-to-static,readability-delete-null-pointer,readability-deleted-default,readability-make-member-function-const,readability-misplaced-array-index,readability-non-const-parameter,readability-qualified-auto,readability-redundant-access-specifiers,readability-redundant-control-flow,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,modernize-use-equals-default,modernize-use-equals-delete,bugprone-undelegated-constructor,readability-redundant-member-init,readability-simplify-subscript-expr,readability-simplify-boolean-expr,readability-inconsistent-declaration-parameter-name'
|
Checks: '-*,
|
||||||
|
misc-throw-by-value-catch-by-reference,
|
||||||
|
misc-misplaced-const,
|
||||||
|
misc-unconventional-assign-operator,
|
||||||
|
misc-redundant-expression,
|
||||||
|
misc-static-assert,
|
||||||
|
misc-unconventional-assign-operator,
|
||||||
|
misc-uniqueptr-reset-release,
|
||||||
|
misc-unused-alias-decls,
|
||||||
|
misc-unused-parameters,
|
||||||
|
misc-unused-using-decls,
|
||||||
|
|
||||||
|
modernize-avoid-bind,
|
||||||
|
modernize-loop-convert,
|
||||||
|
modernize-make-shared,
|
||||||
|
modernize-make-unique,
|
||||||
|
modernize-raw-string-literal,
|
||||||
|
modernize-redundant-void-arg,
|
||||||
|
modernize-replace-auto-ptr,
|
||||||
|
modernize-replace-random-shuffle,
|
||||||
|
modernize-use-bool-literals,
|
||||||
|
modernize-use-nullptr,
|
||||||
|
modernize-use-using,
|
||||||
|
modernize-use-equals-default,
|
||||||
|
modernize-use-equals-delete,
|
||||||
|
|
||||||
|
performance-faster-string-find,
|
||||||
|
performance-for-range-copy,
|
||||||
|
performance-implicit-conversion-in-loop,
|
||||||
|
performance-inefficient-algorithm,
|
||||||
|
performance-inefficient-vector-operation,
|
||||||
|
performance-move-constructor-init,
|
||||||
|
performance-no-automatic-move,
|
||||||
|
performance-trivially-destructible,
|
||||||
|
performance-unnecessary-copy-initialization,
|
||||||
|
|
||||||
|
readability-avoid-const-params-in-decls,
|
||||||
|
readability-const-return-type,
|
||||||
|
readability-container-size-empty,
|
||||||
|
readability-convert-member-functions-to-static,
|
||||||
|
readability-delete-null-pointer,
|
||||||
|
readability-deleted-default,
|
||||||
|
readability-make-member-function-const,
|
||||||
|
readability-misplaced-array-index,
|
||||||
|
readability-non-const-parameter,
|
||||||
|
readability-qualified-auto,
|
||||||
|
readability-redundant-access-specifiers,
|
||||||
|
readability-redundant-control-flow,
|
||||||
|
readability-redundant-function-ptr-dereference,
|
||||||
|
readability-redundant-smartptr-get,
|
||||||
|
readability-redundant-string-cstr,
|
||||||
|
readability-redundant-string-init,
|
||||||
|
readability-static-definition-in-anonymous-namespace,
|
||||||
|
readability-string-compare,
|
||||||
|
readability-uniqueptr-delete-release,
|
||||||
|
readability-redundant-member-init,
|
||||||
|
readability-simplify-subscript-expr,
|
||||||
|
readability-simplify-boolean-expr,
|
||||||
|
readability-inconsistent-declaration-parameter-name,
|
||||||
|
|
||||||
|
bugprone-undelegated-constructor,
|
||||||
|
bugprone-argument-comment,
|
||||||
|
bugprone-bad-signal-to-kill-thread,
|
||||||
|
bugprone-bool-pointer-implicit-conversion,
|
||||||
|
bugprone-copy-constructor-init,
|
||||||
|
bugprone-dangling-handle,
|
||||||
|
bugprone-forward-declaration-namespace,
|
||||||
|
bugprone-fold-init-type,
|
||||||
|
bugprone-inaccurate-erase,
|
||||||
|
bugprone-incorrect-roundings,
|
||||||
|
bugprone-infinite-loop,
|
||||||
|
bugprone-integer-division,
|
||||||
|
bugprone-macro-parentheses,
|
||||||
|
bugprone-macro-repeated-side-effects,
|
||||||
|
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||||
|
bugprone-misplaced-pointer-artithmetic-in-alloc,
|
||||||
|
bugprone-misplaced-widening-cast,
|
||||||
|
bugprone-move-forwarding-reference,
|
||||||
|
bugprone-multiple-statement-macro,
|
||||||
|
bugprone-parent-virtual-call,
|
||||||
|
bugprone-posix-return,
|
||||||
|
bugprone-reserved-identifier,
|
||||||
|
bugprone-signed-char-misuse,
|
||||||
|
bugprone-sizeof-container,
|
||||||
|
bugprone-sizeof-expression,
|
||||||
|
bugprone-string-constructor,
|
||||||
|
bugprone-string-integer-assignment,
|
||||||
|
bugprone-string-literal-with-embedded-nul,
|
||||||
|
bugprone-suspicious-enum-usage,
|
||||||
|
bugprone-suspicious-include,
|
||||||
|
bugprone-suspicious-memset-usage,
|
||||||
|
bugprone-suspicious-missing-comma,
|
||||||
|
bugprone-suspicious-string-compare,
|
||||||
|
bugprone-swapped-arguments,
|
||||||
|
bugprone-terminating-continue,
|
||||||
|
bugprone-throw-keyword-missing,
|
||||||
|
bugprone-too-small-loop-variable,
|
||||||
|
bugprone-undefined-memory-manipulation,
|
||||||
|
bugprone-unhandled-self-assignment,
|
||||||
|
bugprone-unused-raii,
|
||||||
|
bugprone-unused-return-value,
|
||||||
|
bugprone-use-after-move,
|
||||||
|
bugprone-virtual-near-miss,
|
||||||
|
|
||||||
|
cert-dcl21-cpp,
|
||||||
|
cert-dcl50-cpp,
|
||||||
|
cert-env33-c,
|
||||||
|
cert-err34-c,
|
||||||
|
cert-err52-cpp,
|
||||||
|
cert-flp30-c,
|
||||||
|
cert-mem57-cpp,
|
||||||
|
cert-msc50-cpp,
|
||||||
|
cert-oop58-cpp,
|
||||||
|
|
||||||
|
google-build-explicit-make-pair,
|
||||||
|
google-build-namespaces,
|
||||||
|
google-default-arguments,
|
||||||
|
google-explicit-constructor,
|
||||||
|
google-readability-casting,
|
||||||
|
google-readability-avoid-underscore-in-googletest-name,
|
||||||
|
google-runtime-int,
|
||||||
|
google-runtime-operator,
|
||||||
|
|
||||||
|
hicpp-exception-baseclass,
|
||||||
|
|
||||||
|
boost-use-to-string,
|
||||||
|
'
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -1,2 +1,3 @@
|
|||||||
docs/* @ClickHouse/docs
|
docs/* @ClickHouse/docs
|
||||||
docs/zh/* @ClickHouse/docs-zh
|
docs/zh/* @ClickHouse/docs-zh
|
||||||
|
website/* @ClickHouse/docs
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,7 +16,10 @@
|
|||||||
/docs/publish
|
/docs/publish
|
||||||
/docs/edit
|
/docs/edit
|
||||||
/docs/website
|
/docs/website
|
||||||
|
/docs/venv/
|
||||||
/docs/tools/venv/
|
/docs/tools/venv/
|
||||||
|
/docs/tools/translate/venv/
|
||||||
|
/docs/tools/translate/output.md
|
||||||
/docs/en/single.md
|
/docs/en/single.md
|
||||||
/docs/ru/single.md
|
/docs/ru/single.md
|
||||||
/docs/zh/single.md
|
/docs/zh/single.md
|
||||||
|
3264
CHANGELOG.md
3264
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -186,11 +186,13 @@ if (COMPILER_GCC OR COMPILER_CLANG)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
option(WITH_COVERAGE "Build with coverage." 0)
|
option(WITH_COVERAGE "Build with coverage." 0)
|
||||||
|
|
||||||
if(WITH_COVERAGE AND COMPILER_CLANG)
|
if(WITH_COVERAGE AND COMPILER_CLANG)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
||||||
# If we want to disable coverage for specific translation units
|
# If we want to disable coverage for specific translation units
|
||||||
set(WITHOUT_COVERAGE "-fno-profile-instr-generate -fno-coverage-mapping")
|
set(WITHOUT_COVERAGE "-fno-profile-instr-generate -fno-coverage-mapping")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_COVERAGE AND COMPILER_GCC)
|
if(WITH_COVERAGE AND COMPILER_GCC)
|
||||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(COVERAGE_OPTION "-lgcov")
|
set(COVERAGE_OPTION "-lgcov")
|
||||||
@ -352,7 +354,6 @@ endif ()
|
|||||||
|
|
||||||
# Need to process before "contrib" dir:
|
# Need to process before "contrib" dir:
|
||||||
include (cmake/find/jemalloc.cmake)
|
include (cmake/find/jemalloc.cmake)
|
||||||
include (cmake/find/cctz.cmake)
|
|
||||||
include (cmake/find/mysqlclient.cmake)
|
include (cmake/find/mysqlclient.cmake)
|
||||||
|
|
||||||
# When testing for memory leaks with Valgrind, don't link tcmalloc or jemalloc.
|
# When testing for memory leaks with Valgrind, don't link tcmalloc or jemalloc.
|
||||||
|
@ -8,6 +8,7 @@ ClickHouse is an open-source column-oriented database management system that all
|
|||||||
* [Tutorial](https://clickhouse.tech/docs/en/getting_started/tutorial/) shows how to set up and query small ClickHouse cluster.
|
* [Tutorial](https://clickhouse.tech/docs/en/getting_started/tutorial/) shows how to set up and query small ClickHouse cluster.
|
||||||
* [Documentation](https://clickhouse.tech/docs/en/) provides more in-depth information.
|
* [Documentation](https://clickhouse.tech/docs/en/) provides more in-depth information.
|
||||||
* [YouTube channel](https://www.youtube.com/c/ClickHouseDB) has a lot of content about ClickHouse in video format.
|
* [YouTube channel](https://www.youtube.com/c/ClickHouseDB) has a lot of content about ClickHouse in video format.
|
||||||
|
* [Slack](https://join.slack.com/t/clickhousedb/shared_invite/enQtOTUzMjM4ODQwNTc5LWJmMjE3Yjc2YmI1ZDBlZmI4ZTc3OWY3ZTIwYTljYzY4MzBlODM3YzBjZTc1YmYyODRlZTJkYTgzYzBiNTA2Yjk) and [Telegram](https://telegram.me/clickhouse_en) allow to chat with ClickHouse users in real-time.
|
||||||
* [Blog](https://clickhouse.yandex/blog/en/) contains various ClickHouse-related articles, as well as announces and reports about events.
|
* [Blog](https://clickhouse.yandex/blog/en/) contains various ClickHouse-related articles, as well as announces and reports about events.
|
||||||
* [Contacts](https://clickhouse.tech/#contacts) can help to get your questions answered if there are any.
|
* [Contacts](https://clickhouse.tech/#contacts) can help to get your questions answered if there are any.
|
||||||
* You can also [fill this form](https://forms.yandex.com/surveys/meet-yandex-clickhouse-team/) to meet Yandex ClickHouse team in person.
|
* You can also [fill this form](https://forms.yandex.com/surveys/meet-yandex-clickhouse-team/) to meet Yandex ClickHouse team in person.
|
||||||
|
@ -6,6 +6,7 @@ set (SRCS
|
|||||||
DateLUT.cpp
|
DateLUT.cpp
|
||||||
DateLUTImpl.cpp
|
DateLUTImpl.cpp
|
||||||
demangle.cpp
|
demangle.cpp
|
||||||
|
getFQDNOrHostName.cpp
|
||||||
getMemoryAmount.cpp
|
getMemoryAmount.cpp
|
||||||
getThreadId.cpp
|
getThreadId.cpp
|
||||||
JSON.cpp
|
JSON.cpp
|
||||||
@ -20,15 +21,9 @@ set (SRCS
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (ENABLE_REPLXX)
|
if (ENABLE_REPLXX)
|
||||||
set (SRCS ${SRCS}
|
list (APPEND SRCS ReplxxLineReader.cpp)
|
||||||
ReplxxLineReader.cpp
|
|
||||||
ReplxxLineReader.h
|
|
||||||
)
|
|
||||||
elseif (ENABLE_READLINE)
|
elseif (ENABLE_READLINE)
|
||||||
set (SRCS ${SRCS}
|
list (APPEND SRCS ReadlineLineReader.cpp)
|
||||||
ReadlineLineReader.cpp
|
|
||||||
ReadlineLineReader.h
|
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USE_DEBUG_HELPERS)
|
if (USE_DEBUG_HELPERS)
|
||||||
@ -38,11 +33,13 @@ endif ()
|
|||||||
|
|
||||||
add_library (common ${SRCS})
|
add_library (common ${SRCS})
|
||||||
|
|
||||||
target_include_directories(common PUBLIC .. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
if (WITH_COVERAGE)
|
||||||
|
target_compile_definitions(common PUBLIC WITH_COVERAGE=1)
|
||||||
|
else ()
|
||||||
|
target_compile_definitions(common PUBLIC WITH_COVERAGE=0)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(CCTZ_INCLUDE_DIR)
|
target_include_directories(common PUBLIC .. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||||
target_include_directories(common BEFORE PRIVATE ${CCTZ_INCLUDE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT USE_INTERNAL_BOOST_LIBRARY)
|
if (NOT USE_INTERNAL_BOOST_LIBRARY)
|
||||||
target_include_directories (common SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
|
target_include_directories (common SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
|
||||||
@ -52,12 +49,6 @@ if(NOT USE_INTERNAL_POCO_LIBRARY)
|
|||||||
target_include_directories (common SYSTEM BEFORE PUBLIC ${Poco_Foundation_INCLUDE_DIR})
|
target_include_directories (common SYSTEM BEFORE PUBLIC ${Poco_Foundation_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CCTZ_LIBRARY)
|
|
||||||
target_link_libraries(common PRIVATE ${CCTZ_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC replxx)
|
|
||||||
|
|
||||||
# allow explicitly fallback to readline
|
# allow explicitly fallback to readline
|
||||||
if (NOT ENABLE_REPLXX AND ENABLE_READLINE)
|
if (NOT ENABLE_REPLXX AND ENABLE_READLINE)
|
||||||
message (STATUS "Attempt to fallback to readline explicitly")
|
message (STATUS "Attempt to fallback to readline explicitly")
|
||||||
@ -82,11 +73,16 @@ endif ()
|
|||||||
|
|
||||||
target_link_libraries (common
|
target_link_libraries (common
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
${Poco_Net_LIBRARY}
|
||||||
${Poco_Util_LIBRARY}
|
${Poco_Util_LIBRARY}
|
||||||
${Poco_Foundation_LIBRARY}
|
${Poco_Foundation_LIBRARY}
|
||||||
${CITYHASH_LIBRARIES}
|
${CITYHASH_LIBRARIES}
|
||||||
${Boost_SYSTEM_LIBRARY}
|
${Boost_SYSTEM_LIBRARY}
|
||||||
FastMemcpy
|
FastMemcpy
|
||||||
|
replxx
|
||||||
|
|
||||||
|
PRIVATE
|
||||||
|
cctz
|
||||||
)
|
)
|
||||||
|
|
||||||
if (ENABLE_TESTS)
|
if (ENABLE_TESTS)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#include <common/DateLUT.h>
|
#include "DateLUT.h"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <Poco/DigestStream.h>
|
||||||
#include <Poco/Exception.h>
|
#include <Poco/Exception.h>
|
||||||
#include <Poco/SHA1Engine.h>
|
#include <Poco/SHA1Engine.h>
|
||||||
#include <Poco/DigestStream.h>
|
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "DateLUTImpl.h"
|
#include "DateLUTImpl.h"
|
||||||
#include <unordered_map>
|
|
||||||
#include <atomic>
|
#include "defines.h"
|
||||||
#include <mutex>
|
|
||||||
#include <memory>
|
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
// Also defined in Core/Defines.h
|
#include <atomic>
|
||||||
#if !defined(ALWAYS_INLINE)
|
#include <memory>
|
||||||
#if defined(_MSC_VER)
|
#include <mutex>
|
||||||
#define ALWAYS_INLINE __forceinline
|
#include <unordered_map>
|
||||||
#else
|
|
||||||
#define ALWAYS_INLINE __attribute__((__always_inline__))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/// This class provides lazy initialization and lookup of singleton DateLUTImpl objects for a given timezone.
|
/// This class provides lazy initialization and lookup of singleton DateLUTImpl objects for a given timezone.
|
||||||
|
@ -1,23 +1,14 @@
|
|||||||
#if __has_include(<cctz/civil_time.h>)
|
#include "DateLUTImpl.h"
|
||||||
#include <cctz/civil_time.h> // bundled, debian
|
|
||||||
#else
|
|
||||||
#include <civil_time.h> // freebsd
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_include(<cctz/time_zone.h>)
|
#include <cctz/civil_time.h>
|
||||||
#include <cctz/time_zone.h>
|
#include <cctz/time_zone.h>
|
||||||
#else
|
|
||||||
#include <time_zone.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <common/DateLUTImpl.h>
|
|
||||||
#include <Poco/Exception.h>
|
#include <Poco/Exception.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <cassert>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cassert>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#define DATE_LUT_MIN 0
|
#define DATE_LUT_MIN 0
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Types.h"
|
|
||||||
#include "DayNum.h"
|
#include "DayNum.h"
|
||||||
#include "likely.h"
|
#include "defines.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <common/strong_typedef.h>
|
#include <common/strong_typedef.h>
|
||||||
|
|
||||||
/** Represents number of days since 1970-01-01.
|
/** Represents number of days since 1970-01-01.
|
||||||
|
@ -776,7 +776,7 @@ JSON::iterator & JSON::iterator::operator++()
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON::iterator JSON::iterator::operator++(int)
|
JSON::iterator JSON::iterator::operator++(int) // NOLINT
|
||||||
{
|
{
|
||||||
iterator copy(*this);
|
iterator copy(*this);
|
||||||
++*this;
|
++*this;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <Poco/Exception.h>
|
#include <Poco/Exception.h>
|
||||||
#include <common/StringRef.h>
|
#include <common/StringRef.h>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
|
|
||||||
/** Очень простой класс для чтения JSON (или его кусочков).
|
/** Очень простой класс для чтения JSON (или его кусочков).
|
||||||
|
@ -52,19 +52,10 @@ LineReader::Suggest::WordsRange LineReader::Suggest::getCompletions(const String
|
|||||||
last_word = std::string_view(prefix).substr(last_word_pos + 1, std::string::npos);
|
last_word = std::string_view(prefix).substr(last_word_pos + 1, std::string::npos);
|
||||||
|
|
||||||
/// last_word can be empty.
|
/// last_word can be empty.
|
||||||
|
return std::equal_range(words.begin(), words.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
||||||
if (case_insensitive)
|
{
|
||||||
return std::equal_range(
|
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
||||||
words.begin(), words.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
});
|
||||||
{
|
|
||||||
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
|
||||||
});
|
|
||||||
else
|
|
||||||
return std::equal_range(
|
|
||||||
words.begin(), words.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
|
||||||
{
|
|
||||||
return strncmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LineReader::LineReader(const String & history_file_path_, char extender_, char delimiter_)
|
LineReader::LineReader(const String & history_file_path_, char extender_, char delimiter_)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -18,9 +18,6 @@ public:
|
|||||||
|
|
||||||
/// Get iterators for the matched range of words if any.
|
/// Get iterators for the matched range of words if any.
|
||||||
WordsRange getCompletions(const String & prefix, size_t prefix_length) const;
|
WordsRange getCompletions(const String & prefix, size_t prefix_length) const;
|
||||||
|
|
||||||
/// case sensitive suggestion
|
|
||||||
bool case_insensitive = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LineReader(const String & history_file_path, char extender, char delimiter = 0); /// if delimiter != 0, then it's multiline mode
|
LineReader(const String & history_file_path, char extender, char delimiter = 0); /// if delimiter != 0, then it's multiline mode
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <common/unaligned.h>
|
#include <common/unaligned.h>
|
||||||
|
|
||||||
#include <city.h>
|
#include <city.h>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <common/argsToConfig.h>
|
#include "argsToConfig.h"
|
||||||
|
|
||||||
#include <Poco/Util/Application.h>
|
#include <Poco/Util/Application.h>
|
||||||
#include <Poco/Util/LayeredConfiguration.h>
|
#include <Poco/Util/LayeredConfiguration.h>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Poco/Util/Application.h>
|
#include <Poco/Util/Application.h>
|
||||||
|
|
||||||
namespace Poco::Util
|
namespace Poco::Util
|
||||||
|
@ -4,4 +4,3 @@
|
|||||||
|
|
||||||
#cmakedefine01 USE_JEMALLOC
|
#cmakedefine01 USE_JEMALLOC
|
||||||
#cmakedefine01 UNBUNDLED
|
#cmakedefine01 UNBUNDLED
|
||||||
#cmakedefine01 WITH_COVERAGE
|
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
#include <common/coverage.h>
|
#include "coverage.h"
|
||||||
#include <common/config_common.h>
|
|
||||||
|
|
||||||
#if WITH_COVERAGE
|
#if WITH_COVERAGE
|
||||||
|
|
||||||
#include <unistd.h>
|
# include <mutex>
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
# include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
# if defined(__clang__)
|
||||||
extern "C" void __llvm_profile_dump();
|
extern "C" void __llvm_profile_dump();
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
# elif defined(__GNUC__) || defined(__GNUG__)
|
||||||
extern "C" void __gcov_exit();
|
extern "C" void __gcov_exit();
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -21,11 +22,11 @@ void dumpCoverageReportIfPossible()
|
|||||||
static std::mutex mutex;
|
static std::mutex mutex;
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
|
|
||||||
#if defined(__clang__)
|
# if defined(__clang__)
|
||||||
__llvm_profile_dump();
|
__llvm_profile_dump();
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
# elif defined(__GNUC__) || defined(__GNUG__)
|
||||||
__gcov_exit();
|
__gcov_exit();
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
87
base/common/defines.h
Normal file
87
base/common/defines.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# if !defined(likely)
|
||||||
|
# define likely(x) (x)
|
||||||
|
# endif
|
||||||
|
# if !defined(unlikely)
|
||||||
|
# define unlikely(x) (x)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# if !defined(likely)
|
||||||
|
# define likely(x) (__builtin_expect(!!(x), 1))
|
||||||
|
# endif
|
||||||
|
# if !defined(unlikely)
|
||||||
|
# define unlikely(x) (__builtin_expect(!!(x), 0))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# define ALWAYS_INLINE __forceinline
|
||||||
|
# define NO_INLINE static __declspec(noinline)
|
||||||
|
# define MAY_ALIAS
|
||||||
|
#else
|
||||||
|
# define ALWAYS_INLINE __attribute__((__always_inline__))
|
||||||
|
# define NO_INLINE __attribute__((__noinline__))
|
||||||
|
# define MAY_ALIAS __attribute__((__may_alias__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__x86_64__) && !defined(__aarch64__) && !defined(__PPC__)
|
||||||
|
# error "The only supported platforms are x86_64 and AArch64, PowerPC (work in progress)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Check for presence of address sanitizer
|
||||||
|
#if !defined(ADDRESS_SANITIZER)
|
||||||
|
# if defined(__has_feature)
|
||||||
|
# if __has_feature(address_sanitizer)
|
||||||
|
# define ADDRESS_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
# elif defined(__SANITIZE_ADDRESS__)
|
||||||
|
# define ADDRESS_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(THREAD_SANITIZER)
|
||||||
|
# if defined(__has_feature)
|
||||||
|
# if __has_feature(thread_sanitizer)
|
||||||
|
# define THREAD_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
# elif defined(__SANITIZE_THREAD__)
|
||||||
|
# define THREAD_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MEMORY_SANITIZER)
|
||||||
|
# if defined(__has_feature)
|
||||||
|
# if __has_feature(memory_sanitizer)
|
||||||
|
# define MEMORY_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
# elif defined(__MEMORY_SANITIZER__)
|
||||||
|
# define MEMORY_SANITIZER 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// TODO: Strange enough, there is no way to detect UB sanitizer.
|
||||||
|
|
||||||
|
/// Explicitly allow undefined behaviour for certain functions. Use it as a function attribute.
|
||||||
|
/// It is useful in case when compiler cannot see (and exploit) it, but UBSan can.
|
||||||
|
/// Example: multiplication of signed integers with possibility of overflow when both sides are from user input.
|
||||||
|
#if defined(__clang__)
|
||||||
|
# define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
|
||||||
|
# define NO_SANITIZE_ADDRESS __attribute__((__no_sanitize__("address")))
|
||||||
|
# define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
|
||||||
|
#else /// It does not work in GCC. GCC 7 cannot recognize this attribute and GCC 8 simply ignores it.
|
||||||
|
# define NO_SANITIZE_UNDEFINED
|
||||||
|
# define NO_SANITIZE_ADDRESS
|
||||||
|
# define NO_SANITIZE_THREAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __GNUC__ && !defined __clang__
|
||||||
|
# define OPTIMIZE(x) __attribute__((__optimize__(x)))
|
||||||
|
#else
|
||||||
|
# define OPTIMIZE(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// A macro for suppressing warnings about unused variables or function results.
|
||||||
|
/// Useful for structured bindings which have no standard way to declare this.
|
||||||
|
#define UNUSED(...) (void)(__VA_ARGS__)
|
@ -1,5 +1,5 @@
|
|||||||
#include <Poco/Net/DNS.h>
|
#include <Poco/Net/DNS.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
@ -69,13 +69,13 @@ uint64_t getMemoryAmountOrZero()
|
|||||||
|
|
||||||
#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
|
#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
|
||||||
/* FreeBSD, Linux, OpenBSD, and Solaris. -------------------- */
|
/* FreeBSD, Linux, OpenBSD, and Solaris. -------------------- */
|
||||||
return (uint64_t)sysconf(_SC_PHYS_PAGES)
|
return uint64_t(sysconf(_SC_PHYS_PAGES))
|
||||||
* (uint64_t)sysconf(_SC_PAGESIZE);
|
*uint64_t(sysconf(_SC_PAGESIZE));
|
||||||
|
|
||||||
#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGE_SIZE)
|
#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGE_SIZE)
|
||||||
/* Legacy. -------------------------------------------------- */
|
/* Legacy. -------------------------------------------------- */
|
||||||
return (uint64_t)sysconf(_SC_PHYS_PAGES)
|
return uint64_t(sysconf(_SC_PHYS_PAGES))
|
||||||
* (uint64_t)sysconf(_SC_PAGE_SIZE);
|
* uint64_t(sysconf(_SC_PAGE_SIZE));
|
||||||
|
|
||||||
#elif defined(CTL_HW) && (defined(HW_PHYSMEM) || defined(HW_REALMEM))
|
#elif defined(CTL_HW) && (defined(HW_PHYSMEM) || defined(HW_REALMEM))
|
||||||
/* DragonFly BSD, FreeBSD, NetBSD, OpenBSD, and OSX. -------- */
|
/* DragonFly BSD, FreeBSD, NetBSD, OpenBSD, and OSX. -------- */
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "likely.h"
|
|
||||||
|
|
||||||
using int128_t = __int128;
|
using int128_t = __int128;
|
||||||
using uint128_t = unsigned __int128;
|
using uint128_t = unsigned __int128;
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#if defined(_MSC_VER)
|
|
||||||
# if !defined(likely)
|
|
||||||
# define likely(x) (x)
|
|
||||||
# endif
|
|
||||||
# if !defined(unlikely)
|
|
||||||
# define unlikely(x) (x)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# if !defined(likely)
|
|
||||||
# define likely(x) (__builtin_expect(!!(x), 1))
|
|
||||||
# endif
|
|
||||||
# if !defined(unlikely)
|
|
||||||
# define unlikely(x) (__builtin_expect(!!(x), 0))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "likely.h"
|
#include "defines.h"
|
||||||
|
|
||||||
#if __has_include(<common/config_common.h>)
|
#if __has_include(<common/config_common.h>)
|
||||||
#include <common/config_common.h>
|
#include <common/config_common.h>
|
||||||
@ -19,27 +19,11 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Also defined in Core/Defines.h
|
|
||||||
#if !defined(ALWAYS_INLINE)
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define ALWAYS_INLINE inline __forceinline
|
|
||||||
#else
|
|
||||||
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(NO_INLINE)
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define NO_INLINE static __declspec(noinline)
|
|
||||||
#else
|
|
||||||
#define NO_INLINE __attribute__((__noinline__))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
{
|
{
|
||||||
|
|
||||||
ALWAYS_INLINE void * newImpl(std::size_t size)
|
inline ALWAYS_INLINE void * newImpl(std::size_t size)
|
||||||
{
|
{
|
||||||
auto * ptr = malloc(size);
|
auto * ptr = malloc(size);
|
||||||
if (likely(ptr != nullptr))
|
if (likely(ptr != nullptr))
|
||||||
@ -49,19 +33,19 @@ ALWAYS_INLINE void * newImpl(std::size_t size)
|
|||||||
throw std::bad_alloc{};
|
throw std::bad_alloc{};
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void * newNoExept(std::size_t size) noexcept
|
inline ALWAYS_INLINE void * newNoExept(std::size_t size) noexcept
|
||||||
{
|
{
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void deleteImpl(void * ptr) noexcept
|
inline ALWAYS_INLINE void deleteImpl(void * ptr) noexcept
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_JEMALLOC
|
#if USE_JEMALLOC
|
||||||
|
|
||||||
ALWAYS_INLINE void deleteSized(void * ptr, std::size_t size) noexcept
|
inline ALWAYS_INLINE void deleteSized(void * ptr, std::size_t size) noexcept
|
||||||
{
|
{
|
||||||
if (unlikely(ptr == nullptr))
|
if (unlikely(ptr == nullptr))
|
||||||
return;
|
return;
|
||||||
@ -71,7 +55,7 @@ ALWAYS_INLINE void deleteSized(void * ptr, std::size_t size) noexcept
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
ALWAYS_INLINE void deleteSized(void * ptr, std::size_t size [[maybe_unused]]) noexcept
|
inline ALWAYS_INLINE void deleteSized(void * ptr, std::size_t size [[maybe_unused]]) noexcept
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <common/shift10.h>
|
#include <common/shift10.h>
|
||||||
|
|
||||||
#include <common/likely.h>
|
#include "defines.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
/** Almost the same as x = x * exp10(exponent), but gives more accurate result.
|
/** Almost the same as x = x * exp10(exponent), but gives more accurate result.
|
||||||
* Example:
|
* Example:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
|
|
||||||
/** Set color in terminal based on 64-bit hash value.
|
/** Set color in terminal based on 64-bit hash value.
|
||||||
|
@ -43,7 +43,7 @@ void loop(time_t begin, time_t end, int step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
loop(orderedIdentifierToDate(20101031), orderedIdentifierToDate(20101101), 15 * 60);
|
loop(orderedIdentifierToDate(20101031), orderedIdentifierToDate(20101101), 15 * 60);
|
||||||
loop(orderedIdentifierToDate(20100328), orderedIdentifierToDate(20100330), 15 * 60);
|
loop(orderedIdentifierToDate(20100328), orderedIdentifierToDate(20100330), 15 * 60);
|
||||||
|
@ -53,7 +53,7 @@ void loop(time_t begin, time_t end, int step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
loop(orderedIdentifierToDate(20101031), orderedIdentifierToDate(20101101), 15 * 60);
|
loop(orderedIdentifierToDate(20101031), orderedIdentifierToDate(20101101), 15 * 60);
|
||||||
loop(orderedIdentifierToDate(20100328), orderedIdentifierToDate(20100330), 15 * 60);
|
loop(orderedIdentifierToDate(20100328), orderedIdentifierToDate(20100330), 15 * 60);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <common/DateLUT.h>
|
#include <common/DateLUT.h>
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
/** В DateLUT был глюк - для времён из дня 1970-01-01, возвращался номер часа больше 23. */
|
/** В DateLUT был глюк - для времён из дня 1970-01-01, возвращался номер часа больше 23. */
|
||||||
static const time_t TIME = 66130;
|
static const time_t TIME = 66130;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <common/DateLUT.h>
|
#include <common/DateLUT.h>
|
||||||
#include <Poco/Exception.h>
|
#include <Poco/Exception.h>
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <common/DateLUT.h>
|
#include <common/DateLUT.h>
|
||||||
|
|
||||||
/// Позволяет проверить время инициализации DateLUT.
|
/// Позволяет проверить время инициализации DateLUT.
|
||||||
int main(int argc, char ** argv)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
DateLUT::instance();
|
DateLUT::instance();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -54,7 +54,7 @@ TEST(StrongTypedefSuite, NoDefaultCtor)
|
|||||||
{
|
{
|
||||||
struct NoDefaultCtor
|
struct NoDefaultCtor
|
||||||
{
|
{
|
||||||
NoDefaultCtor(int i) {}
|
NoDefaultCtor(int) {} // NOLINT
|
||||||
};
|
};
|
||||||
|
|
||||||
STRONG_TYPEDEF(NoDefaultCtor, MyStruct);
|
STRONG_TYPEDEF(NoDefaultCtor, MyStruct);
|
||||||
|
12
base/common/ya.make
Normal file
12
base/common/ya.make
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
LIBRARY()
|
||||||
|
|
||||||
|
PEERDIR(
|
||||||
|
contrib/libs/poco/Util
|
||||||
|
)
|
||||||
|
|
||||||
|
SRCS(
|
||||||
|
argsToConfig.cpp
|
||||||
|
coverage.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
END()
|
@ -99,12 +99,12 @@ static void writeSignalIDtoSignalPipe(int sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Signal handler for HUP / USR1 */
|
/** Signal handler for HUP / USR1 */
|
||||||
static void closeLogsSignalHandler(int sig, siginfo_t * info, void * context)
|
static void closeLogsSignalHandler(int sig, siginfo_t *, void *)
|
||||||
{
|
{
|
||||||
writeSignalIDtoSignalPipe(sig);
|
writeSignalIDtoSignalPipe(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void terminateRequestedSignalHandler(int sig, siginfo_t * info, void * context)
|
static void terminateRequestedSignalHandler(int sig, siginfo_t *, void *)
|
||||||
{
|
{
|
||||||
writeSignalIDtoSignalPipe(sig);
|
writeSignalIDtoSignalPipe(sig);
|
||||||
}
|
}
|
||||||
@ -362,19 +362,8 @@ void BaseDaemon::reloadConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BaseDaemon::BaseDaemon()
|
namespace
|
||||||
{
|
{
|
||||||
checkRequiredInstructions();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BaseDaemon::~BaseDaemon()
|
|
||||||
{
|
|
||||||
writeSignalIDtoSignalPipe(SignalListener::StopThread);
|
|
||||||
signal_listener_thread.join();
|
|
||||||
signal_pipe.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum class InstructionFail
|
enum class InstructionFail
|
||||||
{
|
{
|
||||||
@ -388,7 +377,7 @@ enum class InstructionFail
|
|||||||
AVX512 = 7
|
AVX512 = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string instructionFailToString(InstructionFail fail)
|
std::string instructionFailToString(InstructionFail fail)
|
||||||
{
|
{
|
||||||
switch (fail)
|
switch (fail)
|
||||||
{
|
{
|
||||||
@ -413,16 +402,16 @@ static std::string instructionFailToString(InstructionFail fail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static sigjmp_buf jmpbuf;
|
sigjmp_buf jmpbuf;
|
||||||
|
|
||||||
static void sigIllCheckHandler(int sig, siginfo_t * info, void * context)
|
void sigIllCheckHandler(int, siginfo_t *, void *)
|
||||||
{
|
{
|
||||||
siglongjmp(jmpbuf, 1);
|
siglongjmp(jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if necessary sse extensions are available by trying to execute some sse instructions.
|
/// Check if necessary sse extensions are available by trying to execute some sse instructions.
|
||||||
/// If instruction is unavailable, SIGILL will be sent by kernel.
|
/// If instruction is unavailable, SIGILL will be sent by kernel.
|
||||||
static void checkRequiredInstructions(volatile InstructionFail & fail)
|
void checkRequiredInstructionsImpl(volatile InstructionFail & fail)
|
||||||
{
|
{
|
||||||
#if __SSE3__
|
#if __SSE3__
|
||||||
fail = InstructionFail::SSE3;
|
fail = InstructionFail::SSE3;
|
||||||
@ -463,8 +452,9 @@ static void checkRequiredInstructions(volatile InstructionFail & fail)
|
|||||||
fail = InstructionFail::NONE;
|
fail = InstructionFail::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check SSE and others instructions availability
|
||||||
void BaseDaemon::checkRequiredInstructions()
|
/// Calls exit on fail
|
||||||
|
void checkRequiredInstructions()
|
||||||
{
|
{
|
||||||
struct sigaction sa{};
|
struct sigaction sa{};
|
||||||
struct sigaction sa_old{};
|
struct sigaction sa_old{};
|
||||||
@ -487,7 +477,7 @@ void BaseDaemon::checkRequiredInstructions()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
::checkRequiredInstructions(fail);
|
checkRequiredInstructionsImpl(fail);
|
||||||
|
|
||||||
if (sigaction(signal, &sa_old, nullptr))
|
if (sigaction(signal, &sa_old, nullptr))
|
||||||
{
|
{
|
||||||
@ -496,6 +486,22 @@ void BaseDaemon::checkRequiredInstructions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseDaemon::BaseDaemon()
|
||||||
|
{
|
||||||
|
checkRequiredInstructions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseDaemon::~BaseDaemon()
|
||||||
|
{
|
||||||
|
writeSignalIDtoSignalPipe(SignalListener::StopThread);
|
||||||
|
signal_listener_thread.join();
|
||||||
|
signal_pipe.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseDaemon::terminate()
|
void BaseDaemon::terminate()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <Poco/Util/ServerApplication.h>
|
#include <Poco/Util/ServerApplication.h>
|
||||||
#include <Poco/Net/SocketAddress.h>
|
#include <Poco/Net/SocketAddress.h>
|
||||||
#include <Poco/Version.h>
|
#include <Poco/Version.h>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
#include <common/getThreadId.h>
|
#include <common/getThreadId.h>
|
||||||
#include <daemon/GraphiteWriter.h>
|
#include <daemon/GraphiteWriter.h>
|
||||||
@ -128,7 +128,7 @@ public:
|
|||||||
/// close all process FDs except
|
/// close all process FDs except
|
||||||
/// 0-2 -- stdin, stdout, stderr
|
/// 0-2 -- stdin, stdout, stderr
|
||||||
/// also doesn't close global internal pipes for signal handling
|
/// also doesn't close global internal pipes for signal handling
|
||||||
void closeFDs();
|
static void closeFDs();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Возвращает TaskManager приложения
|
/// Возвращает TaskManager приложения
|
||||||
@ -198,12 +198,6 @@ protected:
|
|||||||
std::string config_path;
|
std::string config_path;
|
||||||
DB::ConfigProcessor::LoadedConfig loaded_config;
|
DB::ConfigProcessor::LoadedConfig loaded_config;
|
||||||
Poco::Util::AbstractConfiguration * last_configuration = nullptr;
|
Poco::Util::AbstractConfiguration * last_configuration = nullptr;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/// Check SSE and others instructions availability
|
|
||||||
/// Calls exit on fail
|
|
||||||
void checkRequiredInstructions();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <daemon/BaseDaemon.h>
|
#include <daemon/BaseDaemon.h>
|
||||||
#include <Poco/Util/LayeredConfiguration.h>
|
#include <Poco/Util/LayeredConfiguration.h>
|
||||||
#include <Poco/Util/Application.h>
|
#include <Poco/Util/Application.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -71,7 +71,8 @@ void OwnSplitChannel::logSplit(const Poco::Message & msg)
|
|||||||
|
|
||||||
|
|
||||||
/// Also log to system.text_log table, if message is not too noisy
|
/// Also log to system.text_log table, if message is not too noisy
|
||||||
if (text_log_max_priority && msg.getPriority() <= text_log_max_priority)
|
auto text_log_max_priority_loaded = text_log_max_priority.load(std::memory_order_relaxed);
|
||||||
|
if (text_log_max_priority_loaded && msg.getPriority() <= text_log_max_priority_loaded)
|
||||||
{
|
{
|
||||||
TextLogElement elem;
|
TextLogElement elem;
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ void OwnSplitChannel::addTextLog(std::shared_ptr<DB::TextLog> log, int max_prior
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(text_log_mutex);
|
std::lock_guard<std::mutex> lock(text_log_mutex);
|
||||||
text_log = log;
|
text_log = log;
|
||||||
text_log_max_priority = max_priority;
|
text_log_max_priority.store(max_priority, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ private:
|
|||||||
std::mutex text_log_mutex;
|
std::mutex text_log_mutex;
|
||||||
|
|
||||||
std::weak_ptr<DB::TextLog> text_log;
|
std::weak_ptr<DB::TextLog> text_log;
|
||||||
int text_log_max_priority = -1;
|
std::atomic<int> text_log_max_priority = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <common/preciseExp10.h>
|
#include <common/preciseExp10.h>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <common/DateLUT.h>
|
#include <common/DateLUT.h>
|
||||||
|
|
||||||
#include <mysqlxx/Types.h>
|
#include <mysqlxx/Types.h>
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
RECURSE(
|
||||||
|
common
|
||||||
|
)
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
option (USE_INTERNAL_CCTZ_LIBRARY "Set to FALSE to use system cctz library instead of bundled" ${NOT_UNBUNDLED})
|
|
||||||
|
|
||||||
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cctz/include/cctz/time_zone.h")
|
|
||||||
if(USE_INTERNAL_CCTZ_LIBRARY)
|
|
||||||
message(WARNING "submodule contrib/cctz is missing. to fix try run: \n git submodule update --init --recursive")
|
|
||||||
endif()
|
|
||||||
set(USE_INTERNAL_CCTZ_LIBRARY 0)
|
|
||||||
set(MISSING_INTERNAL_CCTZ_LIBRARY 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT USE_INTERNAL_CCTZ_LIBRARY)
|
|
||||||
find_library (CCTZ_LIBRARY cctz)
|
|
||||||
find_path (CCTZ_INCLUDE_DIR NAMES cctz/civil_time.h civil_time.h PATHS ${CCTZ_INCLUDE_PATHS})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (CCTZ_LIBRARY AND CCTZ_INCLUDE_DIR)
|
|
||||||
elseif (NOT MISSING_INTERNAL_CCTZ_LIBRARY)
|
|
||||||
set (USE_INTERNAL_CCTZ_LIBRARY 1)
|
|
||||||
set (CCTZ_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/cctz/include")
|
|
||||||
set (CCTZ_LIBRARY cctz)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
message (STATUS "Using cctz: ${CCTZ_INCLUDE_DIR} : ${CCTZ_LIBRARY}")
|
|
9
contrib/CMakeLists.txt
vendored
9
contrib/CMakeLists.txt
vendored
@ -75,9 +75,7 @@ if (USE_INTERNAL_ZLIB_LIBRARY)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USE_INTERNAL_CCTZ_LIBRARY)
|
add_subdirectory (cctz-cmake)
|
||||||
add_subdirectory (cctz-cmake)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (ENABLE_JEMALLOC AND USE_INTERNAL_JEMALLOC_LIBRARY)
|
if (ENABLE_JEMALLOC AND USE_INTERNAL_JEMALLOC_LIBRARY)
|
||||||
add_subdirectory (jemalloc-cmake)
|
add_subdirectory (jemalloc-cmake)
|
||||||
@ -310,12 +308,13 @@ if (USE_BASE64)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_INTERNAL_HYPERSCAN_LIBRARY)
|
if (USE_INTERNAL_HYPERSCAN_LIBRARY)
|
||||||
add_subdirectory (hyperscan)
|
|
||||||
|
|
||||||
# The library is large - avoid bloat.
|
# The library is large - avoid bloat.
|
||||||
if (USE_STATIC_LIBRARIES)
|
if (USE_STATIC_LIBRARIES)
|
||||||
|
add_subdirectory (hyperscan)
|
||||||
target_compile_options (hs PRIVATE -g0)
|
target_compile_options (hs PRIVATE -g0)
|
||||||
else ()
|
else ()
|
||||||
|
set(BUILD_SHARED_LIBS 1 CACHE INTERNAL "")
|
||||||
|
add_subdirectory (hyperscan)
|
||||||
target_compile_options (hs_shared PRIVATE -g0)
|
target_compile_options (hs_shared PRIVATE -g0)
|
||||||
endif ()
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,31 +1,50 @@
|
|||||||
SET(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/cctz)
|
option (USE_INTERNAL_CCTZ "Use internal cctz library" ${NOT_UNBUNDLED})
|
||||||
|
|
||||||
add_library(cctz
|
if (USE_INTERNAL_CCTZ)
|
||||||
${LIBRARY_DIR}/src/civil_time_detail.cc
|
SET(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/cctz)
|
||||||
${LIBRARY_DIR}/src/time_zone_fixed.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_format.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_if.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_impl.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_info.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_libc.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_lookup.cc
|
|
||||||
${LIBRARY_DIR}/src/time_zone_posix.cc
|
|
||||||
${LIBRARY_DIR}/src/zone_info_source.cc
|
|
||||||
|
|
||||||
${LIBRARY_DIR}/src/time_zone_libc.h
|
SET (SRCS
|
||||||
${LIBRARY_DIR}/src/time_zone_if.h
|
${LIBRARY_DIR}/src/civil_time_detail.cc
|
||||||
${LIBRARY_DIR}/src/tzfile.h
|
${LIBRARY_DIR}/src/time_zone_fixed.cc
|
||||||
${LIBRARY_DIR}/src/time_zone_impl.h
|
${LIBRARY_DIR}/src/time_zone_format.cc
|
||||||
${LIBRARY_DIR}/src/time_zone_posix.h
|
${LIBRARY_DIR}/src/time_zone_if.cc
|
||||||
${LIBRARY_DIR}/src/time_zone_info.h
|
${LIBRARY_DIR}/src/time_zone_impl.cc
|
||||||
|
${LIBRARY_DIR}/src/time_zone_info.cc
|
||||||
|
${LIBRARY_DIR}/src/time_zone_libc.cc
|
||||||
|
${LIBRARY_DIR}/src/time_zone_lookup.cc
|
||||||
|
${LIBRARY_DIR}/src/time_zone_posix.cc
|
||||||
|
${LIBRARY_DIR}/src/zone_info_source.cc
|
||||||
|
)
|
||||||
|
|
||||||
${LIBRARY_DIR}/include/cctz/time_zone.h
|
add_library (cctz ${SRCS})
|
||||||
${LIBRARY_DIR}/include/cctz/civil_time_detail.h
|
target_include_directories (cctz PUBLIC ${LIBRARY_DIR}/include)
|
||||||
${LIBRARY_DIR}/include/cctz/civil_time.h)
|
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
if (OS_FREEBSD)
|
||||||
# yes, need linux, because bsd check inside linux in time_zone_libc.cc:24
|
# yes, need linux, because bsd check inside linux in time_zone_libc.cc:24
|
||||||
target_compile_definitions (cctz PRIVATE __USE_BSD linux _XOPEN_SOURCE=600)
|
target_compile_definitions (cctz PRIVATE __USE_BSD linux _XOPEN_SOURCE=600)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
find_library (LIBRARY_CCTZ cctz)
|
||||||
|
find_path (INCLUDE_CCTZ NAMES cctz/civil_time.h)
|
||||||
|
|
||||||
|
add_library (cctz UNKNOWN IMPORTED)
|
||||||
|
set_property (TARGET cctz PROPERTY IMPORTED_LOCATION ${LIBRARY_CCTZ})
|
||||||
|
set_property (TARGET cctz PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_CCTZ})
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES cctz)
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"
|
||||||
|
#include <cctz/civil_time.h>
|
||||||
|
int main() {
|
||||||
|
cctz::civil_day date;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
EXTERNAL_CCTZ_WORKS
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT EXTERNAL_CCTZ_WORKS)
|
||||||
|
message (FATAL_ERROR "cctz is unusable: ${LIBRARY_CCTZ} ${INCLUDE_CCTZ}")
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_include_directories (cctz PUBLIC ${LIBRARY_DIR}/include)
|
message (STATUS "Using cctz")
|
||||||
|
2
contrib/replxx
vendored
2
contrib/replxx
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 07cbfbec550133b88c91c4073fa5af2ae2ae6a9a
|
Subproject commit 1d7e426202139e872a4e64975a34177061cee4f1
|
@ -281,7 +281,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Should we celebrate a bit?
|
/// Should we celebrate a bit?
|
||||||
bool isNewYearMode()
|
static bool isNewYearMode()
|
||||||
{
|
{
|
||||||
time_t current_time = time(nullptr);
|
time_t current_time = time(nullptr);
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ private:
|
|||||||
|| (now.month() == 1 && now.day() <= 5);
|
|| (now.month() == 1 && now.day() <= 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isChineseNewYearMode(const String & local_tz)
|
static bool isChineseNewYearMode(const String & local_tz)
|
||||||
{
|
{
|
||||||
/// Days of Dec. 20 in Chinese calendar starting from year 2019 to year 2105
|
/// Days of Dec. 20 in Chinese calendar starting from year 2019 to year 2105
|
||||||
static constexpr UInt16 chineseNewYearIndicators[]
|
static constexpr UInt16 chineseNewYearIndicators[]
|
||||||
@ -481,8 +481,6 @@ private:
|
|||||||
|
|
||||||
if (server_revision >= Suggest::MIN_SERVER_REVISION && !config().getBool("disable_suggestion", false))
|
if (server_revision >= Suggest::MIN_SERVER_REVISION && !config().getBool("disable_suggestion", false))
|
||||||
{
|
{
|
||||||
if (config().has("case_insensitive_suggestion"))
|
|
||||||
Suggest::instance().setCaseInsensitive();
|
|
||||||
/// Load suggestion data from the server.
|
/// Load suggestion data from the server.
|
||||||
Suggest::instance().load(connection_parameters, config().getInt("suggestion_limit"));
|
Suggest::instance().load(connection_parameters, config().getInt("suggestion_limit"));
|
||||||
}
|
}
|
||||||
@ -1594,7 +1592,7 @@ private:
|
|||||||
std::cout << "Ok." << std::endl;
|
std::cout << "Ok." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showClientVersion()
|
static void showClientVersion()
|
||||||
{
|
{
|
||||||
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
||||||
}
|
}
|
||||||
@ -1720,7 +1718,6 @@ public:
|
|||||||
("always_load_suggestion_data", "Load suggestion data even if clickhouse-client is run in non-interactive mode. Used for testing.")
|
("always_load_suggestion_data", "Load suggestion data even if clickhouse-client is run in non-interactive mode. Used for testing.")
|
||||||
("suggestion_limit", po::value<int>()->default_value(10000),
|
("suggestion_limit", po::value<int>()->default_value(10000),
|
||||||
"Suggestion limit for how many databases, tables and columns to fetch.")
|
"Suggestion limit for how many databases, tables and columns to fetch.")
|
||||||
("case_insensitive_suggestion", "Case sensitive suggestions.")
|
|
||||||
("multiline,m", "multiline")
|
("multiline,m", "multiline")
|
||||||
("multiquery,n", "multiquery")
|
("multiquery,n", "multiquery")
|
||||||
("format,f", po::value<std::string>(), "default output format")
|
("format,f", po::value<std::string>(), "default output format")
|
||||||
|
@ -50,16 +50,13 @@ void Suggest::load(const ConnectionParameters & connection_parameters, size_t su
|
|||||||
|
|
||||||
/// Note that keyword suggestions are available even if we cannot load data from server.
|
/// Note that keyword suggestions are available even if we cannot load data from server.
|
||||||
|
|
||||||
if (case_insensitive)
|
std::sort(words.begin(), words.end(), [](const std::string & str1, const std::string & str2)
|
||||||
std::sort(words.begin(), words.end(), [](const std::string & str1, const std::string & str2)
|
{
|
||||||
|
return std::lexicographical_compare(begin(str1), end(str1), begin(str2), end(str2), [](const char char1, const char char2)
|
||||||
{
|
{
|
||||||
return std::lexicographical_compare(begin(str1), end(str1), begin(str2), end(str2), [](const char char1, const char char2)
|
return std::tolower(char1) < std::tolower(char2);
|
||||||
{
|
|
||||||
return std::tolower(char1) < std::tolower(char2);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
else
|
});
|
||||||
std::sort(words.begin(), words.end());
|
|
||||||
|
|
||||||
ready = true;
|
ready = true;
|
||||||
});
|
});
|
||||||
|
@ -23,9 +23,6 @@ public:
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Need to set before load
|
|
||||||
void setCaseInsensitive() { case_insensitive = true; }
|
|
||||||
|
|
||||||
void load(const ConnectionParameters & connection_parameters, size_t suggestion_limit);
|
void load(const ConnectionParameters & connection_parameters, size_t suggestion_limit);
|
||||||
|
|
||||||
/// Older server versions cannot execute the query above.
|
/// Older server versions cannot execute the query above.
|
||||||
|
@ -499,7 +499,10 @@ ASTPtr ClusterCopier::removeAliasColumnsFromCreateQuery(const ASTPtr & query_ast
|
|||||||
return new_query_ast;
|
return new_query_ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ASTCreateQuery> ClusterCopier::rewriteCreateQueryStorage(const ASTPtr & create_query_ast, const DatabaseAndTableName & new_table, const ASTPtr & new_storage_ast)
|
|
||||||
|
/// Replaces ENGINE and table name in a create query
|
||||||
|
static std::shared_ptr<ASTCreateQuery> rewriteCreateQueryStorage(
|
||||||
|
const ASTPtr & create_query_ast, const DatabaseAndTableName & new_table, const ASTPtr & new_storage_ast)
|
||||||
{
|
{
|
||||||
const auto & create = create_query_ast->as<ASTCreateQuery &>();
|
const auto & create = create_query_ast->as<ASTCreateQuery &>();
|
||||||
auto res = std::make_shared<ASTCreateQuery>(create);
|
auto res = std::make_shared<ASTCreateQuery>(create);
|
||||||
@ -1178,7 +1181,7 @@ String ClusterCopier::getRemoteCreateTable(const DatabaseAndTableName & table, C
|
|||||||
ASTPtr ClusterCopier::getCreateTableForPullShard(const ConnectionTimeouts & timeouts, TaskShard & task_shard)
|
ASTPtr ClusterCopier::getCreateTableForPullShard(const ConnectionTimeouts & timeouts, TaskShard & task_shard)
|
||||||
{
|
{
|
||||||
/// Fetch and parse (possibly) new definition
|
/// Fetch and parse (possibly) new definition
|
||||||
auto connection_entry = task_shard.info.pool->get(timeouts, &task_cluster->settings_pull);
|
auto connection_entry = task_shard.info.pool->get(timeouts, &task_cluster->settings_pull, true);
|
||||||
String create_query_pull_str = getRemoteCreateTable(
|
String create_query_pull_str = getRemoteCreateTable(
|
||||||
task_shard.task_table.table_pull,
|
task_shard.task_table.table_pull,
|
||||||
*connection_entry,
|
*connection_entry,
|
||||||
|
@ -88,11 +88,6 @@ protected:
|
|||||||
/// Removes MATERIALIZED and ALIAS columns from create table query
|
/// Removes MATERIALIZED and ALIAS columns from create table query
|
||||||
static ASTPtr removeAliasColumnsFromCreateQuery(const ASTPtr &query_ast);
|
static ASTPtr removeAliasColumnsFromCreateQuery(const ASTPtr &query_ast);
|
||||||
|
|
||||||
/// Replaces ENGINE and table name in a create query
|
|
||||||
std::shared_ptr<ASTCreateQuery>
|
|
||||||
rewriteCreateQueryStorage(const ASTPtr & create_query_ast, const DatabaseAndTableName & new_table,
|
|
||||||
const ASTPtr & new_storage_ast);
|
|
||||||
|
|
||||||
bool tryDropPartition(ShardPartition & task_partition,
|
bool tryDropPartition(ShardPartition & task_partition,
|
||||||
const zkutil::ZooKeeperPtr & zookeeper,
|
const zkutil::ZooKeeperPtr & zookeeper,
|
||||||
const CleanStateClock & clean_state_clock);
|
const CleanStateClock & clean_state_clock);
|
||||||
@ -119,8 +114,7 @@ protected:
|
|||||||
Connection & connection,
|
Connection & connection,
|
||||||
const Settings * settings = nullptr);
|
const Settings * settings = nullptr);
|
||||||
|
|
||||||
ASTPtr getCreateTableForPullShard(const ConnectionTimeouts & timeouts,
|
ASTPtr getCreateTableForPullShard(const ConnectionTimeouts & timeouts, TaskShard & task_shard);
|
||||||
TaskShard & task_shard);
|
|
||||||
|
|
||||||
void createShardInternalTables(const ConnectionTimeouts & timeouts,
|
void createShardInternalTables(const ConnectionTimeouts & timeouts,
|
||||||
TaskShard & task_shard,
|
TaskShard & task_shard,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <Common/ZooKeeper/ZooKeeper.h>
|
#include <Common/ZooKeeper/ZooKeeper.h>
|
||||||
#include <Common/ZooKeeper/KeeperException.h>
|
#include <Common/ZooKeeper/KeeperException.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/isLocalAddress.h>
|
#include <Common/isLocalAddress.h>
|
||||||
#include <Common/typeid_cast.h>
|
#include <Common/typeid_cast.h>
|
||||||
#include <Common/ClickHouseRevision.h>
|
#include <Common/ClickHouseRevision.h>
|
||||||
|
@ -118,6 +118,20 @@ void LocalServer::tryInitPath()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void attachSystemTables()
|
||||||
|
{
|
||||||
|
DatabasePtr system_database = DatabaseCatalog::instance().tryGetDatabase(DatabaseCatalog::SYSTEM_DATABASE);
|
||||||
|
if (!system_database)
|
||||||
|
{
|
||||||
|
/// TODO: add attachTableDelayed into DatabaseMemory to speedup loading
|
||||||
|
system_database = std::make_shared<DatabaseMemory>(DatabaseCatalog::SYSTEM_DATABASE);
|
||||||
|
DatabaseCatalog::instance().attachDatabase(DatabaseCatalog::SYSTEM_DATABASE, system_database);
|
||||||
|
}
|
||||||
|
|
||||||
|
attachSystemTablesLocal(*system_database);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int LocalServer::main(const std::vector<std::string> & /*args*/)
|
int LocalServer::main(const std::vector<std::string> & /*args*/)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -248,20 +262,6 @@ std::string LocalServer::getInitialCreateTableQuery()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalServer::attachSystemTables()
|
|
||||||
{
|
|
||||||
DatabasePtr system_database = DatabaseCatalog::instance().tryGetDatabase(DatabaseCatalog::SYSTEM_DATABASE);
|
|
||||||
if (!system_database)
|
|
||||||
{
|
|
||||||
/// TODO: add attachTableDelayed into DatabaseMemory to speedup loading
|
|
||||||
system_database = std::make_shared<DatabaseMemory>(DatabaseCatalog::SYSTEM_DATABASE);
|
|
||||||
DatabaseCatalog::instance().attachDatabase(DatabaseCatalog::SYSTEM_DATABASE, system_database);
|
|
||||||
}
|
|
||||||
|
|
||||||
attachSystemTablesLocal(*system_database);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LocalServer::processQueries()
|
void LocalServer::processQueries()
|
||||||
{
|
{
|
||||||
String initial_create_query = getInitialCreateTableQuery();
|
String initial_create_query = getInitialCreateTableQuery();
|
||||||
@ -375,7 +375,7 @@ static void showClientVersion()
|
|||||||
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << '\n';
|
std::cout << DBMS_NAME << " client version " << VERSION_STRING << VERSION_OFFICIAL << "." << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LocalServer::getHelpHeader() const
|
static std::string getHelpHeader()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
"usage: clickhouse-local [initial table definition] [--query <query>]\n"
|
"usage: clickhouse-local [initial table definition] [--query <query>]\n"
|
||||||
@ -390,7 +390,7 @@ std::string LocalServer::getHelpHeader() const
|
|||||||
"Either through corresponding command line parameters --table --structure --input-format and --file.";
|
"Either through corresponding command line parameters --table --structure --input-format and --file.";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LocalServer::getHelpFooter() const
|
static std::string getHelpFooter()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
"Example printing memory used by each Unix user:\n"
|
"Example printing memory used by each Unix user:\n"
|
||||||
|
@ -37,13 +37,9 @@ private:
|
|||||||
void tryInitPath();
|
void tryInitPath();
|
||||||
void applyCmdOptions();
|
void applyCmdOptions();
|
||||||
void applyCmdSettings();
|
void applyCmdSettings();
|
||||||
void attachSystemTables();
|
|
||||||
void processQueries();
|
void processQueries();
|
||||||
void setupUsers();
|
void setupUsers();
|
||||||
|
|
||||||
std::string getHelpHeader() const;
|
|
||||||
std::string getHelpFooter() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<Context> context;
|
std::unique_ptr<Context> context;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ private:
|
|||||||
UInt64 seed;
|
UInt64 seed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnsignedIntegerModel(UInt64 seed_) : seed(seed_) {}
|
explicit UnsignedIntegerModel(UInt64 seed_) : seed(seed_) {}
|
||||||
|
|
||||||
void train(const IColumn &) override {}
|
void train(const IColumn &) override {}
|
||||||
void finalize() override {}
|
void finalize() override {}
|
||||||
@ -222,7 +222,7 @@ private:
|
|||||||
UInt64 seed;
|
UInt64 seed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SignedIntegerModel(UInt64 seed_) : seed(seed_) {}
|
explicit SignedIntegerModel(UInt64 seed_) : seed(seed_) {}
|
||||||
|
|
||||||
void train(const IColumn &) override {}
|
void train(const IColumn &) override {}
|
||||||
void finalize() override {}
|
void finalize() override {}
|
||||||
@ -271,7 +271,7 @@ private:
|
|||||||
Float res_prev_value = 0;
|
Float res_prev_value = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FloatModel(UInt64 seed_) : seed(seed_) {}
|
explicit FloatModel(UInt64 seed_) : seed(seed_) {}
|
||||||
|
|
||||||
void train(const IColumn &) override {}
|
void train(const IColumn &) override {}
|
||||||
void finalize() override {}
|
void finalize() override {}
|
||||||
@ -372,7 +372,7 @@ private:
|
|||||||
UInt64 seed;
|
UInt64 seed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FixedStringModel(UInt64 seed_) : seed(seed_) {}
|
explicit FixedStringModel(UInt64 seed_) : seed(seed_) {}
|
||||||
|
|
||||||
void train(const IColumn &) override {}
|
void train(const IColumn &) override {}
|
||||||
void finalize() override {}
|
void finalize() override {}
|
||||||
@ -414,7 +414,7 @@ private:
|
|||||||
const DateLUTImpl & date_lut;
|
const DateLUTImpl & date_lut;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DateTimeModel(UInt64 seed_) : seed(seed_), date_lut(DateLUT::instance()) {}
|
explicit DateTimeModel(UInt64 seed_) : seed(seed_), date_lut(DateLUT::instance()) {}
|
||||||
|
|
||||||
void train(const IColumn &) override {}
|
void train(const IColumn &) override {}
|
||||||
void finalize() override {}
|
void finalize() override {}
|
||||||
@ -529,13 +529,13 @@ private:
|
|||||||
static constexpr CodePoint END = -2;
|
static constexpr CodePoint END = -2;
|
||||||
|
|
||||||
|
|
||||||
NGramHash hashContext(const CodePoint * begin, const CodePoint * end) const
|
static NGramHash hashContext(const CodePoint * begin, const CodePoint * end)
|
||||||
{
|
{
|
||||||
return CRC32Hash()(StringRef(reinterpret_cast<const char *>(begin), (end - begin) * sizeof(CodePoint)));
|
return CRC32Hash()(StringRef(reinterpret_cast<const char *>(begin), (end - begin) * sizeof(CodePoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// By the way, we don't have to use actual Unicode numbers. We use just arbitrary bijective mapping.
|
/// By the way, we don't have to use actual Unicode numbers. We use just arbitrary bijective mapping.
|
||||||
CodePoint readCodePoint(const char *& pos, const char * end)
|
static CodePoint readCodePoint(const char *& pos, const char * end)
|
||||||
{
|
{
|
||||||
size_t length = UTF8::seqLength(*pos);
|
size_t length = UTF8::seqLength(*pos);
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ private:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool writeCodePoint(CodePoint code, char *& pos, const char * end)
|
static bool writeCodePoint(CodePoint code, char *& pos, const char * end)
|
||||||
{
|
{
|
||||||
size_t length
|
size_t length
|
||||||
= (code & 0xFF000000) ? 4
|
= (code & 0xFF000000) ? 4
|
||||||
@ -567,7 +567,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MarkovModel(MarkovModelParameters params_)
|
explicit MarkovModel(MarkovModelParameters params_)
|
||||||
: params(std::move(params_)), code_points(params.order, BEGIN) {}
|
: params(std::move(params_)), code_points(params.order, BEGIN) {}
|
||||||
|
|
||||||
void consume(const char * data, size_t size)
|
void consume(const char * data, size_t size)
|
||||||
@ -677,7 +677,7 @@ public:
|
|||||||
if (!histogram.total)
|
if (!histogram.total)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double average = histogram.total / histogram.buckets.size();
|
double average = double(histogram.total) / histogram.buckets.size();
|
||||||
|
|
||||||
UInt64 new_total = 0;
|
UInt64 new_total = 0;
|
||||||
for (auto & bucket : histogram.buckets)
|
for (auto & bucket : histogram.buckets)
|
||||||
@ -836,7 +836,7 @@ private:
|
|||||||
ModelPtr nested_model;
|
ModelPtr nested_model;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayModel(ModelPtr nested_model_) : nested_model(std::move(nested_model_)) {}
|
explicit ArrayModel(ModelPtr nested_model_) : nested_model(std::move(nested_model_)) {}
|
||||||
|
|
||||||
void train(const IColumn & column) override
|
void train(const IColumn & column) override
|
||||||
{
|
{
|
||||||
@ -874,7 +874,7 @@ private:
|
|||||||
ModelPtr nested_model;
|
ModelPtr nested_model;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NullableModel(ModelPtr nested_model_) : nested_model(std::move(nested_model_)) {}
|
explicit NullableModel(ModelPtr nested_model_) : nested_model(std::move(nested_model_)) {}
|
||||||
|
|
||||||
void train(const IColumn & column) override
|
void train(const IColumn & column) override
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ void ODBCBridge::defineOptions(Poco::Util::OptionSet & options)
|
|||||||
.binding("help")
|
.binding("help")
|
||||||
.callback(Poco::Util::OptionCallback<Me>(this, &Me::handleHelp)));
|
.callback(Poco::Util::OptionCallback<Me>(this, &Me::handleHelp)));
|
||||||
|
|
||||||
ServerApplication::defineOptions(options); /// Don't need complex BaseDaemon's .xml config
|
ServerApplication::defineOptions(options); // NOLINT Don't need complex BaseDaemon's .xml config
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODBCBridge::initialize(Application & self)
|
void ODBCBridge::initialize(Application & self)
|
||||||
@ -138,7 +138,7 @@ void ODBCBridge::initialize(Application & self)
|
|||||||
|
|
||||||
initializeTerminationAndSignalProcessing();
|
initializeTerminationAndSignalProcessing();
|
||||||
|
|
||||||
ServerApplication::initialize(self);
|
ServerApplication::initialize(self); // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODBCBridge::uninitialize()
|
void ODBCBridge::uninitialize()
|
||||||
|
@ -41,7 +41,7 @@ void ConfigPreprocessor::removeConfigurationsIf(
|
|||||||
std::vector<XMLConfigurationPtr> & configs,
|
std::vector<XMLConfigurationPtr> & configs,
|
||||||
ConfigPreprocessor::FilterType filter_type,
|
ConfigPreprocessor::FilterType filter_type,
|
||||||
const Strings & values,
|
const Strings & values,
|
||||||
bool leave) const
|
bool leave)
|
||||||
{
|
{
|
||||||
auto checker = [&filter_type, &values, &leave] (XMLConfigurationPtr & config)
|
auto checker = [&filter_type, &values, &leave] (XMLConfigurationPtr & config)
|
||||||
{
|
{
|
||||||
|
@ -39,11 +39,11 @@ private:
|
|||||||
|
|
||||||
/// Removes configurations that has a given value.
|
/// Removes configurations that has a given value.
|
||||||
/// If leave is true, the logic is reversed.
|
/// If leave is true, the logic is reversed.
|
||||||
void removeConfigurationsIf(
|
static void removeConfigurationsIf(
|
||||||
std::vector<XMLConfigurationPtr> & configs,
|
std::vector<XMLConfigurationPtr> & configs,
|
||||||
FilterType filter_type,
|
FilterType filter_type,
|
||||||
const Strings & values,
|
const Strings & values,
|
||||||
bool leave = false) const;
|
bool leave = false);
|
||||||
|
|
||||||
const Strings paths;
|
const Strings paths;
|
||||||
};
|
};
|
||||||
|
@ -52,8 +52,6 @@ void waitQuery(Connection & connection)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
PerformanceTest::PerformanceTest(
|
PerformanceTest::PerformanceTest(
|
||||||
const XMLConfigurationPtr & config_,
|
const XMLConfigurationPtr & config_,
|
||||||
Connection & connection_,
|
Connection & connection_,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <Common/getNumberOfPhysicalCPUCores.h>
|
#include <Common/getNumberOfPhysicalCPUCores.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <common/getMemoryAmount.h>
|
#include <common/getMemoryAmount.h>
|
||||||
#include <Common/StringUtils/StringUtils.h>
|
#include <Common/StringUtils/StringUtils.h>
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ ReportBuilder::ReportBuilder(const std::string & server_version_)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ReportBuilder::getCurrentTime() const
|
static std::string getCurrentTime()
|
||||||
{
|
{
|
||||||
return DateLUT::instance().timeToString(time(nullptr));
|
return DateLUT::instance().timeToString(time(nullptr));
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ std::string ReportBuilder::buildFullReport(
|
|||||||
if (statistics.sampler.size() != 0)
|
if (statistics.sampler.size() != 0)
|
||||||
{
|
{
|
||||||
JSONString quantiles(4); /// here, 4 is the size of \t padding
|
JSONString quantiles(4); /// here, 4 is the size of \t padding
|
||||||
for (double percent = 10; percent <= 90; percent += 10)
|
for (int percent = 10; percent <= 90; percent += 10)
|
||||||
{
|
{
|
||||||
std::string quantile_key = std::to_string(percent / 100.0);
|
std::string quantile_key = std::to_string(percent / 100.0);
|
||||||
while (quantile_key.back() == '0')
|
while (quantile_key.back() == '0')
|
||||||
@ -163,7 +163,7 @@ std::string ReportBuilder::buildFullReport(
|
|||||||
std::string ReportBuilder::buildCompactReport(
|
std::string ReportBuilder::buildCompactReport(
|
||||||
const PerformanceTestInfo & test_info,
|
const PerformanceTestInfo & test_info,
|
||||||
std::vector<TestStats> & stats,
|
std::vector<TestStats> & stats,
|
||||||
const std::vector<std::size_t> & queries_to_run) const
|
const std::vector<std::size_t> & queries_to_run)
|
||||||
{
|
{
|
||||||
FormatSettings settings;
|
FormatSettings settings;
|
||||||
std::ostringstream output;
|
std::ostringstream output;
|
||||||
|
@ -10,16 +10,16 @@ class ReportBuilder
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReportBuilder(const std::string & server_version_);
|
ReportBuilder(const std::string & server_version_);
|
||||||
|
|
||||||
std::string buildFullReport(
|
std::string buildFullReport(
|
||||||
const PerformanceTestInfo & test_info,
|
const PerformanceTestInfo & test_info,
|
||||||
std::vector<TestStats> & stats,
|
std::vector<TestStats> & stats,
|
||||||
const std::vector<std::size_t> & queries_to_run) const;
|
const std::vector<std::size_t> & queries_to_run) const;
|
||||||
|
|
||||||
|
static std::string buildCompactReport(
|
||||||
std::string buildCompactReport(
|
|
||||||
const PerformanceTestInfo & test_info,
|
const PerformanceTestInfo & test_info,
|
||||||
std::vector<TestStats> & stats,
|
std::vector<TestStats> & stats,
|
||||||
const std::vector<std::size_t> & queries_to_run) const;
|
const std::vector<std::size_t> & queries_to_run);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string server_version;
|
std::string server_version;
|
||||||
@ -27,10 +27,6 @@ private:
|
|||||||
size_t num_cores;
|
size_t num_cores;
|
||||||
size_t num_threads;
|
size_t num_threads;
|
||||||
size_t ram;
|
size_t ram;
|
||||||
|
|
||||||
private:
|
|
||||||
std::string getCurrentTime() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,9 @@ std::string TestStats::getStatisticByName(const std::string & statistic_name)
|
|||||||
{
|
{
|
||||||
std::string result = "\n";
|
std::string result = "\n";
|
||||||
|
|
||||||
for (double percent = 10; percent <= 90; percent += 10)
|
for (int percent = 10; percent <= 90; percent += 10)
|
||||||
{
|
{
|
||||||
result += FOUR_SPACES + std::to_string((percent / 100));
|
result += FOUR_SPACES + std::to_string((percent / 100.0));
|
||||||
result += ": " + std::to_string(sampler.quantileInterpolated(percent / 100.0));
|
result += ": " + std::to_string(sampler.quantileInterpolated(percent / 100.0));
|
||||||
result += "\n";
|
result += "\n";
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <Core/ExternalTable.h>
|
#include <Core/ExternalTable.h>
|
||||||
#include <Common/StringUtils/StringUtils.h>
|
#include <Common/StringUtils/StringUtils.h>
|
||||||
#include <Common/escapeForFileName.h>
|
#include <Common/escapeForFileName.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/CurrentThread.h>
|
#include <Common/CurrentThread.h>
|
||||||
#include <Common/setThreadName.h>
|
#include <Common/setThreadName.h>
|
||||||
#include <Common/config.h>
|
#include <Common/config.h>
|
||||||
|
@ -77,7 +77,7 @@ private:
|
|||||||
Poco::Net::HTTPServerResponse & response,
|
Poco::Net::HTTPServerResponse & response,
|
||||||
Output & used_output);
|
Output & used_output);
|
||||||
|
|
||||||
void pushDelayedResults(Output & used_output);
|
static void pushDelayedResults(Output & used_output);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Common/config.h>
|
#include <Common/config.h>
|
||||||
#include <Poco/Net/TCPServerConnection.h>
|
#include <Poco/Net/TCPServerConnection.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/CurrentMetrics.h>
|
#include <Common/CurrentMetrics.h>
|
||||||
#include <Core/MySQLProtocol.h>
|
#include <Core/MySQLProtocol.h>
|
||||||
#include "IServer.h"
|
#include "IServer.h"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <Common/ZooKeeper/ZooKeeper.h>
|
#include <Common/ZooKeeper/ZooKeeper.h>
|
||||||
#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
|
#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
|
||||||
#include "config_core.h"
|
#include "config_core.h"
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/getMultipleKeysFromConfig.h>
|
#include <Common/getMultipleKeysFromConfig.h>
|
||||||
#include <Common/getNumberOfPhysicalCPUCores.h>
|
#include <Common/getNumberOfPhysicalCPUCores.h>
|
||||||
#include <Common/getExecutablePath.h>
|
#include <Common/getExecutablePath.h>
|
||||||
@ -175,7 +175,7 @@ int Server::run()
|
|||||||
std::cout << DBMS_NAME << " server version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
std::cout << DBMS_NAME << " server version " << VERSION_STRING << VERSION_OFFICIAL << "." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Application::run();
|
return Application::run(); // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::initialize(Poco::Util::Application & self)
|
void Server::initialize(Poco::Util::Application & self)
|
||||||
|
@ -647,8 +647,6 @@ void TCPHandler::processOrdinaryQueryWithProcessors(size_t num_threads)
|
|||||||
*/
|
*/
|
||||||
if (!isQueryCancelled())
|
if (!isQueryCancelled())
|
||||||
{
|
{
|
||||||
pipeline.finalize();
|
|
||||||
|
|
||||||
sendTotals(lazy_format->getTotals());
|
sendTotals(lazy_format->getTotals());
|
||||||
sendExtremes(lazy_format->getExtremes());
|
sendExtremes(lazy_format->getExtremes());
|
||||||
sendProfileInfo(lazy_format->getProfileInfo());
|
sendProfileInfo(lazy_format->getProfileInfo());
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <Poco/Net/TCPServerConnection.h>
|
#include <Poco/Net/TCPServerConnection.h>
|
||||||
|
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/CurrentMetrics.h>
|
#include <Common/CurrentMetrics.h>
|
||||||
#include <Common/Stopwatch.h>
|
#include <Common/Stopwatch.h>
|
||||||
#include <Core/Protocol.h>
|
#include <Core/Protocol.h>
|
||||||
|
@ -1,2 +1,24 @@
|
|||||||
|
#include <new>
|
||||||
|
|
||||||
|
#include <common/phdr_cache.h>
|
||||||
|
|
||||||
|
|
||||||
int mainEntryClickHouseServer(int argc, char ** argv);
|
int mainEntryClickHouseServer(int argc, char ** argv);
|
||||||
int main(int argc_, char ** argv_) { return mainEntryClickHouseServer(argc_, argv_); }
|
|
||||||
|
/**
|
||||||
|
* This is the entry-point for the split build server. The initialization
|
||||||
|
* is copied from single-binary entry point in main.cpp.
|
||||||
|
*/
|
||||||
|
int main(int argc_, char ** argv_)
|
||||||
|
{
|
||||||
|
/// Reset new handler to default (that throws std::bad_alloc)
|
||||||
|
/// It is needed because LLVM library clobbers it.
|
||||||
|
std::set_new_handler(nullptr);
|
||||||
|
|
||||||
|
/// PHDR cache is required for query profiler to work reliably
|
||||||
|
/// It also speed up exception handling, but exceptions from dynamically loaded libraries (dlopen)
|
||||||
|
/// will work only after additional call of this function.
|
||||||
|
updatePHDRCache();
|
||||||
|
|
||||||
|
return mainEntryClickHouseServer(argc_, argv_);
|
||||||
|
}
|
||||||
|
@ -75,6 +75,9 @@ public:
|
|||||||
|
|
||||||
Node & operator =(const Node & src)
|
Node & operator =(const Node & src)
|
||||||
{
|
{
|
||||||
|
if (this == &src)
|
||||||
|
return *this;
|
||||||
|
|
||||||
node_name = src.node_name;
|
node_name = src.node_name;
|
||||||
level = src.level;
|
level = src.level;
|
||||||
inherited_access = src.inherited_access;
|
inherited_access = src.inherited_access;
|
||||||
@ -158,7 +161,7 @@ public:
|
|||||||
void revoke(const AccessFlags & access_to_revoke, const Helper & helper)
|
void revoke(const AccessFlags & access_to_revoke, const Helper & helper)
|
||||||
{
|
{
|
||||||
if constexpr (mode == NORMAL_REVOKE_MODE)
|
if constexpr (mode == NORMAL_REVOKE_MODE)
|
||||||
{
|
{ // NOLINT
|
||||||
if (level == TABLE_LEVEL)
|
if (level == TABLE_LEVEL)
|
||||||
removeExplicitGrantsRec(access_to_revoke);
|
removeExplicitGrantsRec(access_to_revoke);
|
||||||
else
|
else
|
||||||
@ -166,11 +169,12 @@ public:
|
|||||||
}
|
}
|
||||||
else if constexpr (mode == PARTIAL_REVOKE_MODE)
|
else if constexpr (mode == PARTIAL_REVOKE_MODE)
|
||||||
{
|
{
|
||||||
AccessFlags new_partial_revokes = access_to_revoke - explicit_grants;
|
|
||||||
if (level == TABLE_LEVEL)
|
if (level == TABLE_LEVEL)
|
||||||
removeExplicitGrantsRec(access_to_revoke);
|
removeExplicitGrantsRec(access_to_revoke);
|
||||||
else
|
else
|
||||||
removeExplicitGrants(access_to_revoke);
|
removeExplicitGrants(access_to_revoke);
|
||||||
|
|
||||||
|
AccessFlags new_partial_revokes = access_to_revoke - explicit_grants;
|
||||||
removePartialRevokesRec(new_partial_revokes);
|
removePartialRevokesRec(new_partial_revokes);
|
||||||
partial_revokes |= new_partial_revokes;
|
partial_revokes |= new_partial_revokes;
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ void IAccessStorage::throwNotFound(std::type_index type, const String & name) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IAccessStorage::throwBadCast(const UUID & id, std::type_index type, const String & name, std::type_index required_type) const
|
void IAccessStorage::throwBadCast(const UUID & id, std::type_index type, const String & name, std::type_index required_type)
|
||||||
{
|
{
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"ID {" + toString(id) + "}: " + getTypeName(type) + backQuote(name) + " expected to be of type " + getTypeName(required_type),
|
"ID {" + toString(id) + "}: " + getTypeName(type) + backQuote(name) + " expected to be of type " + getTypeName(required_type),
|
||||||
|
@ -151,8 +151,9 @@ protected:
|
|||||||
static String getTypeName(std::type_index type) { return IAccessEntity::getTypeName(type); }
|
static String getTypeName(std::type_index type) { return IAccessEntity::getTypeName(type); }
|
||||||
[[noreturn]] void throwNotFound(const UUID & id) const;
|
[[noreturn]] void throwNotFound(const UUID & id) const;
|
||||||
[[noreturn]] void throwNotFound(std::type_index type, const String & name) const;
|
[[noreturn]] void throwNotFound(std::type_index type, const String & name) const;
|
||||||
[[noreturn]] void throwBadCast(const UUID & id, std::type_index type, const String & name, std::type_index required_type) const;
|
[[noreturn]] static void throwBadCast(const UUID & id, std::type_index type, const String & name, std::type_index required_type);
|
||||||
[[noreturn]] void throwIDCollisionCannotInsert(const UUID & id, std::type_index type, const String & name, std::type_index existing_type, const String & existing_name) const;
|
[[noreturn]] void throwIDCollisionCannotInsert(
|
||||||
|
const UUID & id, std::type_index type, const String & name, std::type_index existing_type, const String & existing_name) const;
|
||||||
[[noreturn]] void throwNameCollisionCannotInsert(std::type_index type, const String & name) const;
|
[[noreturn]] void throwNameCollisionCannotInsert(std::type_index type, const String & name) const;
|
||||||
[[noreturn]] void throwNameCollisionCannotRename(std::type_index type, const String & old_name, const String & new_name) const;
|
[[noreturn]] void throwNameCollisionCannotRename(std::type_index type, const String & old_name, const String & new_name) const;
|
||||||
[[noreturn]] void throwReadonlyCannotInsert(std::type_index type, const String & name) const;
|
[[noreturn]] void throwReadonlyCannotInsert(std::type_index type, const String & name) const;
|
||||||
|
@ -135,6 +135,9 @@ struct QuotaContext::Impl
|
|||||||
|
|
||||||
QuotaContext::Interval & QuotaContext::Interval::operator =(const Interval & src)
|
QuotaContext::Interval & QuotaContext::Interval::operator =(const Interval & src)
|
||||||
{
|
{
|
||||||
|
if (this == &src)
|
||||||
|
return *this;
|
||||||
|
|
||||||
randomize_interval = src.randomize_interval;
|
randomize_interval = src.randomize_interval;
|
||||||
duration = src.duration;
|
duration = src.duration;
|
||||||
end_of_interval.store(src.end_of_interval.load());
|
end_of_interval.store(src.end_of_interval.load());
|
||||||
|
@ -88,7 +88,7 @@ AggregateFunctionPtr createAggregateFunctionGroupArraySample(const std::string &
|
|||||||
assertUnary(name, argument_types);
|
assertUnary(name, argument_types);
|
||||||
|
|
||||||
UInt64 max_elems = std::numeric_limits<UInt64>::max();
|
UInt64 max_elems = std::numeric_limits<UInt64>::max();
|
||||||
UInt64 seed = 123456;
|
UInt64 seed = thread_local_rng();
|
||||||
|
|
||||||
UInt64 * params[2] = {&max_elems, &seed};
|
UInt64 * params[2] = {&max_elems, &seed};
|
||||||
if (parameters.size() != 1 && parameters.size() != 2)
|
if (parameters.size() != 1 && parameters.size() != 2)
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <AggregateFunctions/IAggregateFunction.h>
|
#include <AggregateFunctions/IAggregateFunction.h>
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <common/likely.h>
|
|
||||||
|
|
||||||
#define AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ARRAY_SIZE 0xFFFFFF
|
#define AGGREGATE_FUNCTION_GROUP_ARRAY_MAX_ARRAY_SIZE 0xFFFFFF
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ template <typename has_limit>
|
|||||||
class AggregateFunctionGroupUniqArrayDate : public AggregateFunctionGroupUniqArray<DataTypeDate::FieldType, has_limit>
|
class AggregateFunctionGroupUniqArrayDate : public AggregateFunctionGroupUniqArray<DataTypeDate::FieldType, has_limit>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AggregateFunctionGroupUniqArrayDate(const DataTypePtr & argument_type, UInt64 max_elems_ = std::numeric_limits<UInt64>::max()) : AggregateFunctionGroupUniqArray<DataTypeDate::FieldType, has_limit>(argument_type, max_elems_) {}
|
explicit AggregateFunctionGroupUniqArrayDate(const DataTypePtr & argument_type, UInt64 max_elems_ = std::numeric_limits<UInt64>::max())
|
||||||
|
: AggregateFunctionGroupUniqArray<DataTypeDate::FieldType, has_limit>(argument_type, max_elems_) {}
|
||||||
DataTypePtr getReturnType() const override { return std::make_shared<DataTypeArray>(std::make_shared<DataTypeDate>()); }
|
DataTypePtr getReturnType() const override { return std::make_shared<DataTypeArray>(std::make_shared<DataTypeDate>()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,7 +34,8 @@ template <typename has_limit>
|
|||||||
class AggregateFunctionGroupUniqArrayDateTime : public AggregateFunctionGroupUniqArray<DataTypeDateTime::FieldType, has_limit>
|
class AggregateFunctionGroupUniqArrayDateTime : public AggregateFunctionGroupUniqArray<DataTypeDateTime::FieldType, has_limit>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AggregateFunctionGroupUniqArrayDateTime(const DataTypePtr & argument_type, UInt64 max_elems_ = std::numeric_limits<UInt64>::max()) : AggregateFunctionGroupUniqArray<DataTypeDateTime::FieldType, has_limit>(argument_type, max_elems_) {}
|
explicit AggregateFunctionGroupUniqArrayDateTime(const DataTypePtr & argument_type, UInt64 max_elems_ = std::numeric_limits<UInt64>::max())
|
||||||
|
: AggregateFunctionGroupUniqArray<DataTypeDateTime::FieldType, has_limit>(argument_type, max_elems_) {}
|
||||||
DataTypePtr getReturnType() const override { return std::make_shared<DataTypeArray>(std::make_shared<DataTypeDateTime>()); }
|
DataTypePtr getReturnType() const override { return std::make_shared<DataTypeArray>(std::make_shared<DataTypeDateTime>()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ AggregateFunctionPtr createAggregateFunctionSimpleLinearRegression(
|
|||||||
FOR_LEASTSQR_TYPES_2(M, Float64)
|
FOR_LEASTSQR_TYPES_2(M, Float64)
|
||||||
#define DISPATCH(T1, T2) \
|
#define DISPATCH(T1, T2) \
|
||||||
if (which_x.idx == TypeIndex::T1 && which_y.idx == TypeIndex::T2) \
|
if (which_x.idx == TypeIndex::T1 && which_y.idx == TypeIndex::T2) \
|
||||||
return std::make_shared<AggregateFunctionSimpleLinearRegression<T1, T2>>( \
|
return std::make_shared<AggregateFunctionSimpleLinearRegression<T1, T2>>(/* NOLINT */ \
|
||||||
arguments, \
|
arguments, \
|
||||||
params \
|
params \
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <IO/WriteBuffer.h>
|
#include <IO/WriteBuffer.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
#include <common/likely.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <IO/ReadBuffer.h>
|
#include <IO/ReadBuffer.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <climits>
|
#include <climits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <AggregateFunctions/ReservoirSampler.h>
|
#include <AggregateFunctions/ReservoirSampler.h>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
#include <Common/HashTable/Hash.h>
|
#include <Common/HashTable/Hash.h>
|
||||||
#include <IO/ReadBuffer.h>
|
#include <IO/ReadBuffer.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
#include <IO/WriteBuffer.h>
|
#include <IO/WriteBuffer.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <Poco/Net/DNS.h>
|
#include <Poco/Net/DNS.h>
|
||||||
|
|
||||||
#include <Common/BitHelpers.h>
|
#include <Common/BitHelpers.h>
|
||||||
#include <Common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
#include <Common/isLocalAddress.h>
|
#include <Common/isLocalAddress.h>
|
||||||
#include <Common/ProfileEvents.h>
|
#include <Common/ProfileEvents.h>
|
||||||
#include <Core/Settings.h>
|
#include <Core/Settings.h>
|
||||||
|
@ -44,8 +44,8 @@ public:
|
|||||||
|
|
||||||
/** Allocates connection to work. */
|
/** Allocates connection to work. */
|
||||||
Entry get(const ConnectionTimeouts & timeouts,
|
Entry get(const ConnectionTimeouts & timeouts,
|
||||||
const Settings * settings = nullptr,
|
const Settings * settings,
|
||||||
bool force_connected = true) override; /// From IConnectionPool
|
bool force_connected) override; /// From IConnectionPool
|
||||||
|
|
||||||
/** Allocates up to the specified number of connections to work.
|
/** Allocates up to the specified number of connections to work.
|
||||||
* Connections provide access to different replicas of one shard.
|
* Connections provide access to different replicas of one shard.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <Client/MultiplexedConnections.h>
|
#include <Client/MultiplexedConnections.h>
|
||||||
#include <IO/ConnectionTimeouts.h>
|
#include <IO/ConnectionTimeouts.h>
|
||||||
|
#include <Common/thread_local_rng.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -308,10 +310,10 @@ MultiplexedConnections::ReplicaState & MultiplexedConnections::getReplicaForRead
|
|||||||
throw Exception("Timeout exceeded while reading from " + dumpAddressesUnlocked(), ErrorCodes::TIMEOUT_EXCEEDED);
|
throw Exception("Timeout exceeded while reading from " + dumpAddressesUnlocked(), ErrorCodes::TIMEOUT_EXCEEDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO Absolutely wrong code: read_list could be empty; rand() is not thread safe and has low quality; motivation of rand is unclear.
|
/// TODO Absolutely wrong code: read_list could be empty; motivation of rand is unclear.
|
||||||
/// This code path is disabled by default.
|
/// This code path is disabled by default.
|
||||||
|
|
||||||
auto & socket = read_list[rand() % read_list.size()];
|
auto & socket = read_list[thread_local_rng() % read_list.size()];
|
||||||
if (fd_to_replica_state_idx.empty())
|
if (fd_to_replica_state_idx.empty())
|
||||||
{
|
{
|
||||||
fd_to_replica_state_idx.reserve(replica_states.size());
|
fd_to_replica_state_idx.reserve(replica_states.size());
|
||||||
|
@ -501,7 +501,7 @@ MutableColumns ColumnAggregateFunction::scatter(IColumn::ColumnIndex num_columns
|
|||||||
size_t num_rows = size();
|
size_t num_rows = size();
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t reserve_size = num_rows / num_columns * 1.1; /// 1.1 is just a guess. Better to use n-sigma rule.
|
size_t reserve_size = double(num_rows) / num_columns * 1.1; /// 1.1 is just a guess. Better to use n-sigma rule.
|
||||||
|
|
||||||
if (reserve_size > 1)
|
if (reserve_size > 1)
|
||||||
for (auto & column : columns)
|
for (auto & column : columns)
|
||||||
@ -576,8 +576,9 @@ ColumnAggregateFunction::MutablePtr ColumnAggregateFunction::createView() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColumnAggregateFunction::ColumnAggregateFunction(const ColumnAggregateFunction & src_)
|
ColumnAggregateFunction::ColumnAggregateFunction(const ColumnAggregateFunction & src_)
|
||||||
: foreign_arenas(concatArenas(src_.foreign_arenas, src_.my_arena)),
|
: COWHelper<IColumn, ColumnAggregateFunction>(src_),
|
||||||
func(src_.func), src(src_.getPtr()), data(src_.data.begin(), src_.data.end())
|
foreign_arenas(concatArenas(src_.foreign_arenas, src_.my_arena)),
|
||||||
|
func(src_.func), src(src_.getPtr()), data(src_.data.begin(), src_.data.end())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,12 @@ namespace ErrorCodes
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
void checkColumn(const IColumn & column)
|
||||||
|
{
|
||||||
|
if (!dynamic_cast<const IColumnUnique *>(&column))
|
||||||
|
throw Exception("ColumnUnique expected as an argument of ColumnLowCardinality.", ErrorCodes::ILLEGAL_COLUMN);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PaddedPODArray<T> * getIndexesData(IColumn & indexes)
|
PaddedPODArray<T> * getIndexesData(IColumn & indexes)
|
||||||
{
|
{
|
||||||
@ -651,13 +657,6 @@ ColumnLowCardinality::Dictionary::Dictionary(ColumnPtr column_unique_, bool is_s
|
|||||||
checkColumn(*column_unique);
|
checkColumn(*column_unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColumnLowCardinality::Dictionary::checkColumn(const IColumn & column)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!dynamic_cast<const IColumnUnique *>(&column))
|
|
||||||
throw Exception("ColumnUnique expected as an argument of ColumnLowCardinality.", ErrorCodes::ILLEGAL_COLUMN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColumnLowCardinality::Dictionary::setShared(const ColumnPtr & column_unique_)
|
void ColumnLowCardinality::Dictionary::setShared(const ColumnPtr & column_unique_)
|
||||||
{
|
{
|
||||||
checkColumn(*column_unique_);
|
checkColumn(*column_unique_);
|
||||||
|
@ -275,8 +275,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
WrappedPtr column_unique;
|
WrappedPtr column_unique;
|
||||||
bool shared = false;
|
bool shared = false;
|
||||||
|
|
||||||
void checkColumn(const IColumn & column);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Dictionary dictionary;
|
Dictionary dictionary;
|
||||||
|
@ -118,7 +118,7 @@ void ColumnVector<T>::getPermutation(bool reverse, size_t limit, int nan_directi
|
|||||||
if (s >= 256 && s <= std::numeric_limits<UInt32>::max())
|
if (s >= 256 && s <= std::numeric_limits<UInt32>::max())
|
||||||
{
|
{
|
||||||
PaddedPODArray<ValueWithIndex<T>> pairs(s);
|
PaddedPODArray<ValueWithIndex<T>> pairs(s);
|
||||||
for (UInt32 i = 0; i < s; ++i)
|
for (UInt32 i = 0; i < UInt32(s); ++i)
|
||||||
pairs[i] = {data[i], i};
|
pairs[i] = {data[i], i};
|
||||||
|
|
||||||
RadixSort<RadixSortTraits<T>>::executeLSD(pairs.data(), s);
|
RadixSort<RadixSortTraits<T>>::executeLSD(pairs.data(), s);
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
#include <common/likely.h>
|
|
||||||
#if __has_include(<sanitizer/asan_interface.h>)
|
#if __has_include(<sanitizer/asan_interface.h>)
|
||||||
# include <sanitizer/asan_interface.h>
|
# include <sanitizer/asan_interface.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <Poco/Mutex.h>
|
#include <Poco/Mutex.h>
|
||||||
#include <Poco/Semaphore.h>
|
#include <Poco/Semaphore.h>
|
||||||
|
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -219,7 +219,7 @@ void ConfigProcessor::merge(XMLDocumentPtr config, XMLDocumentPtr with)
|
|||||||
mergeRecursive(config, config_root, with_root);
|
mergeRecursive(config, config_root, with_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConfigProcessor::layerFromHost()
|
static std::string layerFromHost()
|
||||||
{
|
{
|
||||||
utsname buf;
|
utsname buf;
|
||||||
if (uname(&buf))
|
if (uname(&buf))
|
||||||
@ -294,7 +294,7 @@ void ConfigProcessor::doIncludesRecursive(
|
|||||||
|
|
||||||
auto process_include = [&](const Node * include_attr, const std::function<const Node * (const std::string &)> & get_node, const char * error_msg)
|
auto process_include = [&](const Node * include_attr, const std::function<const Node * (const std::string &)> & get_node, const char * error_msg)
|
||||||
{
|
{
|
||||||
std::string name = include_attr->getNodeValue();
|
const std::string & name = include_attr->getNodeValue();
|
||||||
const Node * node_to_include = get_node(name);
|
const Node * node_to_include = get_node(name);
|
||||||
if (!node_to_include)
|
if (!node_to_include)
|
||||||
{
|
{
|
||||||
|
@ -97,8 +97,8 @@ public:
|
|||||||
/// If preprocessed_dir is empty - calculate from loaded_config.path + /preprocessed_configs/
|
/// If preprocessed_dir is empty - calculate from loaded_config.path + /preprocessed_configs/
|
||||||
void savePreprocessedConfig(const LoadedConfig & loaded_config, std::string preprocessed_dir);
|
void savePreprocessedConfig(const LoadedConfig & loaded_config, std::string preprocessed_dir);
|
||||||
|
|
||||||
/// Set path of main config.xml . It will be cutted from all configs placed to preprocessed_configs/
|
/// Set path of main config.xml. It will be cutted from all configs placed to preprocessed_configs/
|
||||||
void setConfigPath(const std::string & config_path);
|
static void setConfigPath(const std::string & config_path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Files = std::vector<std::string>;
|
using Files = std::vector<std::string>;
|
||||||
@ -131,8 +131,6 @@ private:
|
|||||||
|
|
||||||
void merge(XMLDocumentPtr config, XMLDocumentPtr with);
|
void merge(XMLDocumentPtr config, XMLDocumentPtr with);
|
||||||
|
|
||||||
std::string layerFromHost();
|
|
||||||
|
|
||||||
void doIncludesRecursive(
|
void doIncludesRecursive(
|
||||||
XMLDocumentPtr config,
|
XMLDocumentPtr config,
|
||||||
XMLDocumentPtr include_from,
|
XMLDocumentPtr include_from,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <common/Types.h>
|
#include <common/types.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "CurrentThread.h"
|
#include "CurrentThread.h"
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
#include <common/likely.h>
|
|
||||||
#include <Common/ThreadStatus.h>
|
#include <Common/ThreadStatus.h>
|
||||||
#include <Common/TaskStatsInfoGetter.h>
|
#include <Common/TaskStatsInfoGetter.h>
|
||||||
#include <Interpreters/ProcessList.h>
|
#include <Interpreters/ProcessList.h>
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <common/likely.h>
|
|
||||||
#include <common/StringRef.h>
|
#include <common/StringRef.h>
|
||||||
#include <Common/ThreadStatus.h>
|
#include <Common/ThreadStatus.h>
|
||||||
|
|
||||||
@ -107,4 +106,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ bool DNSResolver::updateCache()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard lock(impl->drop_mutex);
|
std::lock_guard lock(impl->drop_mutex);
|
||||||
for (auto & host : impl->new_hosts)
|
for (const auto & host : impl->new_hosts)
|
||||||
impl->known_hosts.insert(std::move(host));
|
impl->known_hosts.insert(host);
|
||||||
impl->new_hosts.clear();
|
impl->new_hosts.clear();
|
||||||
|
|
||||||
impl->host_name.emplace(Poco::Net::DNS::hostName());
|
impl->host_name.emplace(Poco::Net::DNS::hostName());
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user