Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
2f7e599a
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
2f7e599a
编写于
12月 04, 2020
作者:
V
Vitaly Baranov
提交者:
GitHub
12月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17695 from vitlibar/fix-test_rabbitmq_csv_with_delimiter-20.12
Backport to 20.12: Fix test_rabbitmq_csv_with_delimiter
上级
7b2691bf
bfe02b23
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
27 deletion
+30
-27
src/Storages/RabbitMQ/RabbitMQBlockInputStream.cpp
src/Storages/RabbitMQ/RabbitMQBlockInputStream.cpp
+3
-3
src/Storages/RabbitMQ/RabbitMQBlockInputStream.h
src/Storages/RabbitMQ/RabbitMQBlockInputStream.h
+2
-2
src/Storages/RabbitMQ/StorageRabbitMQ.cpp
src/Storages/RabbitMQ/StorageRabbitMQ.cpp
+14
-11
src/Storages/RabbitMQ/StorageRabbitMQ.h
src/Storages/RabbitMQ/StorageRabbitMQ.h
+2
-2
tests/integration/test_storage_rabbitmq/test.py
tests/integration/test_storage_rabbitmq/test.py
+9
-9
未找到文件。
src/Storages/RabbitMQ/RabbitMQBlockInputStream.cpp
浏览文件 @
2f7e599a
...
...
@@ -16,7 +16,7 @@ namespace DB
RabbitMQBlockInputStream
::
RabbitMQBlockInputStream
(
StorageRabbitMQ
&
storage_
,
const
StorageMetadataPtr
&
metadata_snapshot_
,
const
Context
&
context_
,
std
::
shared_ptr
<
Context
>
context_
,
const
Names
&
columns
,
size_t
max_block_size_
,
bool
ack_in_suffix_
)
...
...
@@ -54,7 +54,7 @@ Block RabbitMQBlockInputStream::getHeader() const
void
RabbitMQBlockInputStream
::
readPrefixImpl
()
{
auto
timeout
=
std
::
chrono
::
milliseconds
(
context
.
getSettingsRef
().
rabbitmq_max_wait_ms
.
totalMilliseconds
());
auto
timeout
=
std
::
chrono
::
milliseconds
(
context
->
getSettingsRef
().
rabbitmq_max_wait_ms
.
totalMilliseconds
());
buffer
=
storage
.
popReadBuffer
(
timeout
);
}
...
...
@@ -96,7 +96,7 @@ Block RabbitMQBlockInputStream::readImpl()
MutableColumns
virtual_columns
=
virtual_header
.
cloneEmptyColumns
();
auto
input_format
=
FormatFactory
::
instance
().
getInputFormat
(
storage
.
getFormatName
(),
*
buffer
,
non_virtual_header
,
context
,
max_block_size
);
storage
.
getFormatName
(),
*
buffer
,
non_virtual_header
,
*
context
,
max_block_size
);
InputPort
port
(
input_format
->
getPort
().
getHeader
(),
input_format
.
get
());
connect
(
input_format
->
getPort
(),
port
);
...
...
src/Storages/RabbitMQ/RabbitMQBlockInputStream.h
浏览文件 @
2f7e599a
...
...
@@ -15,7 +15,7 @@ public:
RabbitMQBlockInputStream
(
StorageRabbitMQ
&
storage_
,
const
StorageMetadataPtr
&
metadata_snapshot_
,
const
Context
&
context_
,
std
::
shared_ptr
<
Context
>
context_
,
const
Names
&
columns
,
size_t
max_block_size_
,
bool
ack_in_suffix
=
true
);
...
...
@@ -37,7 +37,7 @@ public:
private:
StorageRabbitMQ
&
storage
;
StorageMetadataPtr
metadata_snapshot
;
const
Context
&
context
;
std
::
shared_ptr
<
Context
>
context
;
Names
column_names
;
const
size_t
max_block_size
;
bool
ack_in_suffix
;
...
...
src/Storages/RabbitMQ/StorageRabbitMQ.cpp
浏览文件 @
2f7e599a
...
...
@@ -74,7 +74,6 @@ StorageRabbitMQ::StorageRabbitMQ(
std
::
unique_ptr
<
RabbitMQSettings
>
rabbitmq_settings_
)
:
IStorage
(
table_id_
)
,
global_context
(
context_
.
getGlobalContext
())
,
rabbitmq_context
(
Context
(
global_context
))
,
rabbitmq_settings
(
std
::
move
(
rabbitmq_settings_
))
,
exchange_name
(
global_context
.
getMacros
()
->
expand
(
rabbitmq_settings
->
rabbitmq_exchange_name
.
value
))
,
format_name
(
global_context
.
getMacros
()
->
expand
(
rabbitmq_settings
->
rabbitmq_format
.
value
))
...
...
@@ -114,8 +113,8 @@ StorageRabbitMQ::StorageRabbitMQ(
storage_metadata
.
setColumns
(
columns_
);
setInMemoryMetadata
(
storage_metadata
);
rabbitmq_context
.
makeQueryContext
(
);
rabbitmq_context
=
addSettings
(
rabbitmq_context
);
rabbitmq_context
=
addSettings
(
global_context
);
rabbitmq_context
->
makeQueryContext
(
);
/// One looping task for all consumers as they share the same connection == the same handler == the same event loop
event_handler
->
updateLoopState
(
Loop
::
STOP
);
...
...
@@ -193,16 +192,17 @@ String StorageRabbitMQ::getTableBasedName(String name, const StorageID & table_i
}
Context
StorageRabbitMQ
::
addSettings
(
Context
context
)
const
std
::
shared_ptr
<
Context
>
StorageRabbitMQ
::
addSettings
(
const
Context
&
context
)
const
{
context
.
setSetting
(
"input_format_skip_unknown_fields"
,
true
);
context
.
setSetting
(
"input_format_allow_errors_ratio"
,
0.
);
context
.
setSetting
(
"input_format_allow_errors_num"
,
rabbitmq_settings
->
rabbitmq_skip_broken_messages
.
value
);
auto
modified_context
=
std
::
make_shared
<
Context
>
(
context
);
modified_context
->
setSetting
(
"input_format_skip_unknown_fields"
,
true
);
modified_context
->
setSetting
(
"input_format_allow_errors_ratio"
,
0.
);
modified_context
->
setSetting
(
"input_format_allow_errors_num"
,
rabbitmq_settings
->
rabbitmq_skip_broken_messages
.
value
);
if
(
!
schema_name
.
empty
())
context
.
setSetting
(
"format_schema"
,
schema_name
);
modified_context
->
setSetting
(
"format_schema"
,
schema_name
);
return
context
;
return
modified_
context
;
}
...
...
@@ -538,6 +538,7 @@ Pipe StorageRabbitMQ::read(
auto
sample_block
=
metadata_snapshot
->
getSampleBlockForColumns
(
column_names
,
getVirtuals
(),
getStorageID
());
auto
modified_context
=
addSettings
(
context
);
auto
block_size
=
getMaxBlockSize
();
bool
update_channels
=
false
;
...
...
@@ -581,7 +582,9 @@ Pipe StorageRabbitMQ::read(
looping_task
->
activateAndSchedule
();
LOG_DEBUG
(
log
,
"Starting reading {} streams"
,
pipes
.
size
());
return
Pipe
::
unitePipes
(
std
::
move
(
pipes
));
auto
united_pipe
=
Pipe
::
unitePipes
(
std
::
move
(
pipes
));
united_pipe
.
addInterpreterContext
(
modified_context
);
return
united_pipe
;
}
...
...
@@ -785,7 +788,7 @@ bool StorageRabbitMQ::streamToViews()
insert
->
table_id
=
table_id
;
// Only insert into dependent views and expect that input blocks contain virtual columns
InterpreterInsertQuery
interpreter
(
insert
,
rabbitmq_context
,
false
,
true
,
true
);
InterpreterInsertQuery
interpreter
(
insert
,
*
rabbitmq_context
,
false
,
true
,
true
);
auto
block_io
=
interpreter
.
execute
();
auto
metadata_snapshot
=
getInMemoryMetadataPtr
();
...
...
src/Storages/RabbitMQ/StorageRabbitMQ.h
浏览文件 @
2f7e599a
...
...
@@ -73,7 +73,7 @@ protected:
private:
const
Context
&
global_context
;
Context
rabbitmq_context
;
std
::
shared_ptr
<
Context
>
rabbitmq_context
;
std
::
unique_ptr
<
RabbitMQSettings
>
rabbitmq_settings
;
const
String
exchange_name
;
...
...
@@ -135,7 +135,7 @@ private:
static
AMQP
::
ExchangeType
defineExchangeType
(
String
exchange_type_
);
static
String
getTableBasedName
(
String
name
,
const
StorageID
&
table_id
);
Context
addSettings
(
Context
context
)
const
;
std
::
shared_ptr
<
Context
>
addSettings
(
const
Context
&
context
)
const
;
size_t
getMaxBlockSize
()
const
;
void
deactivateTask
(
BackgroundSchedulePool
::
TaskHolder
&
task
,
bool
wait
,
bool
stop_loop
);
...
...
tests/integration/test_storage_rabbitmq/test.py
浏览文件 @
2f7e599a
...
...
@@ -123,7 +123,7 @@ def rabbitmq_setup_teardown():
# Tests
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_select
(
rabbitmq_cluster
):
instance
.
query
(
'''
CREATE TABLE test.rabbitmq (key UInt64, value UInt64)
...
...
@@ -159,7 +159,7 @@ def test_rabbitmq_select(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_select_empty
(
rabbitmq_cluster
):
instance
.
query
(
'''
CREATE TABLE test.rabbitmq (key UInt64, value UInt64)
...
...
@@ -173,7 +173,7 @@ def test_rabbitmq_select_empty(rabbitmq_cluster):
assert
int
(
instance
.
query
(
'SELECT count() FROM test.rabbitmq'
))
==
0
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_json_without_delimiter
(
rabbitmq_cluster
):
instance
.
query
(
'''
CREATE TABLE test.rabbitmq (key UInt64, value UInt64)
...
...
@@ -215,7 +215,7 @@ def test_rabbitmq_json_without_delimiter(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_csv_with_delimiter
(
rabbitmq_cluster
):
instance
.
query
(
'''
CREATE TABLE test.rabbitmq (key UInt64, value UInt64)
...
...
@@ -250,7 +250,7 @@ def test_rabbitmq_csv_with_delimiter(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_tsv_with_delimiter
(
rabbitmq_cluster
):
instance
.
query
(
'''
CREATE TABLE test.rabbitmq (key UInt64, value UInt64)
...
...
@@ -285,7 +285,7 @@ def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_materialized_view
(
rabbitmq_cluster
):
instance
.
query
(
'''
DROP TABLE IF EXISTS test.view;
...
...
@@ -328,7 +328,7 @@ def test_rabbitmq_materialized_view(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_materialized_view_with_subquery
(
rabbitmq_cluster
):
instance
.
query
(
'''
DROP TABLE IF EXISTS test.view;
...
...
@@ -371,7 +371,7 @@ def test_rabbitmq_materialized_view_with_subquery(rabbitmq_cluster):
rabbitmq_check_result
(
result
,
True
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_many_materialized_views
(
rabbitmq_cluster
):
instance
.
query
(
'''
DROP TABLE IF EXISTS test.view1;
...
...
@@ -426,7 +426,7 @@ def test_rabbitmq_many_materialized_views(rabbitmq_cluster):
@
pytest
.
mark
.
skip
(
reason
=
"clichouse_path with rabbitmq.proto fails to be exported"
)
@
pytest
.
mark
.
timeout
(
18
0
)
@
pytest
.
mark
.
timeout
(
24
0
)
def
test_rabbitmq_protobuf
(
rabbitmq_cluster
):
instance
.
query
(
'''
DROP TABLE IF EXISTS test.view;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录