Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
09805b23
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,发现更多精彩内容 >>
提交
09805b23
编写于
12月 24, 2019
作者:
N
Nikita Mikhaylov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
exception ptr added
上级
2545f66f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
13 deletion
+25
-13
dbms/src/Dictionaries/CacheDictionary.cpp
dbms/src/Dictionaries/CacheDictionary.cpp
+12
-10
dbms/src/Dictionaries/CacheDictionary.h
dbms/src/Dictionaries/CacheDictionary.h
+1
-0
dbms/src/Dictionaries/CacheDictionary.inc.h
dbms/src/Dictionaries/CacheDictionary.inc.h
+12
-3
未找到文件。
dbms/src/Dictionaries/CacheDictionary.cpp
浏览文件 @
09805b23
...
...
@@ -385,10 +385,13 @@ void CacheDictionary::has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8>
throw
std
::
runtime_error
(
"Too many updates"
);
// waitForCurrentUpdateFinish();
while
(
!
update_unit_ptr
->
is_done
)
{
while
(
!
update_unit_ptr
->
is_done
&&
!
update_unit_ptr
->
current_exception
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
10
));
std
::
this_thread
::
yield
();
}
if
(
update_unit_ptr
->
current_exception
)
std
::
rethrow_exception
(
update_unit_ptr
->
current_exception
);
}
...
...
@@ -670,21 +673,20 @@ void registerDictionaryCache(DictionaryFactory & factory)
void
CacheDictionary
::
updateThreadFunction
()
{
try
while
(
!
finished
)
{
while
(
!
finished
)
UpdateUnitPtr
unit_ptr
;
update_queue
.
pop
(
unit_ptr
);
try
{
UpdateUnitPtr
unit_ptr
;
update_queue
.
pop
(
unit_ptr
);
update
(
unit_ptr
->
requested_ids
,
unit_ptr
->
on_cell_updated
,
unit_ptr
->
on_id_not_found
);
unit_ptr
->
is_done
=
true
;
last_update
.
fetch_add
(
1
);
}
}
catch
(...)
{
tryLogCurrentException
(
__PRETTY_FUNCTION__
);
catch
(...)
{
unit_ptr
->
current_exception
=
std
::
current_exception
();
}
}
}
...
...
dbms/src/Dictionaries/CacheDictionary.h
浏览文件 @
09805b23
...
...
@@ -310,6 +310,7 @@ private:
on_id_not_found
(
std
::
move
(
on_id_not_found_
))
{}
std
::
atomic
<
bool
>
is_done
{
false
};
std
::
exception_ptr
current_exception
{
nullptr
};
std
::
vector
<
Key
>
requested_ids
;
std
::
function
<
void
(
const
Key
,
const
size_t
)
>
on_cell_updated
;
std
::
function
<
void
(
const
Key
,
const
size_t
)
>
on_id_not_found
;
...
...
dbms/src/Dictionaries/CacheDictionary.inc.h
浏览文件 @
09805b23
...
...
@@ -114,10 +114,13 @@ void CacheDictionary::getItemsNumberImpl(
throw
std
::
runtime_error
(
"Too many updates"
);
// waitForCurrentUpdateFinish();
while
(
!
update_unit_ptr
->
is_done
)
{
while
(
!
update_unit_ptr
->
is_done
&&
!
update_unit_ptr
->
current_exception
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
10
));
std
::
this_thread
::
yield
();
}
if
(
update_unit_ptr
->
current_exception
)
std
::
rethrow_exception
(
update_unit_ptr
->
current_exception
);
}
template
<
typename
DefaultGetter
>
...
...
@@ -271,10 +274,13 @@ void CacheDictionary::getItemsString(
throw
std
::
runtime_error
(
"Too many updates"
);
// waitForCurrentUpdateFinish();
while
(
!
update_unit_ptr
->
is_done
)
{
while
(
!
update_unit_ptr
->
is_done
&&
!
update_unit_ptr
->
current_exception
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
10
));
std
::
this_thread
::
yield
();
}
if
(
update_unit_ptr
->
current_exception
)
std
::
rethrow_exception
(
update_unit_ptr
->
current_exception
);
}
}
...
...
@@ -304,10 +310,13 @@ void CacheDictionary::getItemsString(
throw
std
::
runtime_error
(
"Too many updates"
);
// waitForCurrentUpdateFinish();begin
while
(
!
update_unit_ptr
->
is_done
)
{
while
(
!
update_unit_ptr
->
is_done
&&
!
update_unit_ptr
->
current_exception
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
10
));
std
::
this_thread
::
yield
();
}
if
(
update_unit_ptr
->
current_exception
)
std
::
rethrow_exception
(
update_unit_ptr
->
current_exception
);
}
out
->
getChars
().
reserve
(
total_length
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录