From 1ce9293e9773669be48b03a3f5ea4542b253aa78 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 13 Mar 2021 10:31:19 +0300 Subject: [PATCH 1/4] Fix 01035_lc_empty_part_bug under stress tests Found in [1]: 2021.03.12 23:32:58.897190 [ 436606 ] {97a08a8f-4630-44f8-ba18-a94c6fabbded} test_13.lc_empty_part_bug: Waiting mutation: mutation_3.txt ... 2021.03.12 23:32:58.900444 [ 374 ] {} test_13.lc_empty_part_bug: Current max source part size for mutation is 0 but part size 1. Will not mutate part all_1_1_0_2. Max size depends not only on available space, but also on settings 'number_of_free_entries_in_pool_to_execute_mutation' and 'background_pool_size' ... Hang check: query: alter table lc_empty_part_bug modify column s LowCardinality(String); elapsed: 2156.396613506 [1]: https://clickhouse-test-reports.s3.yandex.net/21511/d7d9638ceb6bd702f34a88ee54f8f83197e90af5/stress_test_(address).html#fail1 --- tests/queries/0_stateless/01035_lc_empty_part_bug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/01035_lc_empty_part_bug.sh b/tests/queries/0_stateless/01035_lc_empty_part_bug.sh index b65cf87d1ca..185c4ef4a4e 100755 --- a/tests/queries/0_stateless/01035_lc_empty_part_bug.sh +++ b/tests/queries/0_stateless/01035_lc_empty_part_bug.sh @@ -8,7 +8,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ${CLICKHOUSE_CLIENT} --multiquery --query=" DROP TABLE IF EXISTS lc_empty_part_bug; - create table lc_empty_part_bug (id UInt64, s String) Engine=MergeTree ORDER BY id; + create table lc_empty_part_bug (id UInt64, s String) Engine=MergeTree ORDER BY id SETTINGS number_of_free_entries_in_pool_to_execute_mutation=0; insert into lc_empty_part_bug select number as id, toString(rand()) from numbers(100); alter table lc_empty_part_bug delete where id < 100; " --mutations_sync=1 From a301aa64dae1c879f121ee02dd64e6c0b3bae4a9 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 13 Mar 2021 10:37:05 +0300 Subject: [PATCH 2/4] Do not use system-wide SYSTEM STOP TTL MERGES, use per-table instead Fixes 01294_lazy_database_concurrent_recreate_reattach_and_show_tables --- ...y_database_concurrent_recreate_reattach_and_show_tables.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh index d8f72c7837d..f5a4a1adac0 100755 --- a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh +++ b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh @@ -70,8 +70,10 @@ function recreate_lazy_func4() function test_func() { while true; do - $CLICKHOUSE_CLIENT -q "SYSTEM STOP TTL MERGES"; + for table in log tlog slog tlog2; do + $CLICKHOUSE_CLIENT -q "SYSTEM STOP TTL MERGES $CURR_DATABASE.$table" >& /dev/null done + done } From 2d66a5c393cf7b42309b82050e197ad2f1709934 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 13 Mar 2021 11:29:40 +0300 Subject: [PATCH 3/4] Fix hang check for 00966_live_view_watch_events_http If INSERT was failed then WATCH EVENTS will hang: 2021.03.12 23:45:33.666223 [ 1901 ] {} DynamicQueryHandler: Request URI: /?allow_experimental_live_view=1&query=WATCH%20test.lv%20EVENTS ... 2021.03.12 23:45:34.119465 [ 35492 ] {55f2c8ec-df9f-4e97-9acc-385ed5b5fde2} executeQuery: Code: 241, e.displayText() = DB::Exception: Memory limit (for user) exceeded: would use 153.99 MiB (attempt to allocate chunk of 4194729 bytes), maximum: 150.00 MiB (version 21.4.1.6239) (from [::1]:43910) (in query: INSERT INTO test.mt VALUES ), Stack trace (when copying this message, always include the lines below): ... Hung check: elapsed: 597.835824299 is_cancelled: 0 query: WATCH test.lv EVENTS thread_ids: [1901] gdb: Thread 133 (Thread 0x7f26ac95b700 (LWP 1901)): 0 0x00007f2793d447b1 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 1 0x0000000008cbd5c5 in __tsan::call_pthread_cancel_with_cleanup(int (*)(void*, void*, void*), void*, void*, void*, void (*)(void*), void*) () 2 0x0000000008c4f134 in cond_wait(__tsan::ThreadState*, unsigned long, __tsan::ScopedInterceptor*, int (*)(void*, void*, void*), void*, void*, void*) () 3 0x0000000008c4f339 in pthread_cond_timedwait () 4 0x000000001831c8b6 in std::__1::__libcpp_condvar_timedwait (__cv=0x7b5801053520, __m=0x189, __ts=0x7f26ac9132b8) at ../contrib/libcxx/include/__threading_support:442 5 std::__1::condition_variable::__do_timed_wait (this=0x7b5801053520, lk=..., tp=...) at ../contrib/libcxx/src/condition_variable.cpp:74 6 0x00000000134fe7f2 in std::__1::condition_variable::wait_for > (this=this@entry=0x7b5801053520, __lk=..., __d=...) at ../contrib/libcxx/include/__mutex_base:462 7 0x00000000134fe2c9 in DB::LiveViewEventsBlockInputStream::tryReadImpl (this=this@entry=0x7b5c0070ff98, blocking=false) at ../src/Storages/LiveView/LiveViewEventsBlockInputStream.h:180 8 0x00000000134fd6e4 in DB::LiveViewEventsBlockInputStream::readImpl (this=0x189) at ../src/Storages/LiveView/LiveViewEventsBlockInputStream.h:115 9 0x0000000012285593 in DB::IBlockInputStream::read (this=0x7b5c0070ff98) at ../src/DataStreams/IBlockInputStream.cpp:58 10 0x00000000122afc7e in DB::copyDataImpl const&, std::__1::function const&>(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::__1::function const&, std::__1::function const&) (from=..., to=..., is_cancelled=..., progress=...) at ../src/DataStreams/copyData.cpp:26 11 0x00000000122af8e1 in DB::copyData(DB::IBlockInputStream&, DB::IBlockOutputStream&, std::__1::function const&, std::__1::function const&) (from=..., to=..., is_cancelled=..., progress=...) at ../src/DataStreams/copyData.cpp:73 12 0x0000000012cfc5e2 in DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, DB::Context&, std::__1::function, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&)>) (istr=..., ostr=..., allow_into_outfile=false, context=..., set_result_details=...) at ../src/Interpreters/executeQuery.cpp:1033 13 0x000000001357941d in DB::HTTPHandler::processQuery (this=this@entry=0x7b1c006f41b0, context=..., request=..., params=..., response=..., used_output=..., query_scope=...) at ../src/Server/HTTPHandler.cpp:772 14 0x000000001357c507 in DB::HTTPHandler::handleRequest (this=, request=..., response=...) at ../src/Server/HTTPHandler.cpp:910 15 0x00000000135f3081 in DB::HTTPServerConnection::run (this=) at ../src/Server/HTTP/HTTPServerConnection.cpp:48 16 0x00000000161f9e73 in Poco::Net::TCPServerConnection::start (this=0x7b8c01554000) at ../contrib/poco/Net/src/TCPServerConnection.cpp:43 17 0x00000000161fa59f in Poco::Net::TCPServerDispatcher::run (this=) at ../contrib/poco/Net/src/TCPServerDispatcher.cpp:113 18 0x0000000016361732 in Poco::PooledThread::run (this=) at ../contrib/poco/Foundation/src/ThreadPool.cpp:199 19 0x000000001635fcd0 in Poco::(anonymous namespace)::RunnableHolder::run (this=) at ../contrib/poco/Foundation/src/Thread.cpp:55 20 0x000000001635e4d8 in Poco::ThreadImpl::runnableEntry (pThread=0x7b5400082538) at ../contrib/poco/Foundation/src/Thread_POSIX.cpp:345 21 0x0000000008c4e36d in __tsan_thread_start_func () 22 0x00007f2793d3d609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 23 0x00007f2793c64293 in clone () from /lib/x86_64-linux-gnu/libc.so.6 Cc: @vzakaznikov --- .../00966_live_view_watch_events_http.py | 19 +++++++++--------- .../0_stateless/00967_live_view_watch_http.py | 20 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/tests/queries/0_stateless/00966_live_view_watch_events_http.py b/tests/queries/0_stateless/00966_live_view_watch_events_http.py index 3d407ec5602..1c00a5d1236 100755 --- a/tests/queries/0_stateless/00966_live_view_watch_events_http.py +++ b/tests/queries/0_stateless/00966_live_view_watch_events_http.py @@ -28,13 +28,14 @@ with client(name='client1>', log=log) as client1: client1.expect(prompt) - with http_client({'method':'GET', 'url': '/?allow_experimental_live_view=1&query=WATCH%20test.lv%20EVENTS'}, name='client2>', log=log) as client2: - client2.expect('.*1\n') - client1.send('INSERT INTO test.mt VALUES (1),(2),(3)') + try: + with http_client({'method':'GET', 'url': '/?allow_experimental_live_view=1&query=WATCH%20test.lv%20EVENTS'}, name='client2>', log=log) as client2: + client2.expect('.*1\n') + client1.send('INSERT INTO test.mt VALUES (1),(2),(3)') + client1.expect(prompt) + client2.expect('.*2\n') + finally: + client1.send('DROP TABLE test.lv') + client1.expect(prompt) + client1.send('DROP TABLE test.mt') client1.expect(prompt) - client2.expect('.*2\n') - - client1.send('DROP TABLE test.lv') - client1.expect(prompt) - client1.send('DROP TABLE test.mt') - client1.expect(prompt) diff --git a/tests/queries/0_stateless/00967_live_view_watch_http.py b/tests/queries/0_stateless/00967_live_view_watch_http.py index d26bb5402e7..c41b9f0c861 100755 --- a/tests/queries/0_stateless/00967_live_view_watch_http.py +++ b/tests/queries/0_stateless/00967_live_view_watch_http.py @@ -27,14 +27,14 @@ with client(name='client1>', log=log) as client1: client1.send('CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt') client1.expect(prompt) - - with http_client({'method':'GET', 'url':'/?allow_experimental_live_view=1&query=WATCH%20test.lv'}, name='client2>', log=log) as client2: - client2.expect('.*0\t1\n') - client1.send('INSERT INTO test.mt VALUES (1),(2),(3)') + try: + with http_client({'method':'GET', 'url':'/?allow_experimental_live_view=1&query=WATCH%20test.lv'}, name='client2>', log=log) as client2: + client2.expect('.*0\t1\n') + client1.send('INSERT INTO test.mt VALUES (1),(2),(3)') + client1.expect(prompt) + client2.expect('.*6\t2\n') + finally: + client1.send('DROP TABLE test.lv') + client1.expect(prompt) + client1.send('DROP TABLE test.mt') client1.expect(prompt) - client2.expect('.*6\t2\n') - - client1.send('DROP TABLE test.lv') - client1.expect(prompt) - client1.send('DROP TABLE test.mt') - client1.expect(prompt) From 833dbf122572f209a79ddeae9bcf3a626be69915 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 13 Mar 2021 13:42:47 +0300 Subject: [PATCH 4/4] Mark 01294_lazy_database_concurrent_recreate_reattach_and_show_tables as long --- ...ncurrent_recreate_reattach_and_show_tables_long.reference} | 0 ...base_concurrent_recreate_reattach_and_show_tables_long.sh} | 0 tests/queries/query_test.py | 2 +- tests/queries/skip_list.json | 4 ++-- 4 files changed, 3 insertions(+), 3 deletions(-) rename tests/queries/0_stateless/{01294_lazy_database_concurrent_recreate_reattach_and_show_tables.reference => 01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.reference} (100%) rename tests/queries/0_stateless/{01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh => 01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.sh} (100%) diff --git a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.reference b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.reference similarity index 100% rename from tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.reference rename to tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.reference diff --git a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.sh similarity index 100% rename from tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh rename to tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long.sh diff --git a/tests/queries/query_test.py b/tests/queries/query_test.py index 417a51fe523..adb26820478 100644 --- a/tests/queries/query_test.py +++ b/tests/queries/query_test.py @@ -46,7 +46,7 @@ SKIP_LIST = [ "01293_client_interactive_vertical_singleline", # expect-test "01293_system_distribution_queue", # FLAKY "01293_show_clusters", - "01294_lazy_database_concurrent_recreate_reattach_and_show_tables", + "01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long", "01294_system_distributed_on_cluster", "01300_client_save_history_when_terminated", # expect-test "01304_direct_io", diff --git a/tests/queries/skip_list.json b/tests/queries/skip_list.json index cc34b828d36..a24ed327fbd 100644 --- a/tests/queries/skip_list.json +++ b/tests/queries/skip_list.json @@ -396,7 +396,7 @@ "01293_pretty_max_value_width", "01293_show_settings", "01294_create_settings_profile", - "01294_lazy_database_concurrent_recreate_reattach_and_show_tables", + "01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long", "01295_create_row_policy", "01296_create_row_policy_in_current_database", "01297_create_quota", @@ -681,7 +681,7 @@ "01281_unsucceeded_insert_select_queries_counter", "01293_system_distribution_queue", "01294_lazy_database_concurrent", - "01294_lazy_database_concurrent_recreate_reattach_and_show_tables", + "01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long", "01294_system_distributed_on_cluster", "01296_create_row_policy_in_current_database", "01297_create_quota",