2019-10-17 17:18:54 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-09-12 12:35:27 +00:00
|
|
|
# Tags: no-parallel, no-fasttest
|
2019-10-17 17:18:54 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2019-10-17 17:18:54 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT -mn -q "
|
2019-10-17 17:18:54 +00:00
|
|
|
DROP DATABASE IF EXISTS database_for_dict;
|
|
|
|
DROP TABLE IF EXISTS table_for_dict1;
|
|
|
|
DROP TABLE IF EXISTS table_for_dict2;
|
|
|
|
|
|
|
|
CREATE TABLE table_for_dict1 (key_column UInt64, value_column String) ENGINE = MergeTree ORDER BY key_column;
|
|
|
|
CREATE TABLE table_for_dict2 (key_column UInt64, value_column String) ENGINE = MergeTree ORDER BY key_column;
|
|
|
|
|
|
|
|
INSERT INTO table_for_dict1 SELECT number, toString(number) from numbers(1000);
|
|
|
|
INSERT INTO table_for_dict2 SELECT number, toString(number) from numbers(1000, 1000);
|
|
|
|
|
|
|
|
CREATE DATABASE database_for_dict;
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
CREATE DICTIONARY database_for_dict.dict1 (key_column UInt64, value_column String)
|
|
|
|
PRIMARY KEY key_column
|
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB '$CLICKHOUSE_DATABASE'))
|
|
|
|
LIFETIME(MIN 1 MAX 5)
|
|
|
|
LAYOUT(FLAT());
|
|
|
|
|
|
|
|
CREATE DICTIONARY database_for_dict.dict2 (key_column UInt64, value_column String)
|
|
|
|
PRIMARY KEY key_column
|
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict2' PASSWORD '' DB '$CLICKHOUSE_DATABASE'))
|
|
|
|
LIFETIME(MIN 1 MAX 5)
|
|
|
|
LAYOUT(CACHE(SIZE_IN_CELLS 150));
|
2019-10-17 17:18:54 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
|
|
|
|
function thread1()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "SELECT * FROM system.dictionaries FORMAT Null"
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function thread2()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "ATTACH DICTIONARY database_for_dict.dict1" ||:
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function thread3()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "ATTACH DICTIONARY database_for_dict.dict2" ||:
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function thread4()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT -n -q "
|
2019-10-17 17:18:54 +00:00
|
|
|
SELECT * FROM database_for_dict.dict1 FORMAT Null;
|
|
|
|
SELECT * FROM database_for_dict.dict2 FORMAT Null;
|
2022-02-26 19:09:34 +00:00
|
|
|
" ||:
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function thread5()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT -n -q "
|
2019-10-17 17:18:54 +00:00
|
|
|
SELECT dictGetString('database_for_dict.dict1', 'value_column', toUInt64(number)) from numbers(1000) FROM FORMAT Null;
|
|
|
|
SELECT dictGetString('database_for_dict.dict2', 'value_column', toUInt64(number)) from numbers(1000) FROM FORMAT Null;
|
2022-02-26 19:09:34 +00:00
|
|
|
" ||:
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function thread6()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "DETACH DICTIONARY database_for_dict.dict1"
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function thread7()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "DETACH DICTIONARY database_for_dict.dict2"
|
2019-10-17 17:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
export -f thread1
|
|
|
|
export -f thread2
|
|
|
|
export -f thread3
|
|
|
|
export -f thread4
|
|
|
|
export -f thread5
|
|
|
|
export -f thread6
|
|
|
|
export -f thread7
|
2019-10-17 17:18:54 +00:00
|
|
|
|
|
|
|
TIMEOUT=10
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread1 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread2 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread3 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread4 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread5 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread6 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread7 2> /dev/null &
|
|
|
|
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread1 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread2 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread3 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread4 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread5 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread6 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread7 2> /dev/null &
|
|
|
|
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread1 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread2 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread3 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread4 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread5 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread6 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread7 2> /dev/null &
|
|
|
|
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread1 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread2 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread3 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread4 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread5 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread6 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT thread7 2> /dev/null &
|
2019-10-17 17:18:54 +00:00
|
|
|
|
|
|
|
wait
|
|
|
|
$CLICKHOUSE_CLIENT -q "SELECT 'Still alive'"
|
|
|
|
|
2021-02-08 19:36:17 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "ATTACH DICTIONARY IF NOT EXISTS database_for_dict.dict1"
|
|
|
|
$CLICKHOUSE_CLIENT -q "ATTACH DICTIONARY IF NOT EXISTS database_for_dict.dict2"
|
2019-10-17 17:18:54 +00:00
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -n -q "
|
2021-11-02 12:58:45 +00:00
|
|
|
DROP DATABASE database_for_dict;
|
2019-10-17 17:18:54 +00:00
|
|
|
DROP TABLE table_for_dict1;
|
|
|
|
DROP TABLE table_for_dict2;
|
|
|
|
"
|