Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
5d5137ad
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5d5137ad
编写于
8月 11, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
8月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2984 from taosdata/hotfix/test
Hotfix/test
上级
916c8246
f1e19aae
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
329 addition
and
7 deletion
+329
-7
packaging/tools/install_client.sh
packaging/tools/install_client.sh
+7
-3
packaging/tools/remove.sh
packaging/tools/remove.sh
+4
-2
packaging/tools/remove_client.sh
packaging/tools/remove_client.sh
+4
-2
src/dnode/inc/dnodeCheck.h
src/dnode/inc/dnodeCheck.h
+30
-0
src/dnode/src/dnodeCheck.c
src/dnode/src/dnodeCheck.c
+269
-0
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+2
-0
src/inc/taosdef.h
src/inc/taosdef.h
+13
-0
未找到文件。
packaging/tools/install_client.sh
浏览文件 @
5d5137ad
...
...
@@ -31,6 +31,7 @@ cfg_install_dir="/etc/taos"
if
[
"
$osType
"
!=
"Darwin"
]
;
then
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
inc_link_dir
=
"/usr/include"
else
bin_link_dir
=
"/usr/local/bin"
...
...
@@ -45,7 +46,7 @@ install_main_dir="/usr/local/taos"
bin_dir
=
"/usr/local/taos/bin"
# v1.5 jar dir
v15_java_app_dir
=
"/usr/local/lib/taos"
#
v15_java_app_dir="/usr/local/lib/taos"
# Color setting
RED
=
'\033[0;31m'
...
...
@@ -106,13 +107,16 @@ function clean_lib() {
function
install_lib
()
{
# Remove links
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-rf
${
v15_java_app_dir
}
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos.
*
||
:
#${csudo} rm -rf ${v15_java_app_dir} || :
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
if
[
"
$osType
"
!=
"Darwin"
]
;
then
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib64_link_dir
}
/libtaos.so.1
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtaos.so.1
${
lib64_link_dir
}
/libtaos.so
||
:
else
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.1.dylib
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.1.dylib
${
lib_link_dir
}
/libtaos.dylib
...
...
packaging/tools/remove.sh
浏览文件 @
5d5137ad
...
...
@@ -18,11 +18,12 @@ log_link_dir="/usr/local/taos/log"
cfg_link_dir
=
"/usr/local/taos/cfg"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
inc_link_dir
=
"/usr/include"
install_nginxd_dir
=
"/usr/local/nginxd"
# v1.5 jar dir
v15_java_app_dir
=
"/usr/local/lib/taos"
#
v15_java_app_dir="/usr/local/lib/taos"
service_config_dir
=
"/etc/systemd/system"
taos_service_name
=
"taosd"
...
...
@@ -78,7 +79,8 @@ function clean_bin() {
function
clean_lib
()
{
# Remove link
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-rf
${
v15_java_app_dir
}
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos.
*
||
:
#${csudo} rm -rf ${v15_java_app_dir} || :
}
function
clean_header
()
{
...
...
packaging/tools/remove_client.sh
浏览文件 @
5d5137ad
...
...
@@ -15,11 +15,12 @@ log_link_dir="/usr/local/taos/log"
cfg_link_dir
=
"/usr/local/taos/cfg"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
inc_link_dir
=
"/usr/include"
# v1.5 jar dir
v15_java_app_dir
=
"/usr/local/lib/taos"
#
v15_java_app_dir="/usr/local/lib/taos"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
...
...
@@ -43,7 +44,8 @@ function clean_bin() {
function
clean_lib
()
{
# Remove link
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-rf
${
v15_java_app_dir
}
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos.
*
||
:
#${csudo} rm -rf ${v15_java_app_dir} || :
}
function
clean_header
()
{
...
...
src/dnode/inc/dnodeCheck.h
0 → 100644
浏览文件 @
5d5137ad
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_DNODE_CHECK_H
#define TDENGINE_DNODE_CHECK_H
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
dnodeInitCheck
();
void
dnodeCleanupCheck
();
#ifdef __cplusplus
}
#endif
#endif
src/dnode/src/dnodeCheck.c
0 → 100644
浏览文件 @
5d5137ad
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "taosdef.h"
#include "tglobal.h"
#include "mnode.h"
#include "dnodeInt.h"
#include "dnodeCheck.h"
typedef
struct
{
bool
enable
;
char
*
name
;
int32_t
(
*
initFp
)();
int32_t
(
*
startFp
)();
void
(
*
cleanUpFp
)();
void
(
*
stopFp
)();
}
SCheckItem
;
static
SCheckItem
tsCheckItem
[
TSDB_CHECK_ITEM_MAX
]
=
{{
0
}};
int64_t
tsMinFreeMemSizeForStart
=
0
;
static
int
bindTcpPort
(
int
port
)
{
int
serverSocket
;
struct
sockaddr_in
server_addr
;
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
0
)
{
dError
(
"socket() fail: %s"
,
strerror
(
errno
));
return
-
1
;
}
bzero
(
&
server_addr
,
sizeof
(
server_addr
));
server_addr
.
sin_family
=
AF_INET
;
server_addr
.
sin_port
=
htons
(
port
);
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
dError
(
"port:%d tcp bind() fail: %s"
,
port
,
strerror
(
errno
));
close
(
serverSocket
);
return
-
1
;
}
if
(
listen
(
serverSocket
,
5
)
<
0
)
{
dError
(
"port:%d listen() fail: %s"
,
port
,
strerror
(
errno
));
close
(
serverSocket
);
return
-
1
;
}
close
(
serverSocket
);
return
0
;
}
static
int
bindUdpPort
(
int
port
)
{
int
serverSocket
;
struct
sockaddr_in
server_addr
;
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
))
<
0
)
{
dError
(
"socket() fail: %s"
,
strerror
(
errno
));
return
-
1
;
}
bzero
(
&
server_addr
,
sizeof
(
server_addr
));
server_addr
.
sin_family
=
AF_INET
;
server_addr
.
sin_port
=
htons
(
port
);
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
dError
(
"port:%d udp bind() fail: %s"
,
port
,
strerror
(
errno
));
close
(
serverSocket
);
return
-
1
;
}
close
(
serverSocket
);
return
0
;
}
static
int
dnodeCheckNetwork
()
{
int
ret
;
int
startPort
=
tsServerPort
;
for
(
int
port
=
startPort
;
port
<
startPort
+
12
;
port
++
)
{
ret
=
bindTcpPort
(
port
);
if
(
0
!=
ret
)
{
dError
(
"failed to tcp bind port %d, quit"
,
port
);
return
-
1
;
}
ret
=
bindUdpPort
(
port
);
if
(
0
!=
ret
)
{
dError
(
"failed to udp bind port %d, quit"
,
port
);
return
-
1
;
}
}
return
0
;
}
static
int
dnodeCheckMem
()
{
float
memoryUsedMB
;
float
memoryAvailMB
;
if
(
true
!=
taosGetSysMemory
(
&
memoryUsedMB
))
{
dError
(
"failed to get system mem infomation, errno:%u, reason:%s"
,
errno
,
strerror
(
errno
));
return
-
1
;
}
memoryAvailMB
=
(
float
)
tsTotalMemoryMB
-
memoryUsedMB
;
if
(
memoryAvailMB
<
tsMinFreeMemSizeForStart
)
{
dError
(
"free mem %f too little, quit"
,
memoryAvailMB
);
return
-
1
;
}
return
0
;
}
static
int
dnodeCheckCpu
()
{
// TODO:
return
0
;
}
static
int
dnodeCheckDisk
()
{
if
(
tsAvailDataDirGB
<
tsMinimalDataDirGB
)
{
dError
(
"free disk size: %f GB, too little, quit"
,
tsAvailDataDirGB
);
return
-
1
;
}
if
(
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
dError
(
"free disk size: %f GB, too little, quit"
,
tsAvailLogDirGB
);
return
-
1
;
}
if
(
tsAvailTmpDirectorySpace
<
tsReservedTmpDirectorySpace
)
{
dError
(
"free disk size: %f GB, too little, quit"
,
tsAvailTmpDirectorySpace
);
return
-
1
;
}
return
0
;
}
static
int
dnodeCheckOs
()
{
// TODO:
return
0
;
}
static
int
dnodeCheckAccess
()
{
// TODO:
return
0
;
}
static
int
dnodeCheckVersion
()
{
// TODO:
return
0
;
}
static
int
dnodeCheckDatafile
()
{
// TODO:
return
0
;
}
static
void
dnodeAllocCheckItem
()
{
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
enable
=
false
;
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
name
=
"network"
;
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
startFp
=
dnodeCheckNetwork
;
tsCheckItem
[
TSDB_CHECK_ITEM_NETWORK
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
name
=
"mem"
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
startFp
=
dnodeCheckMem
;
tsCheckItem
[
TSDB_CHECK_ITEM_MEM
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
name
=
"cpu"
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
startFp
=
dnodeCheckCpu
;
tsCheckItem
[
TSDB_CHECK_ITEM_CPU
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
name
=
"disk"
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
startFp
=
dnodeCheckDisk
;
tsCheckItem
[
TSDB_CHECK_ITEM_DISK
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
name
=
"os"
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
startFp
=
dnodeCheckOs
;
tsCheckItem
[
TSDB_CHECK_ITEM_OS
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
name
=
"access"
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
startFp
=
dnodeCheckAccess
;
tsCheckItem
[
TSDB_CHECK_ITEM_ACCESS
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
name
=
"version"
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
startFp
=
dnodeCheckVersion
;
tsCheckItem
[
TSDB_CHECK_ITEM_VERSION
].
stopFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
enable
=
true
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
name
=
"datafile"
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
initFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
cleanUpFp
=
NULL
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
startFp
=
dnodeCheckDatafile
;
tsCheckItem
[
TSDB_CHECK_ITEM_DATAFILE
].
stopFp
=
NULL
;
}
void
dnodeCleanupCheck
()
{
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
enable
&&
tsCheckItem
[
index
].
stopFp
)
{
(
*
tsCheckItem
[
index
].
stopFp
)();
}
if
(
tsCheckItem
[
index
].
cleanUpFp
)
{
(
*
tsCheckItem
[
index
].
cleanUpFp
)();
}
}
}
int32_t
dnodeInitCheck
()
{
dnodeAllocCheckItem
();
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
initFp
)
{
if
((
*
tsCheckItem
[
index
].
initFp
)()
!=
0
)
{
dError
(
"failed to init check item:%s"
,
tsCheckItem
[
index
].
name
);
return
-
1
;
}
}
}
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
enable
&&
tsCheckItem
[
index
].
startFp
)
{
if
((
*
tsCheckItem
[
index
].
startFp
)()
!=
0
)
{
dError
(
"failed to check item:%s"
,
tsCheckItem
[
index
].
name
);
exit
(
-
1
);
}
}
}
return
0
;
}
src/dnode/src/dnodeMain.c
浏览文件 @
5d5137ad
...
...
@@ -24,6 +24,7 @@
#include "dnodeMgmt.h"
#include "dnodePeer.h"
#include "dnodeModule.h"
#include "dnodeCheck.h"
#include "dnodeVRead.h"
#include "dnodeVWrite.h"
#include "dnodeMRead.h"
...
...
@@ -48,6 +49,7 @@ typedef struct {
}
SDnodeComponent
;
static
const
SDnodeComponent
tsDnodeComponents
[]
=
{
{
"check"
,
dnodeInitCheck
,
dnodeCleanupCheck
},
// NOTES: dnodeInitCheck must be first component !!!
{
"storage"
,
dnodeInitStorage
,
dnodeCleanupStorage
},
{
"vread"
,
dnodeInitVnodeRead
,
dnodeCleanupVnodeRead
},
{
"vwrite"
,
dnodeInitVnodeWrite
,
dnodeCleanupVnodeWrite
},
...
...
src/inc/taosdef.h
浏览文件 @
5d5137ad
...
...
@@ -416,6 +416,19 @@ typedef enum {
TSDB_MOD_MAX
}
EModuleType
;
typedef
enum
{
TSDB_CHECK_ITEM_NETWORK
,
TSDB_CHECK_ITEM_MEM
,
TSDB_CHECK_ITEM_CPU
,
TSDB_CHECK_ITEM_DISK
,
TSDB_CHECK_ITEM_OS
,
TSDB_CHECK_ITEM_ACCESS
,
TSDB_CHECK_ITEM_VERSION
,
TSDB_CHECK_ITEM_DATAFILE
,
TSDB_CHECK_ITEM_MAX
}
ECheckItemType
;
#ifdef __cplusplus
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录