Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
4738094d
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,发现更多精彩内容 >>
提交
4738094d
编写于
6月 21, 2017
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed error when dynamically compiled .so file is broken [#METR-25550].
上级
8c9aa373
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
8 deletion
+37
-8
dbms/src/Core/ErrorCodes.cpp
dbms/src/Core/ErrorCodes.cpp
+1
-0
dbms/src/Interpreters/Compiler.cpp
dbms/src/Interpreters/Compiler.cpp
+28
-6
dbms/src/Interpreters/Compiler.h
dbms/src/Interpreters/Compiler.h
+8
-2
未找到文件。
dbms/src/Core/ErrorCodes.cpp
浏览文件 @
4738094d
...
...
@@ -377,6 +377,7 @@ namespace ErrorCodes
extern
const
int
SESSION_NOT_FOUND
=
372
;
extern
const
int
SESSION_IS_LOCKED
=
373
;
extern
const
int
INVALID_SESSION_TIMEOUT
=
374
;
extern
const
int
CANNOT_DLOPEN
=
375
;
extern
const
int
KEEPER_EXCEPTION
=
999
;
extern
const
int
POCO_EXCEPTION
=
1000
;
...
...
dbms/src/Interpreters/Compiler.cpp
浏览文件 @
4738094d
...
...
@@ -92,25 +92,47 @@ SharedLibraryPtr Compiler::getOrCount(
UInt32
count
=
++
counts
[
hashed_key
];
/// Is there a ready open library? Or, if the library is in the process of compiling, there will be nullptr.
Libraries
::
iterator
it
=
libraries
.
find
(
hashed_key
);
if
(
libraries
.
end
()
!=
it
)
Libraries
::
iterator
libraries_
it
=
libraries
.
find
(
hashed_key
);
if
(
libraries
.
end
()
!=
libraries_
it
)
{
if
(
!
it
->
second
)
if
(
!
libraries_
it
->
second
)
LOG_INFO
(
log
,
"Library "
<<
hashedKeyToFileName
(
hashed_key
)
<<
" is already compiling or compilation was failed."
);
/// TODO In this case, after the compilation is finished, the callback will not be called.
return
it
->
second
;
return
libraries_
it
->
second
;
}
/// Is there a file with the library left over from the previous launch?
std
::
string
file_name
=
hashedKeyToFileName
(
hashed_key
);
if
(
files
.
count
(
file_name
))
Files
::
iterator
files_it
=
files
.
find
(
file_name
);
if
(
files
.
end
()
!=
files_it
)
{
std
::
string
so_file_path
=
path
+
'/'
+
file_name
+
".so"
;
LOG_INFO
(
log
,
"Loading existing library "
<<
so_file_path
);
SharedLibraryPtr
lib
(
new
SharedLibrary
(
so_file_path
));
SharedLibraryPtr
lib
;
try
{
lib
=
std
::
make_shared
<
SharedLibrary
>
(
so_file_path
);
}
catch
(
const
Exception
&
e
)
{
if
(
e
.
code
()
!=
ErrorCodes
::
CANNOT_DLOPEN
)
throw
;
/// Found broken .so file (or file cannot be dlopened by whatever reason).
/// This could happen when filesystem is corrupted after server restart.
/// We remove the file - it will be recompiled on next attempt.
tryLogCurrentException
(
log
);
files
.
erase
(
files_it
);
Poco
::
File
(
so_file_path
).
remove
();
return
nullptr
;
}
libraries
[
hashed_key
]
=
lib
;
return
lib
;
}
...
...
dbms/src/Interpreters/Compiler.h
浏览文件 @
4738094d
...
...
@@ -19,6 +19,12 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
CANNOT_DLOPEN
;
extern
const
int
CANNOT_DLSYM
;
}
/** Allows you to open a dynamic library and get a pointer to a function from it.
*/
...
...
@@ -29,7 +35,7 @@ public:
{
handle
=
dlopen
(
path
.
c_str
(),
RTLD_LAZY
);
if
(
!
handle
)
throw
Exception
(
std
::
string
(
"Cannot dlopen: "
)
+
dlerror
());
throw
Exception
(
std
::
string
(
"Cannot dlopen: "
)
+
dlerror
()
,
ErrorCodes
::
CANNOT_DLOPEN
);
}
~
SharedLibrary
()
...
...
@@ -46,7 +52,7 @@ public:
Func
res
=
reinterpret_cast
<
Func
>
(
dlsym
(
handle
,
name
.
c_str
()));
if
(
char
*
error
=
dlerror
())
throw
Exception
(
std
::
string
(
"Cannot dlsym: "
)
+
error
);
throw
Exception
(
std
::
string
(
"Cannot dlsym: "
)
+
error
,
ErrorCodes
::
CANNOT_DLSYM
);
return
res
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录