Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
203e36c2
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,发现更多精彩内容 >>
未验证
提交
203e36c2
编写于
3月 28, 2019
作者:
A
alexey-milovidov
提交者:
GitHub
3月 28, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4824 from proller/fix26
CLICKHOUSE-4386 Version in exceptions
上级
7412bdb4
23d691a4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
30 deletion
+30
-30
dbms/src/Common/Exception.cpp
dbms/src/Common/Exception.cpp
+11
-10
dbms/tests/queries/0_stateless/00834_kill_mutation.sh
dbms/tests/queries/0_stateless/00834_kill_mutation.sh
+3
-2
dbms/tests/queries/0_stateless/00834_kill_mutation_replicated_zookeeper.sh
...s/0_stateless/00834_kill_mutation_replicated_zookeeper.sh
+2
-2
libs/libdaemon/src/BaseDaemon.cpp
libs/libdaemon/src/BaseDaemon.cpp
+14
-16
未找到文件。
dbms/src/Common/Exception.cpp
浏览文件 @
203e36c2
#include "Exception.h"
#include <string.h>
#include <string.h>
#include <cxxabi.h>
#include <cxxabi.h>
#include <Poco/String.h>
#include <Poco/String.h>
#include <common/logger_useful.h>
#include <common/logger_useful.h>
#include <IO/WriteHelpers.h>
#include <IO/WriteHelpers.h>
#include <IO/Operators.h>
#include <IO/Operators.h>
#include <IO/ReadBufferFromString.h>
#include <IO/ReadBufferFromString.h>
#include <Common/Exception.h>
#include <common/demangle.h>
#include <common/demangle.h>
#include <Common/config_version.h>
namespace
DB
namespace
DB
{
{
...
@@ -24,6 +21,10 @@ namespace ErrorCodes
...
@@ -24,6 +21,10 @@ namespace ErrorCodes
extern
const
int
CANNOT_TRUNCATE_FILE
;
extern
const
int
CANNOT_TRUNCATE_FILE
;
}
}
const
char
*
getVersion
()
{
return
VERSION_STRING
;
}
std
::
string
errnoToString
(
int
code
,
int
e
)
std
::
string
errnoToString
(
int
code
,
int
e
)
{
{
...
@@ -81,13 +82,13 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
...
@@ -81,13 +82,13 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
}
}
catch
(
const
Exception
&
e
)
catch
(
const
Exception
&
e
)
{
{
stream
<<
getExceptionMessage
(
e
,
with_stacktrace
,
check_embedded_stacktrace
);
stream
<<
"(version "
<<
getVersion
()
<<
") "
<<
getExceptionMessage
(
e
,
with_stacktrace
,
check_embedded_stacktrace
);
}
}
catch
(
const
Poco
::
Exception
&
e
)
catch
(
const
Poco
::
Exception
&
e
)
{
{
try
try
{
{
stream
<<
"Poco::Exception. Code: "
<<
ErrorCodes
::
POCO_EXCEPTION
<<
", e.code() = "
<<
e
.
code
()
stream
<<
"
(version "
<<
getVersion
()
<<
") "
<<
"
Poco::Exception. Code: "
<<
ErrorCodes
::
POCO_EXCEPTION
<<
", e.code() = "
<<
e
.
code
()
<<
", e.displayText() = "
<<
e
.
displayText
();
<<
", e.displayText() = "
<<
e
.
displayText
();
}
}
catch
(...)
{}
catch
(...)
{}
...
@@ -102,7 +103,7 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
...
@@ -102,7 +103,7 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
if
(
status
)
if
(
status
)
name
+=
" (demangling status: "
+
toString
(
status
)
+
")"
;
name
+=
" (demangling status: "
+
toString
(
status
)
+
")"
;
stream
<<
"std::exception. Code: "
<<
ErrorCodes
::
STD_EXCEPTION
<<
", type: "
<<
name
<<
", e.what() = "
<<
e
.
what
();
stream
<<
"
(version "
<<
getVersion
()
<<
") "
<<
"
std::exception. Code: "
<<
ErrorCodes
::
STD_EXCEPTION
<<
", type: "
<<
name
<<
", e.what() = "
<<
e
.
what
();
}
}
catch
(...)
{}
catch
(...)
{}
}
}
...
@@ -116,7 +117,7 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
...
@@ -116,7 +117,7 @@ std::string getCurrentExceptionMessage(bool with_stacktrace, bool check_embedded
if
(
status
)
if
(
status
)
name
+=
" (demangling status: "
+
toString
(
status
)
+
")"
;
name
+=
" (demangling status: "
+
toString
(
status
)
+
")"
;
stream
<<
"Unknown exception. Code: "
<<
ErrorCodes
::
UNKNOWN_EXCEPTION
<<
", type: "
<<
name
;
stream
<<
"
(version "
<<
getVersion
()
<<
") "
<<
"
Unknown exception. Code: "
<<
ErrorCodes
::
UNKNOWN_EXCEPTION
<<
", type: "
<<
name
;
}
}
catch
(...)
{}
catch
(...)
{}
}
}
...
...
dbms/tests/queries/0_stateless/00834_kill_mutation.sh
浏览文件 @
203e36c2
...
@@ -17,7 +17,8 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill a single invalid mutat
...
@@ -17,7 +17,8 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill a single invalid mutat
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1"
sleep
0.1
sleep
0.1
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_1_1_0', '20010101_2_2_0'), latest_fail_time != 0, substr(latest_fail_reason, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation'"
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_1_1_0', '20010101_2_2_0'), latest_fail_time != 0, substr(replaceRegexpOne(latest_fail_reason, '.version [0-9.]+. ', ''), 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation'"
...
@@ -29,7 +30,7 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill invalid mutation that
...
@@ -29,7 +30,7 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill invalid mutation that
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE x = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation DELETE WHERE x = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_1_1_0', '20010101_2_2_0'), latest_fail_time != 0, substr(
latest_fail_reason
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'"
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_1_1_0', '20010101_2_2_0'), latest_fail_time != 0, substr(
replaceRegexpOne(latest_fail_reason, '.version [0-9.]+. ', '')
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'"
sleep
0.1
sleep
0.1
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'"
...
...
dbms/tests/queries/0_stateless/00834_kill_mutation_replicated_zookeeper.sh
浏览文件 @
203e36c2
...
@@ -20,7 +20,7 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill a single invalid mutat
...
@@ -20,7 +20,7 @@ ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill a single invalid mutat
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation_r1 DELETE WHERE toUInt32(s) = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation_r1 DELETE WHERE toUInt32(s) = 1"
sleep
1
sleep
1
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_0_0_0', '20010101_0_0_0'), latest_fail_time != 0, substr(
latest_fail_reason
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation_r1'"
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_0_0_0', '20010101_0_0_0'), latest_fail_time != 0, substr(
replaceRegexpOne(latest_fail_reason, '.version [0-9.]+. ', '')
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation_r1'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation_r1'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation_r1'"
...
@@ -34,7 +34,7 @@ ${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation_r1 DELETE WHERE toU
...
@@ -34,7 +34,7 @@ ${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation_r1 DELETE WHERE toU
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation_r1 DELETE WHERE x = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.kill_mutation_r1 DELETE WHERE x = 1"
sleep
1
sleep
1
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_0_0_0_1', '20010101_0_0_0_1'), latest_fail_time != 0, substr(
latest_fail_reason
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation_r1' AND mutation_id = '0000000001'"
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, latest_failed_part IN ('20000101_0_0_0_1', '20010101_0_0_0_1'), latest_fail_time != 0, substr(
replaceRegexpOne(latest_fail_reason, '.version [0-9.]+. ', '')
, 1, 8) FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation_r1' AND mutation_id = '0000000001'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation_r1' AND mutation_id = '0000000001'"
${
CLICKHOUSE_CLIENT
}
--query
=
"KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation_r1' AND mutation_id = '0000000001'"
...
...
libs/libdaemon/src/BaseDaemon.cpp
浏览文件 @
203e36c2
#include <daemon/BaseDaemon.h>
#include <daemon/BaseDaemon.h>
#include <daemon/OwnFormattingChannel.h>
#include <daemon/OwnFormattingChannel.h>
#include <daemon/OwnPatternFormatter.h>
#include <daemon/OwnPatternFormatter.h>
#include <Common/Config/ConfigProcessor.h>
#include <Common/Config/ConfigProcessor.h>
#include <daemon/OwnSplitChannel.h>
#include <daemon/OwnSplitChannel.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/time.h>
...
@@ -15,18 +13,6 @@
...
@@ -15,18 +13,6 @@
#include <cxxabi.h>
#include <cxxabi.h>
#include <execinfo.h>
#include <execinfo.h>
#include <unistd.h>
#include <unistd.h>
#if USE_UNWIND
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#endif
#ifdef __APPLE__
// ucontext is not available without _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#include <ucontext.h>
#include <typeinfo>
#include <typeinfo>
#include <common/logger_useful.h>
#include <common/logger_useful.h>
#include <common/ErrorHandlers.h>
#include <common/ErrorHandlers.h>
...
@@ -68,6 +54,18 @@
...
@@ -68,6 +54,18 @@
#include <Common/CurrentThread.h>
#include <Common/CurrentThread.h>
#include <Poco/Net/RemoteSyslogChannel.h>
#include <Poco/Net/RemoteSyslogChannel.h>
#if USE_UNWIND
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#endif
#ifdef __APPLE__
// ucontext is not available without _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#include <ucontext.h>
/** For transferring information from signal handler to a separate thread.
/** For transferring information from signal handler to a separate thread.
* If you need to do something serious in case of a signal (example: write a message to the log),
* If you need to do something serious in case of a signal (example: write a message to the log),
* then sending information to a separate thread through pipe and doing all the stuff asynchronously
* then sending information to a separate thread through pipe and doing all the stuff asynchronously
...
@@ -301,13 +299,13 @@ private:
...
@@ -301,13 +299,13 @@ private:
private:
private:
void
onTerminate
(
const
std
::
string
&
message
,
ThreadNumber
thread_num
)
const
void
onTerminate
(
const
std
::
string
&
message
,
ThreadNumber
thread_num
)
const
{
{
LOG_ERROR
(
log
,
"(from thread "
<<
thread_num
<<
") "
<<
message
);
LOG_ERROR
(
log
,
"(
version "
<<
VERSION_STRING
<<
") (
from thread "
<<
thread_num
<<
") "
<<
message
);
}
}
void
onFault
(
int
sig
,
siginfo_t
&
info
,
ucontext_t
&
context
,
ThreadNumber
thread_num
)
const
void
onFault
(
int
sig
,
siginfo_t
&
info
,
ucontext_t
&
context
,
ThreadNumber
thread_num
)
const
{
{
LOG_ERROR
(
log
,
"########################################"
);
LOG_ERROR
(
log
,
"########################################"
);
LOG_ERROR
(
log
,
"(from thread "
<<
thread_num
<<
") "
LOG_ERROR
(
log
,
"(
version "
<<
VERSION_STRING
<<
") (
from thread "
<<
thread_num
<<
") "
<<
"Received signal "
<<
strsignal
(
sig
)
<<
" ("
<<
sig
<<
")"
<<
"."
);
<<
"Received signal "
<<
strsignal
(
sig
)
<<
" ("
<<
sig
<<
")"
<<
"."
);
void
*
caller_address
=
nullptr
;
void
*
caller_address
=
nullptr
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录