Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
6b77a4e1
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6b77a4e1
编写于
11月 18, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into release/v1.6.4.0
上级
8527587b
dbb888c1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
138 addition
and
2 deletion
+138
-2
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+2
-0
src/os/linux/inc/os.h
src/os/linux/inc/os.h
+3
-0
src/os/linux/src/tsystem.c
src/os/linux/src/tsystem.c
+128
-1
src/system/detail/src/dnodeSystem.c
src/system/detail/src/dnodeSystem.c
+2
-0
src/util/src/ttimer.c
src/util/src/ttimer.c
+3
-1
未找到文件。
src/client/src/tscSystem.c
浏览文件 @
6b77a4e1
...
...
@@ -83,6 +83,8 @@ void taos_init_imp() {
tscTrace
(
"Local IP address is:%s"
,
tsLocalIp
);
}
taosSetCoreDump
();
#ifdef CLUSTER
tscMgmtIpList
.
numOfIps
=
2
;
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
tsMasterIp
);
...
...
src/os/linux/inc/os.h
浏览文件 @
6b77a4e1
...
...
@@ -222,6 +222,9 @@ bool taosSkipSocketCheck();
int64_t
str2int64
(
char
*
str
);
void
taosSetCoreDump
();
#define BUILDIN_CLZL(val) __builtin_clzl(val)
#define BUILDIN_CLZ(val) __builtin_clz(val)
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
...
...
src/os/linux/src/tsystem.c
浏览文件 @
6b77a4e1
...
...
@@ -25,6 +25,14 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
#include <sys/syscall.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/sysctl.h>
#include "tglobalcfg.h"
#include "tlog.h"
...
...
@@ -576,4 +584,123 @@ void taosKillSystem() {
// SIGINT
pPrint
(
"taosd will shut down soon"
);
kill
(
tsProcId
,
2
);
}
\ No newline at end of file
}
int
_sysctl
(
struct
__sysctl_args
*
args
);
void
taosSetCoreDump
()
{
// 1. set ulimit -c unlimited
struct
rlimit
rlim
;
struct
rlimit
rlim_new
;
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
pPrint
(
"the old unlimited para: rlim_cur=%d, rlim_max=%d"
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
rlim_new
.
rlim_cur
=
RLIM_INFINITY
;
rlim_new
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
)
!=
0
)
{
pPrint
(
"set unlimited fail, error: %s"
,
strerror
(
errno
));
rlim_new
.
rlim_cur
=
rlim
.
rlim_max
;
rlim_new
.
rlim_max
=
rlim
.
rlim_max
;
(
void
)
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
);
}
}
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
pPrint
(
"the new unlimited para: rlim_cur=%d, rlim_max=%d"
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
}
// 2. set the path for saving core file
struct
__sysctl_args
args
;
int
old_usespid
=
0
;
size_t
old_len
=
0
;
int
new_usespid
=
1
;
size_t
new_len
=
sizeof
(
new_usespid
);
int
name
[]
=
{
CTL_KERN
,
KERN_CORE_USES_PID
};
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
args
.
newval
=
&
new_usespid
;
args
.
newlen
=
new_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
pPrint
(
"_sysctl(kern_core_uses_pid) set fail: %s"
,
strerror
(
errno
));
}
pPrint
(
"The old core_uses_pid[%d]: %d"
,
old_len
,
old_usespid
);
old_usespid
=
0
;
old_len
=
0
;
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
pPrint
(
"_sysctl(kern_core_uses_pid) get fail: %s"
,
strerror
(
errno
));
}
pPrint
(
"The new core_uses_pid[%d]: %d"
,
old_len
,
old_usespid
);
#if 0
// 3. set the path for saving core file
int status;
char coredump_dir[32] = "/var/log/taosdump";
if (opendir(coredump_dir) == NULL) {
status = mkdir(coredump_dir, S_IRWXU | S_IRWXG | S_IRWXO);
if (status) {
pPrint("mkdir fail, error: %s\n", strerror(errno));
}
}
// 4. set kernel.core_pattern
struct __sysctl_args args;
char old_corefile[128];
size_t old_len;
char new_corefile[128] = "/var/log/taosdump/core-%e-%p";
size_t new_len = sizeof(new_corefile);
int name[] = {CTL_KERN, KERN_CORE_PATTERN};
memset(&args, 0, sizeof(struct __sysctl_args));
args.name = name;
args.nlen = sizeof(name)/sizeof(name[0]);
args.oldval = old_corefile;
args.oldlenp = &old_len;
args.newval = new_corefile;
args.newlen = new_len;
old_len = sizeof(old_corefile);
if (syscall(SYS__sysctl, &args) == -1) {
pPrint("_sysctl(kern_core_pattern) set fail: %s", strerror(errno));
}
pPrint("The old kern_core_pattern: %*s\n", old_len, old_corefile);
memset(&args, 0, sizeof(struct __sysctl_args));
args.name = name;
args.nlen = sizeof(name)/sizeof(name[0]);
args.oldval = old_corefile;
args.oldlenp = &old_len;
old_len = sizeof(old_corefile);
if (syscall(SYS__sysctl, &args) == -1) {
pPrint("_sysctl(kern_core_pattern) get fail: %s", strerror(errno));
}
pPrint("The new kern_core_pattern: %*s\n", old_len, old_corefile);
#endif
}
src/system/detail/src/dnodeSystem.c
浏览文件 @
6b77a4e1
...
...
@@ -139,6 +139,8 @@ int dnodeInitSystem() {
tsPrintGlobalConfig
();
dPrint
(
"Server IP address is:%s"
,
tsInternalIp
);
taosSetCoreDump
();
signal
(
SIGPIPE
,
SIG_IGN
);
dnodeInitModules
();
...
...
src/util/src/ttimer.c
浏览文件 @
6b77a4e1
...
...
@@ -549,7 +549,9 @@ void* taosTmrInit(int maxNumOfTmrs, int resolution, int longest, const char* lab
void
taosTmrCleanUp
(
void
*
handle
)
{
tmr_ctrl_t
*
ctrl
=
(
tmr_ctrl_t
*
)
handle
;
assert
(
ctrl
!=
NULL
&&
ctrl
->
label
[
0
]
!=
0
);
if
(
ctrl
==
NULL
||
ctrl
->
label
[
0
]
==
0
)
{
return
;
}
tmrTrace
(
"%s timer controller is cleaned up."
,
ctrl
->
label
);
ctrl
->
label
[
0
]
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录