From 9a937591e5641f8f7f27910ea8d2ba23db0f22e8 Mon Sep 17 00:00:00 2001 From: proller Date: Thu, 4 May 2017 14:56:13 +0300 Subject: [PATCH 1/5] Try fix freebsd 11-STABLE OCbuild --- dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h index cb5c55adc92..bb1c1a8b103 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h @@ -286,7 +286,7 @@ private: ParserString dot_p("."); ParserNumber number_p; - auto pos = pattern.data(); + const char * pos = pattern.data(); const auto begin = pos; const auto end = pos + pattern.size(); From 1474de179c9f170687170063bac8b60d1a532f2a Mon Sep 17 00:00:00 2001 From: proller Date: Thu, 4 May 2017 22:40:51 +0300 Subject: [PATCH 2/5] CastTypeBlockInputStream: hotfix: sometimes columns in sample blocks and stream blocks does not match --- dbms/src/DataStreams/CastTypeBlockInputStream.cpp | 13 ++++++++++--- dbms/src/DataStreams/CastTypeBlockInputStream.h | 2 ++ dbms/tests/queries/0_stateless/00428_partition.sql | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dbms/src/DataStreams/CastTypeBlockInputStream.cpp b/dbms/src/DataStreams/CastTypeBlockInputStream.cpp index a72f759492d..c8c7696fb16 100644 --- a/dbms/src/DataStreams/CastTypeBlockInputStream.cpp +++ b/dbms/src/DataStreams/CastTypeBlockInputStream.cpp @@ -41,10 +41,17 @@ Block CastTypeBlockInputStream::readImpl() if (!block || cast_types.empty()) return block; - Block res; - size_t s = block.columns(); + size_t block_size = block.columns(); - for (size_t i = 0; i < s; ++i) + if (block_size != cast_types.size()) + { + LOG_ERROR(log, "Number of columns do not match, skipping cast"); + return block; + } + + Block res; + + for (size_t i = 0; i < block_size; ++i) { const auto & elem = block.getByPosition(i); diff --git a/dbms/src/DataStreams/CastTypeBlockInputStream.h b/dbms/src/DataStreams/CastTypeBlockInputStream.h index d7c5b2560c1..2f8c6adfb31 100644 --- a/dbms/src/DataStreams/CastTypeBlockInputStream.h +++ b/dbms/src/DataStreams/CastTypeBlockInputStream.h @@ -2,6 +2,7 @@ #include +#include #include #include @@ -34,6 +35,7 @@ private: const Context & context; std::vector> cast_types; std::vector> cast_functions; /// Used to perform type conversions. + Logger * log = &Logger::get("CastTypeBlockInputStream"); }; } diff --git a/dbms/tests/queries/0_stateless/00428_partition.sql b/dbms/tests/queries/0_stateless/00428_partition.sql index 7ff9bbd7c19..365f0ba5c4b 100644 --- a/dbms/tests/queries/0_stateless/00428_partition.sql +++ b/dbms/tests/queries/0_stateless/00428_partition.sql @@ -1,4 +1,5 @@ -- Not found column date in block. There are only columns: x. +drop table if exists test.partition_428; create table test.partition_428 (date MATERIALIZED toDate(0), x UInt64, sample_key MATERIALIZED intHash64(x)) ENGINE=MergeTree(date,sample_key,(date,x,sample_key),8192); insert into test.partition_428 ( x ) VALUES ( now() ); insert into test.partition_428 ( x ) VALUES ( now()+1 ); From 6c34f27e3b4b1ce7578aed9f64d8971340d1a303 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 5 May 2017 03:23:32 +0300 Subject: [PATCH 3/5] Another freebsd fix, update freebsd build doc --- dbms/src/Storages/ColumnsDescription.cpp | 2 +- doc/build_freebsd.sh | 43 +++++++++++++++--------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/dbms/src/Storages/ColumnsDescription.cpp b/dbms/src/Storages/ColumnsDescription.cpp index 207f4f4cddc..c663643c049 100644 --- a/dbms/src/Storages/ColumnsDescription.cpp +++ b/dbms/src/Storages/ColumnsDescription.cpp @@ -104,7 +104,7 @@ ColumnsDescription ColumnsDescription::parse(const String & str) ASTPtr default_expr; Expected expected{}; - auto begin = default_expr_str.data(); + const char * begin = default_expr_str.data(); const auto end = begin + default_expr_str.size(); const char * max_parsed_pos = begin; if (!expr_parser.parse(begin, end, default_expr, max_parsed_pos, expected)) diff --git a/doc/build_freebsd.sh b/doc/build_freebsd.sh index 92fd419323d..230e1793449 100755 --- a/doc/build_freebsd.sh +++ b/doc/build_freebsd.sh @@ -1,35 +1,46 @@ #!/bin/sh -# How to build ClickHouse under freebsd 11+ -# [temporary solution before port created] +# How to build ClickHouse under freebsd 11+ + +# Variant 1: Use pkg: +# pkg install databases/clickhouse + +# Variant 2: Use ports: +# make -C /usr/ports/databases/clickhouse install clean + +# Run server: +# echo clickhouse_enable="YES" >> /etc/rc.conf.local +# service clickhouse restart + + +# Variant 3: Manual build: # pkg install -y curl sudo # curl https://raw.githubusercontent.com/yandex/ClickHouse/master/doc/build_freebsd.sh | sh -# install compiler and libs -sudo pkg install git cmake bash mysql57-client icu libltdl unixODBC google-perftools +# install compiler and libs +sudo pkg install devel/git devel/cmake shells/bash devel/icu devel/libltdl databases/unixODBC devel/google-perftools devel/libzookeeper devel/libdouble-conversion archivers/zstd archivers/liblz4 devel/sparsehash devel/re2 -# install testing only stuff if you want: -sudo pkg install python py27-lxml py27-termcolor curl perl5 +# install testing only stuff if you want: +sudo pkg install lang/python devel/py-lxml devel/py-termcolor ftp/curl perl5 -# Checkout ClickHouse sources +# If you want ODBC support: Check UNIXODBC option: +# make -C /usr/ports/devel/poco config reinstall + +# Checkout ClickHouse sources git clone https://github.com/yandex/ClickHouse.git -# Build! +# Build! mkdir -p ClickHouse/build cd ClickHouse/build -cmake .. -DUSE_INTERNAL_GPERFTOOLS_LIBRARY=0 -# WIP: variant with libs from ports: -# sudo pkg install devel/boost-libs devel/libzookeeper devel/libdouble-conversion archivers/zstd archivers/liblz4 devel/sparsehash devel/re2 -# Check UNIXODBC option: -# make -C /usr/ports/devel/poco config reinstall -# cmake .. -DUNBUNDLED=1 -DUSE_STATIC_LIBRARIES=0 -DNO_WERROR=1 +cmake .. -DUNBUNDLED=1 -DUSE_STATIC_LIBRARIES=0 -DNO_WERROR=1 -DUSE_INTERNAL_BOOST_LIBRARY=1 +# build with boost 1.64 from ports temporary broken make -C dbms/src/Server -j $(nproc || sysctl -n hw.ncpu || echo 2) cd ../.. -# run server: +# Run server: # ClickHouse/build/dbms/src/Server/clickhouse --server --config-file=ClickHouse/dbms/src/Server/config.xml & -# run client: +# Run client: # ClickHouse/build/dbms/src/Server/clickhouse --client From 9bcece79f9b357748dffce82e708b9a434449052 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 5 May 2017 17:14:49 +0300 Subject: [PATCH 4/5] tests: dont stop on errors by default --- dbms/tests/clickhouse-test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbms/tests/clickhouse-test b/dbms/tests/clickhouse-test index 9be8227d5b6..c285b3299db 100755 --- a/dbms/tests/clickhouse-test +++ b/dbms/tests/clickhouse-test @@ -160,7 +160,7 @@ def main(args): report_testcase.append(stderr_element) print(stderr) - if 'Connection refused' in stderr or 'Attempt to read after eof' in stderr: + if args.stop and ('Connection refused' in stderr or 'Attempt to read after eof' in stderr): SERVER_DIED = True elif stderr: @@ -235,6 +235,7 @@ if __name__ == '__main__': group.add_argument('--no-zookeeper', action = 'store_false', default = None, dest = 'zookeeper', help = 'Do not run zookeeper related tests') group.add_argument('--shard', action = 'store_true', default = None, dest = 'shard', help = 'Run sharding related tests (required to clickhouse-server listen 127.0.0.2 127.0.0.3)') group.add_argument('--no-shard', action = 'store_false', default = None, dest = 'shard', help = 'Do not run shard related tests') + group.add_argument('--stop', action = 'store_true', default = None, dest = 'stop', help = 'Stop on network errors ') args = parser.parse_args() From b1f1096f2795328b596f68e5d8016f0a963d6639 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 5 May 2017 17:50:05 +0300 Subject: [PATCH 5/5] tests: correct Connection refused detection (#766) --- dbms/tests/clickhouse-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/tests/clickhouse-test b/dbms/tests/clickhouse-test index c285b3299db..5cb094333fe 100755 --- a/dbms/tests/clickhouse-test +++ b/dbms/tests/clickhouse-test @@ -160,7 +160,7 @@ def main(args): report_testcase.append(stderr_element) print(stderr) - if args.stop and ('Connection refused' in stderr or 'Attempt to read after eof' in stderr): + if args.stop and ('Connection refused' in stderr or 'Attempt to read after eof' in stderr) and not 'Received exception from server' in stderr: SERVER_DIED = True elif stderr: