Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
01035a9e
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
01035a9e
编写于
8月 31, 2019
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:yandex/ClickHouse into add-test-deadlock-rename-table
上级
3568d3d8
ddbb1abb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
203 addition
and
6 deletion
+203
-6
dbms/src/Interpreters/InterpreterKillQueryQuery.cpp
dbms/src/Interpreters/InterpreterKillQueryQuery.cpp
+0
-5
dbms/src/Storages/LiveView/StorageLiveView.cpp
dbms/src/Storages/LiveView/StorageLiveView.cpp
+1
-1
dbms/tests/integration/test_dictionaries/configs/dictionaries/dictionary_preset_cache_xypairs.xml
.../configs/dictionaries/dictionary_preset_cache_xypairs.xml
+31
-0
dbms/tests/integration/test_dictionaries/test.py
dbms/tests/integration/test_dictionaries/test.py
+59
-0
dbms/tests/queries/0_stateless/01001_rename_merge_race_condition.reference
...s/0_stateless/01001_rename_merge_race_condition.reference
+0
-0
dbms/tests/queries/0_stateless/01001_rename_merge_race_condition.sh
.../queries/0_stateless/01001_rename_merge_race_condition.sh
+39
-0
dbms/tests/queries/0_stateless/01003_kill_query_race_condition.reference
...ies/0_stateless/01003_kill_query_race_condition.reference
+0
-0
dbms/tests/queries/0_stateless/01003_kill_query_race_condition.sh
...ts/queries/0_stateless/01003_kill_query_race_condition.sh
+50
-0
dbms/tests/stress
dbms/tests/stress
+23
-0
未找到文件。
dbms/src/Interpreters/InterpreterKillQueryQuery.cpp
浏览文件 @
01035a9e
...
...
@@ -265,11 +265,6 @@ Block InterpreterKillQueryQuery::getSelectResult(const String & columns, const S
if
(
where_expression
)
select_query
+=
" WHERE "
+
queryToString
(
where_expression
);
auto
use_processors
=
context
.
getSettingsRef
().
experimental_use_processors
;
context
.
getSettingsRef
().
experimental_use_processors
=
false
;
SCOPE_EXIT
(
context
.
getSettingsRef
().
experimental_use_processors
=
use_processors
);
BlockIO
block_io
=
executeQuery
(
select_query
,
context
,
true
);
Block
res
=
block_io
.
in
->
read
();
...
...
dbms/src/Storages/LiveView/StorageLiveView.cpp
浏览文件 @
01035a9e
...
...
@@ -593,7 +593,7 @@ void registerStorageLiveView(StorageFactory & factory)
{
factory
.
registerStorage
(
"LiveView"
,
[](
const
StorageFactory
::
Arguments
&
args
)
{
if
(
!
args
.
local_context
.
getSettingsRef
().
allow_experimental_live_view
)
if
(
!
args
.
attach
&&
!
args
.
local_context
.
getSettingsRef
().
allow_experimental_live_view
)
throw
Exception
(
"Experimental LIVE VIEW feature is not enabled (the setting 'allow_experimental_live_view')"
,
ErrorCodes
::
SUPPORT_IS_DISABLED
);
return
StorageLiveView
::
create
(
args
.
table_name
,
args
.
database_name
,
args
.
local_context
,
args
.
query
,
args
.
columns
);
...
...
dbms/tests/integration/test_dictionaries/configs/dictionaries/dictionary_preset_cache_xypairs.xml
0 → 100644
浏览文件 @
01035a9e
<yandex>
<dictionary>
<name>
cache_xypairs
</name>
<source>
<clickhouse>
<host>
localhost
</host>
<port>
9000
</port>
<user>
default
</user>
<password></password>
<db>
test
</db>
<table>
xypairs
</table>
</clickhouse>
</source>
<lifetime>
1
</lifetime>
<layout>
<cache>
<size_in_cells>
5
</size_in_cells>
</cache>
</layout>
<structure>
<id>
<name>
x
</name>
</id>
<attribute>
<name>
y
</name>
<type>
UInt64
</type>
<null_value>
0
</null_value>
</attribute>
</structure>
</dictionary>
</yandex>
dbms/tests/integration/test_dictionaries/test.py
浏览文件 @
01035a9e
...
...
@@ -17,6 +17,10 @@ def get_status(dictionary_name):
return
instance
.
query
(
"SELECT status FROM system.dictionaries WHERE name='"
+
dictionary_name
+
"'"
).
rstrip
(
"
\n
"
)
def
get_last_exception
(
dictionary_name
):
return
instance
.
query
(
"SELECT last_exception FROM system.dictionaries WHERE name='"
+
dictionary_name
+
"'"
).
rstrip
(
"
\n
"
).
replace
(
"
\\
'"
,
"'"
)
def
get_loading_start_time
(
dictionary_name
):
s
=
instance
.
query
(
"SELECT loading_start_time FROM system.dictionaries WHERE name='"
+
dictionary_name
+
"'"
).
rstrip
(
"
\n
"
)
if
s
==
"0000-00-00 00:00:00"
:
...
...
@@ -350,3 +354,58 @@ def test_reload_after_fail_by_timer(started_cluster):
time
.
sleep
(
6
);
query
(
"SELECT dictGetInt32('no_file_2', 'a', toUInt64(9))"
)
==
"10
\n
"
assert
get_status
(
"no_file_2"
)
==
"LOADED"
def
test_reload_after_fail_in_cache_dictionary
(
started_cluster
):
query
=
instance
.
query
query_and_get_error
=
instance
.
query_and_get_error
# Can't get a value from the cache dictionary because the source (table `test.xypairs`) doesn't respond.
expected_error
=
"Table test.xypairs doesn't exist"
assert
expected_error
in
query_and_get_error
(
"SELECT dictGetUInt64('cache_xypairs', 'y', toUInt64(1))"
)
assert
get_status
(
"cache_xypairs"
)
==
"LOADED"
assert
expected_error
in
get_last_exception
(
"cache_xypairs"
)
# Create table `test.xypairs`.
query
(
'''
drop table if exists test.xypairs;
create table test.xypairs (x UInt64, y UInt64) engine=Log;
insert into test.xypairs values (1, 56), (3, 78);
'''
)
# Cache dictionary now works.
assert_eq_with_retry
(
instance
,
"SELECT dictGet('cache_xypairs', 'y', toUInt64(1))"
,
"56"
,
ignore_error
=
True
)
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(2))"
)
==
"0"
assert
get_last_exception
(
"cache_xypairs"
)
==
""
# Drop table `test.xypairs`.
query
(
'drop table if exists test.xypairs'
)
# Values are cached so we can get them.
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(1))"
)
==
"56"
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(2))"
)
==
"0"
assert
get_last_exception
(
"cache_xypairs"
)
==
""
# But we can't get a value from the source table which isn't cached.
assert
expected_error
in
query_and_get_error
(
"SELECT dictGetUInt64('cache_xypairs', 'y', toUInt64(3))"
)
assert
expected_error
in
get_last_exception
(
"cache_xypairs"
)
# Passed time should not spoil the cache.
time
.
sleep
(
5
);
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(1))"
)
==
"56"
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(2))"
)
==
"0"
assert
expected_error
in
query_and_get_error
(
"SELECT dictGetUInt64('cache_xypairs', 'y', toUInt64(3))"
)
assert
expected_error
in
get_last_exception
(
"cache_xypairs"
)
# Create table `test.xypairs` again with changed values.
query
(
'''
drop table if exists test.xypairs;
create table test.xypairs (x UInt64, y UInt64) engine=Log;
insert into test.xypairs values (1, 57), (3, 79);
'''
)
# The cache dictionary returns new values now.
assert_eq_with_retry
(
instance
,
"SELECT dictGet('cache_xypairs', 'y', toUInt64(1))"
,
"57"
)
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(2))"
)
==
"0"
query
(
"SELECT dictGet('cache_xypairs', 'y', toUInt64(3))"
)
==
"79"
assert
get_last_exception
(
"cache_xypairs"
)
==
""
dbms/tests/queries/0_stateless/01001_rename_merge_race_condition.reference
0 → 100644
浏览文件 @
01035a9e
dbms/tests/queries/0_stateless/01001_rename_merge_race_condition.sh
0 → 100755
浏览文件 @
01035a9e
#!/usr/bin/env bash
CURDIR
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
.
$CURDIR
/../shell_config.sh
set
-e
$CLICKHOUSE_CLIENT
--query
"DROP TABLE IF EXISTS test1"
;
$CLICKHOUSE_CLIENT
--query
"DROP TABLE IF EXISTS test2"
;
$CLICKHOUSE_CLIENT
--query
"CREATE TABLE test1 (x UInt64) ENGINE = Memory"
;
function
thread1
()
{
while
true
;
do
seq
1 1000 |
sed
-r
-e
's/.+/RENAME TABLE test1 TO test2; RENAME TABLE test2 TO test1;/'
|
$CLICKHOUSE_CLIENT
-n
done
}
function
thread2
()
{
while
true
;
do
$CLICKHOUSE_CLIENT
--query
"SELECT * FROM merge(currentDatabase(), '^test[12]
$'
)"
done
}
# https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout
export
-f
thread1
;
export
-f
thread2
;
TIMEOUT
=
10
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread2 2> /dev/null &
wait
$CLICKHOUSE_CLIENT
--query
"DROP TABLE IF EXISTS test1"
;
$CLICKHOUSE_CLIENT
--query
"DROP TABLE IF EXISTS test2"
;
dbms/tests/queries/0_stateless/01003_kill_query_race_condition.reference
0 → 100644
浏览文件 @
01035a9e
dbms/tests/queries/0_stateless/01003_kill_query_race_condition.sh
0 → 100755
浏览文件 @
01035a9e
#!/usr/bin/env bash
CURDIR
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
.
$CURDIR
/../shell_config.sh
set
-e
function
thread1
()
{
while
true
;
do
$CLICKHOUSE_CLIENT
--query_id
=
hello
--query
"SELECT count() FROM numbers(1000000000)"
--format
Null
;
done
}
function
thread2
()
{
while
true
;
do
$CLICKHOUSE_CLIENT
--query
"KILL QUERY WHERE query_id = 'hello'"
--format
Null
;
sleep
0.
$RANDOM
done
}
function
thread3
()
{
while
true
;
do
$CLICKHOUSE_CLIENT
--query
"SHOW PROCESSLIST"
--format
Null
;
$CLICKHOUSE_CLIENT
--query
"SELECT * FROM system.processes"
--format
Null
;
done
}
# https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout
export
-f
thread1
;
export
-f
thread2
;
export
-f
thread3
;
TIMEOUT
=
10
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread2 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
wait
dbms/tests/stress
0 → 100755
浏览文件 @
01035a9e
#!/usr/bin/env bash
# https://stackoverflow.com/questions/360201/how-do-i-kill-background-processes-jobs-when-my-shell-script-exits
trap
'kill -9 $(jobs -p)'
EXIT
function
thread
()
{
while
true
;
do
./clickhouse-test
--order
random 2>&1 |
awk
'{ printf "'
$1
' " }'
done
}
# https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout
export
-f
thread
;
NUM_THREADS
=
${
1
:-
"16"
}
TIMEOUT
=
${
2
:-
"300"
}
for
i
in
$(
seq
1
$NUM_THREADS
)
;
do
timeout
$TIMEOUT
bash
-c
"thread
$i
"
2> /dev/null &
done
wait
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录