2011-10-31 06:37:12 +00:00
|
|
|
#pragma once
|
2010-05-21 19:52:50 +00:00
|
|
|
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_HOST "localhost"
|
|
|
|
#define DBMS_DEFAULT_PORT 9000
|
2017-09-29 16:58:04 +00:00
|
|
|
#define DBMS_DEFAULT_SECURE_PORT 9440
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_HTTP_PORT 8123
|
|
|
|
#define DBMS_DEFAULT_CONNECT_TIMEOUT_SEC 10
|
|
|
|
#define DBMS_DEFAULT_CONNECT_TIMEOUT_WITH_FAILOVER_MS 50
|
2020-02-06 17:23:05 +00:00
|
|
|
#define DBMS_DEFAULT_CONNECT_TIMEOUT_WITH_FAILOVER_SECURE_MS 100
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_SEND_TIMEOUT_SEC 300
|
|
|
|
#define DBMS_DEFAULT_RECEIVE_TIMEOUT_SEC 300
|
2017-04-19 18:29:50 +00:00
|
|
|
/// Timeout for synchronous request-result protocol call (like Ping or TablesStatus).
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_SYNC_REQUEST_TIMEOUT_SEC 5
|
|
|
|
#define DBMS_DEFAULT_POLL_INTERVAL 10
|
2012-07-06 18:12:52 +00:00
|
|
|
|
2017-04-30 13:50:16 +00:00
|
|
|
/// The size of the I/O buffer by default.
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_BUFFER_SIZE 1048576ULL
|
2015-04-12 04:39:20 +00:00
|
|
|
|
2017-04-30 13:50:16 +00:00
|
|
|
/** Which blocks by default read the data (by number of rows).
|
2017-05-09 19:07:35 +00:00
|
|
|
* Smaller values give better cache locality, less consumption of RAM, but more overhead to process the query.
|
2014-04-29 20:22:57 +00:00
|
|
|
*/
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DEFAULT_BLOCK_SIZE 65536
|
2014-04-29 20:22:57 +00:00
|
|
|
|
2017-04-30 13:50:16 +00:00
|
|
|
/** Which blocks should be formed for insertion into the table, if we control the formation of blocks.
|
|
|
|
* (Sometimes the blocks are inserted exactly such blocks that have been read / transmitted from the outside, and this parameter does not affect their size.)
|
|
|
|
* More than DEFAULT_BLOCK_SIZE, because in some tables a block of data on the disk is created for each block (quite a big thing),
|
|
|
|
* and if the parts were small, then it would be costly then to combine them.
|
2014-04-29 20:22:57 +00:00
|
|
|
*/
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DEFAULT_INSERT_BLOCK_SIZE 1048576
|
2014-04-29 20:22:57 +00:00
|
|
|
|
2017-04-30 13:50:16 +00:00
|
|
|
/** The same, but for merge operations. Less DEFAULT_BLOCK_SIZE for saving RAM (since all the columns are read).
|
|
|
|
* Significantly less, since there are 10-way mergers.
|
2014-04-29 20:22:57 +00:00
|
|
|
*/
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DEFAULT_MERGE_BLOCK_SIZE 8192
|
|
|
|
|
2019-05-28 21:17:48 +00:00
|
|
|
#define DEFAULT_TEMPORARY_LIVE_VIEW_TIMEOUT_SEC 5
|
2020-02-12 17:39:57 +00:00
|
|
|
#define DEFAULT_WINDOW_VIEW_INNER_TABLE_CLEAN_INTERVAL_SEC 5
|
2017-09-01 17:21:03 +00:00
|
|
|
#define SHOW_CHARS_ON_SYNTAX_ERROR ptrdiff_t(160)
|
2019-06-07 01:10:56 +00:00
|
|
|
#define DEFAULT_LIVE_VIEW_HEARTBEAT_INTERVAL_SEC 15
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_DEFAULT_DISTRIBUTED_CONNECTIONS_POOL_SIZE 1024
|
|
|
|
#define DBMS_CONNECTION_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES 3
|
2017-04-30 13:50:16 +00:00
|
|
|
/// each period reduces the error counter by 2 times
|
|
|
|
/// too short a period can cause errors to disappear immediately after creation.
|
2019-08-06 04:36:38 +00:00
|
|
|
#define DBMS_CONNECTION_POOL_WITH_FAILOVER_DEFAULT_DECREASE_ERROR_PERIOD 60
|
2019-08-23 05:04:45 +00:00
|
|
|
/// replica error max cap, this is to prevent replica from accumulating too many errors and taking to long to recover.
|
2019-08-06 04:36:38 +00:00
|
|
|
#define DBMS_CONNECTION_POOL_WITH_FAILOVER_MAX_ERROR_COUNT 1000
|
2012-08-26 11:14:52 +00:00
|
|
|
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_CLIENT_INFO 54032
|
|
|
|
#define DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE 54058
|
|
|
|
#define DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO 54060
|
|
|
|
#define DBMS_MIN_REVISION_WITH_TABLES_STATUS 54226
|
2018-02-16 19:34:21 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_TIME_ZONE_PARAMETER_IN_DATETIME_DATA_TYPE 54337
|
2018-03-23 16:18:36 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME 54372
|
2018-07-31 21:36:18 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_VERSION_PATCH 54401
|
2018-08-14 20:29:42 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_SERVER_LOGS 54406
|
2019-02-13 11:57:47 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_CLIENT_SUPPORT_EMBEDDED_DATA 54415
|
2018-09-28 20:17:38 +00:00
|
|
|
/// Minimum revision with exactly the same set of aggregation methods and rules to select them.
|
|
|
|
/// Two-level (bucketed) aggregation is incompatible if servers are inconsistent in these rules
|
|
|
|
/// (keys will be placed in different buckets and result will not be fully aggregated).
|
|
|
|
#define DBMS_MIN_REVISION_WITH_CURRENT_AGGREGATION_VARIANT_SELECTION_METHOD 54408
|
2018-11-14 15:23:00 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_COLUMN_DEFAULTS_METADATA 54410
|
2016-07-31 03:53:16 +00:00
|
|
|
|
2018-12-06 11:24:07 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_LOW_CARDINALITY_TYPE 54405
|
2019-07-15 18:05:49 +00:00
|
|
|
#define DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO 54420
|
2019-05-06 06:14:37 +00:00
|
|
|
|
2019-11-16 23:12:35 +00:00
|
|
|
/// Mininum revision supporting SettingsBinaryFormat::STRINGS.
|
|
|
|
#define DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS 54429
|
|
|
|
|
2016-07-31 03:53:16 +00:00
|
|
|
/// Version of ClickHouse TCP protocol. Set to git tag with latest protocol change.
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DBMS_TCP_PROTOCOL_VERSION 54226
|
2014-08-15 09:50:05 +00:00
|
|
|
|
2017-04-30 13:50:16 +00:00
|
|
|
/// The boundary on which the blocks for asynchronous file operations should be aligned.
|
2017-05-26 15:30:07 +00:00
|
|
|
#define DEFAULT_AIO_FILE_BLOCK_SIZE 4096
|
2015-03-12 16:22:49 +00:00
|
|
|
|
2017-12-27 17:58:52 +00:00
|
|
|
#define DEFAULT_HTTP_READ_BUFFER_TIMEOUT 1800
|
|
|
|
#define DEFAULT_HTTP_READ_BUFFER_CONNECTION_TIMEOUT 1
|
2018-11-20 13:15:44 +00:00
|
|
|
/// Maximum namber of http-connections between two endpoints
|
|
|
|
/// the number is unmotivated
|
2018-11-16 13:33:43 +00:00
|
|
|
#define DEFAULT_COUNT_OF_HTTP_CONNECTIONS_PER_ENDPOINT 15
|
2017-12-27 17:58:52 +00:00
|
|
|
|
2018-11-27 16:11:46 +00:00
|
|
|
#define DBMS_DEFAULT_PATH "/var/lib/clickhouse/"
|
2017-12-27 17:58:52 +00:00
|
|
|
|
2018-03-23 16:05:14 +00:00
|
|
|
// more aliases: https://mailman.videolan.org/pipermail/x264-devel/2014-May/010660.html
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
2016-01-13 02:11:40 +00:00
|
|
|
|
2019-01-23 14:18:19 +00:00
|
|
|
#define PLATFORM_NOT_SUPPORTED "The only supported platforms are x86_64 and AArch64, PowerPC (work in progress)"
|
2016-01-13 02:11:40 +00:00
|
|
|
|
2019-01-23 14:18:19 +00:00
|
|
|
#if !defined(__x86_64__) && !defined(__aarch64__) && !defined(__PPC__)
|
2019-04-06 22:20:09 +00:00
|
|
|
#error PLATFORM_NOT_SUPPORTED
|
2016-01-13 02:11:40 +00:00
|
|
|
#endif
|
2016-06-10 18:58:04 +00:00
|
|
|
|
2016-07-30 04:44:04 +00:00
|
|
|
/// Check for presence of address sanitizer
|
2019-08-17 22:53:46 +00:00
|
|
|
#if !defined(ADDRESS_SANITIZER)
|
2016-06-10 18:58:04 +00:00
|
|
|
#if defined(__has_feature)
|
2017-04-01 07:20:54 +00:00
|
|
|
#if __has_feature(address_sanitizer)
|
|
|
|
#define ADDRESS_SANITIZER 1
|
|
|
|
#endif
|
2016-06-10 18:58:04 +00:00
|
|
|
#elif defined(__SANITIZE_ADDRESS__)
|
2017-04-01 07:20:54 +00:00
|
|
|
#define ADDRESS_SANITIZER 1
|
2016-06-10 18:58:04 +00:00
|
|
|
#endif
|
2019-08-17 22:53:46 +00:00
|
|
|
#endif
|
2016-07-30 04:44:04 +00:00
|
|
|
|
2019-08-17 22:53:46 +00:00
|
|
|
#if !defined(THREAD_SANITIZER)
|
2016-07-30 04:44:04 +00:00
|
|
|
#if defined(__has_feature)
|
2017-04-01 07:20:54 +00:00
|
|
|
#if __has_feature(thread_sanitizer)
|
|
|
|
#define THREAD_SANITIZER 1
|
|
|
|
#endif
|
2016-07-30 04:44:04 +00:00
|
|
|
#elif defined(__SANITIZE_THREAD__)
|
2017-04-01 07:20:54 +00:00
|
|
|
#define THREAD_SANITIZER 1
|
2016-07-30 04:44:04 +00:00
|
|
|
#endif
|
2019-08-17 22:53:46 +00:00
|
|
|
#endif
|
2018-12-26 23:17:04 +00:00
|
|
|
|
2019-08-17 22:53:46 +00:00
|
|
|
#if !defined(MEMORY_SANITIZER)
|
2018-12-28 04:43:24 +00:00
|
|
|
#if defined(__has_feature)
|
|
|
|
#if __has_feature(memory_sanitizer)
|
|
|
|
#define MEMORY_SANITIZER 1
|
|
|
|
#endif
|
|
|
|
#elif defined(__MEMORY_SANITIZER__)
|
|
|
|
#define MEMORY_SANITIZER 1
|
|
|
|
#endif
|
2019-08-17 22:53:46 +00:00
|
|
|
#endif
|
2018-12-28 04:43:24 +00:00
|
|
|
|
2019-09-01 16:21:54 +00:00
|
|
|
/// TODO Strange enough, there is no way to detect UB sanitizer.
|
|
|
|
|
2018-12-26 23:17:04 +00:00
|
|
|
/// 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__)
|
2018-12-26 23:55:09 +00:00
|
|
|
#define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
|
2019-02-13 13:42:01 +00:00
|
|
|
#define NO_SANITIZE_ADDRESS __attribute__((__no_sanitize__("address")))
|
2019-04-06 22:20:09 +00:00
|
|
|
#define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
|
2018-12-26 23:17:04 +00:00
|
|
|
#else
|
|
|
|
/// It does not work in GCC. GCC 7 cannot recognize this attribute and GCC 8 simply ignores it.
|
2018-12-26 23:55:09 +00:00
|
|
|
#define NO_SANITIZE_UNDEFINED
|
2019-02-13 13:42:01 +00:00
|
|
|
#define NO_SANITIZE_ADDRESS
|
2019-04-06 22:20:09 +00:00
|
|
|
#define NO_SANITIZE_THREAD
|
2018-12-26 23:17:04 +00:00
|
|
|
#endif
|
2019-02-26 10:37:47 +00:00
|
|
|
|
|
|
|
#if defined __GNUC__ && !defined __clang__
|
|
|
|
#define OPTIMIZE(x) __attribute__((__optimize__(x)))
|
|
|
|
#else
|
|
|
|
#define OPTIMIZE(x)
|
2018-12-26 23:17:04 +00:00
|
|
|
#endif
|
2019-04-08 10:04:26 +00:00
|
|
|
|
2019-11-16 23:12:35 +00:00
|
|
|
/// Marks that extra information is sent to a shard. It could be any magic numbers.
|
2019-12-05 10:34:25 +00:00
|
|
|
#define DBMS_DISTRIBUTED_SIGNATURE_HEADER 0xCAFEDACEull
|
|
|
|
#define DBMS_DISTRIBUTED_SIGNATURE_HEADER_OLD_FORMAT 0xCAFECABEull
|
2019-07-19 14:22:57 +00:00
|
|
|
|
2019-08-04 00:19:03 +00:00
|
|
|
#if !__has_include(<sanitizer/asan_interface.h>)
|
|
|
|
# define ASAN_UNPOISON_MEMORY_REGION(a, b)
|
|
|
|
# define ASAN_POISON_MEMORY_REGION(a, b)
|
|
|
|
#endif
|
|
|
|
|
2019-07-19 21:09:28 +00:00
|
|
|
/// A macro for suppressing warnings about unused variables or function results.
|
|
|
|
/// Useful for structured bindings which have no standard way to declare this.
|
2019-07-27 17:04:26 +00:00
|
|
|
#define UNUSED(...) (void)(__VA_ARGS__)
|