2020-10-27 13:49:08 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-09-12 12:35:27 +00:00
|
|
|
# Tags: race, no-parallel
|
2020-10-27 13:49:08 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-10-27 13:49:08 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP DATABASE IF EXISTS database_for_dict"
|
|
|
|
$CLICKHOUSE_CLIENT --query "CREATE DATABASE database_for_dict"
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS database_for_dict.table_for_dict"
|
|
|
|
$CLICKHOUSE_CLIENT --query "CREATE TABLE database_for_dict.table_for_dict (key_column UInt64, second_column UInt64, third_column String) ENGINE = MergeTree() ORDER BY key_column"
|
|
|
|
$CLICKHOUSE_CLIENT --query "INSERT INTO database_for_dict.table_for_dict VALUES (100500, 10000000, 'Hello world')"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP DATABASE IF EXISTS ordinary_db"
|
|
|
|
$CLICKHOUSE_CLIENT --query "CREATE DATABASE ordinary_db"
|
2020-12-18 13:26:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "CREATE DICTIONARY ordinary_db.dict1 ( key_column UInt64 DEFAULT 0, second_column UInt64 DEFAULT 1, third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()) SETTINGS(max_result_bytes=1)"
|
2020-10-27 13:49:08 +00:00
|
|
|
|
|
|
|
function dict_get_thread()
|
|
|
|
{
|
2022-02-26 19:09:34 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "SELECT dictGetString('ordinary_db.dict1', 'third_column', toUInt64(rand() % 1000)) from numbers(2)" &>/dev/null
|
2020-10-27 13:49:08 +00:00
|
|
|
}
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
export -f dict_get_thread
|
2020-10-27 13:49:08 +00:00
|
|
|
|
|
|
|
TIMEOUT=10
|
|
|
|
|
2022-02-26 19:09:34 +00:00
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
|
|
|
clickhouse_client_loop_timeout $TIMEOUT dict_get_thread 2> /dev/null &
|
2020-10-27 13:49:08 +00:00
|
|
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP DATABASE IF EXISTS ordinary_db"
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP DATABASE IF EXISTS database_for_dict"
|