Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6321b0df
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6321b0df
编写于
6月 01, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'haoyifan/fix_init' into develop
上级
f0b2c37c
86cbe53f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
35 deletion
+55
-35
src/dnode/inc/dnodeModule.h
src/dnode/inc/dnodeModule.h
+1
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+44
-22
src/dnode/src/dnodeModule.c
src/dnode/src/dnodeModule.c
+1
-1
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+3
-5
src/dnode/src/dnodeVRead.c
src/dnode/src/dnodeVRead.c
+6
-6
未找到文件。
src/dnode/inc/dnodeModule.h
浏览文件 @
6321b0df
...
@@ -22,7 +22,7 @@ extern "C" {
...
@@ -22,7 +22,7 @@ extern "C" {
int32_t
dnodeInitModules
();
int32_t
dnodeInitModules
();
void
dnodeStartModules
();
void
dnodeStartModules
();
void
dnodeClean
U
pModules
();
void
dnodeClean
u
pModules
();
void
dnodeProcessModuleStatus
(
uint32_t
moduleStatus
);
void
dnodeProcessModuleStatus
(
uint32_t
moduleStatus
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
6321b0df
...
@@ -36,6 +36,46 @@ static void dnodeCleanupStorage();
...
@@ -36,6 +36,46 @@ static void dnodeCleanupStorage();
static
void
dnodeSetRunStatus
(
SDnodeRunStatus
status
);
static
void
dnodeSetRunStatus
(
SDnodeRunStatus
status
);
static
void
dnodeCheckDataDirOpenned
(
char
*
dir
);
static
void
dnodeCheckDataDirOpenned
(
char
*
dir
);
static
SDnodeRunStatus
tsDnodeRunStatus
=
TSDB_DNODE_RUN_STATUS_STOPPED
;
static
SDnodeRunStatus
tsDnodeRunStatus
=
TSDB_DNODE_RUN_STATUS_STOPPED
;
static
int32_t
dnodeInitComponents
();
static
void
dnodeCleanupComponents
(
int32_t
stepId
);
typedef
struct
{
const
char
*
const
name
;
int
(
*
init
)();
void
(
*
cleanup
)();
}
SDnodeComponent
;
static
const
SDnodeComponent
SDnodeComponents
[]
=
{
{
"storage"
,
dnodeInitStorage
,
dnodeCleanupStorage
},
{
"vread"
,
dnodeInitVnodeRead
,
dnodeCleanupVnodeRead
},
{
"vwrite"
,
dnodeInitVnodeWrite
,
dnodeCleanupVnodeWrite
},
{
"mread"
,
dnodeInitMnodeRead
,
dnodeCleanupMnodeRead
},
{
"mwrite"
,
dnodeInitMnodeWrite
,
dnodeCleanupMnodeWrite
},
{
"mpeer"
,
dnodeInitMnodePeer
,
dnodeCleanupMnodePeer
},
{
"client"
,
dnodeInitClient
,
dnodeCleanupClient
},
{
"server"
,
dnodeInitServer
,
dnodeCleanupServer
},
{
"mgmt"
,
dnodeInitMgmt
,
dnodeCleanupMgmt
},
{
"modules"
,
dnodeInitModules
,
dnodeCleanupModules
},
{
"shell"
,
dnodeInitShell
,
dnodeCleanupShell
}
};
static
void
dnodeCleanupComponents
(
int32_t
stepId
)
{
for
(
int32_t
i
=
stepId
;
i
>=
0
;
i
--
)
{
SDnodeComponents
[
i
].
cleanup
();
}
}
static
int32_t
dnodeInitComponents
()
{
int32_t
code
=
0
;
for
(
int32_t
i
=
0
;
i
<
sizeof
(
SDnodeComponents
)
/
sizeof
(
SDnodeComponents
[
0
]);
i
++
)
{
if
(
SDnodeComponents
[
i
].
init
()
!=
0
)
{
dnodeCleanupComponents
(
i
);
code
=
-
1
;
break
;
}
}
return
code
;
}
int32_t
dnodeInitSystem
()
{
int32_t
dnodeInitSystem
()
{
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_INITIALIZE
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_INITIALIZE
);
...
@@ -67,17 +107,9 @@ int32_t dnodeInitSystem() {
...
@@ -67,17 +107,9 @@ int32_t dnodeInitSystem() {
dPrint
(
"start to initialize TDengine on %s"
,
tsLocalEp
);
dPrint
(
"start to initialize TDengine on %s"
,
tsLocalEp
);
if
(
dnodeInitStorage
()
!=
0
)
return
-
1
;
if
(
dnodeInitComponents
()
!=
0
)
{
if
(
dnodeInitVnodeRead
()
!=
0
)
return
-
1
;
return
-
1
;
if
(
dnodeInitVnodeWrite
()
!=
0
)
return
-
1
;
}
if
(
dnodeInitMnodeRead
()
!=
0
)
return
-
1
;
if
(
dnodeInitMnodeWrite
()
!=
0
)
return
-
1
;
if
(
dnodeInitMnodePeer
()
!=
0
)
return
-
1
;
if
(
dnodeInitClient
()
!=
0
)
return
-
1
;
if
(
dnodeInitServer
()
!=
0
)
return
-
1
;
if
(
dnodeInitMgmt
()
!=
0
)
return
-
1
;
if
(
dnodeInitModules
()
!=
0
)
return
-
1
;
if
(
dnodeInitShell
()
!=
0
)
return
-
1
;
dnodeStartModules
();
dnodeStartModules
();
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_RUNING
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_RUNING
);
...
@@ -90,17 +122,7 @@ int32_t dnodeInitSystem() {
...
@@ -90,17 +122,7 @@ int32_t dnodeInitSystem() {
void
dnodeCleanUpSystem
()
{
void
dnodeCleanUpSystem
()
{
if
(
dnodeGetRunStatus
()
!=
TSDB_DNODE_RUN_STATUS_STOPPED
)
{
if
(
dnodeGetRunStatus
()
!=
TSDB_DNODE_RUN_STATUS_STOPPED
)
{
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeCleanupShell
();
dnodeCleanupComponents
(
sizeof
(
SDnodeComponents
)
/
sizeof
(
SDnodeComponents
[
0
])
-
1
);
dnodeCleanUpModules
();
dnodeCleanupMgmt
();
dnodeCleanupServer
();
dnodeCleanupClient
();
dnodeCleanupMnodePeer
();
dnodeCleanupMnodeWrite
();
dnodeCleanupMnodeRead
();
dnodeCleanupVnodeWrite
();
dnodeCleanupVnodeRead
();
dnodeCleanupStorage
();
taos_cleanup
();
taos_cleanup
();
taosCloseLog
();
taosCloseLog
();
}
}
...
...
src/dnode/src/dnodeModule.c
浏览文件 @
6321b0df
...
@@ -83,7 +83,7 @@ static void dnodeAllocModules() {
...
@@ -83,7 +83,7 @@ static void dnodeAllocModules() {
}
}
}
}
void
dnodeClean
U
pModules
()
{
void
dnodeClean
u
pModules
()
{
for
(
int32_t
module
=
1
;
module
<
TSDB_MOD_MAX
;
++
module
)
{
for
(
int32_t
module
=
1
;
module
<
TSDB_MOD_MAX
;
++
module
)
{
if
(
tsModule
[
module
].
enable
&&
tsModule
[
module
].
stopFp
)
{
if
(
tsModule
[
module
].
enable
&&
tsModule
[
module
].
stopFp
)
{
(
*
tsModule
[
module
].
stopFp
)();
(
*
tsModule
[
module
].
stopFp
)();
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
6321b0df
...
@@ -39,11 +39,11 @@ int32_t main(int32_t argc, char *argv[]) {
...
@@ -39,11 +39,11 @@ int32_t main(int32_t argc, char *argv[]) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
#ifdef _SYNC
#ifdef _SYNC
char
*
versionStr
=
"enterprise"
;
char
*
versionStr
=
"enterprise"
;
#else
#else
char
*
versionStr
=
"community"
;
char
*
versionStr
=
"community"
;
#endif
#endif
printf
(
"%s version: %s compatible_version: %s
\n
"
,
versionStr
,
version
,
compatible_version
);
printf
(
"%s version: %s compatible_version: %s
\n
"
,
versionStr
,
version
,
compatible_version
);
printf
(
"gitinfo: %s
\n
"
,
gitinfo
);
printf
(
"gitinfo: %s
\n
"
,
gitinfo
);
printf
(
"gitinfoI: %s
\n
"
,
gitinfoOfInternal
);
printf
(
"gitinfoI: %s
\n
"
,
gitinfoOfInternal
);
...
@@ -93,8 +93,6 @@ int32_t main(int32_t argc, char *argv[]) {
...
@@ -93,8 +93,6 @@ int32_t main(int32_t argc, char *argv[]) {
if
(
dnodeInitSystem
()
<
0
)
{
if
(
dnodeInitSystem
()
<
0
)
{
syslog
(
LOG_ERR
,
"Error initialize TDengine system"
);
syslog
(
LOG_ERR
,
"Error initialize TDengine system"
);
closelog
();
closelog
();
dnodeCleanUpSystem
();
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/dnode/src/dnodeVRead.c
浏览文件 @
6321b0df
...
@@ -34,7 +34,7 @@ typedef struct {
...
@@ -34,7 +34,7 @@ typedef struct {
}
SReadMsg
;
}
SReadMsg
;
typedef
struct
{
typedef
struct
{
pthread_t
thread
;
// thread
pthread_t
thread
;
// thread
int32_t
workerId
;
// worker ID
int32_t
workerId
;
// worker ID
}
SReadWorker
;
}
SReadWorker
;
...
@@ -85,8 +85,8 @@ void dnodeCleanupVnodeRead() {
...
@@ -85,8 +85,8 @@ void dnodeCleanupVnodeRead() {
}
}
}
}
taosCloseQset
(
readQset
);
free
(
readPool
.
readWorker
);
free
(
readPool
.
readWorker
);
taosCloseQset
(
readQset
);
dPrint
(
"dnode read is closed"
);
dPrint
(
"dnode read is closed"
);
}
}
...
@@ -95,7 +95,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) {
...
@@ -95,7 +95,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) {
int32_t
queuedMsgNum
=
0
;
int32_t
queuedMsgNum
=
0
;
int32_t
leftLen
=
pMsg
->
contLen
;
int32_t
leftLen
=
pMsg
->
contLen
;
char
*
pCont
=
(
char
*
)
pMsg
->
pCont
;
char
*
pCont
=
(
char
*
)
pMsg
->
pCont
;
void
*
pVnode
;
void
*
pVnode
;
while
(
leftLen
>
0
)
{
while
(
leftLen
>
0
)
{
SMsgHead
*
pHead
=
(
SMsgHead
*
)
pCont
;
SMsgHead
*
pHead
=
(
SMsgHead
*
)
pCont
;
...
@@ -166,7 +166,7 @@ void *dnodeAllocateVnodeRqueue(void *pVnode) {
...
@@ -166,7 +166,7 @@ void *dnodeAllocateVnodeRqueue(void *pVnode) {
}
while
(
readPool
.
num
<
readPool
.
min
);
}
while
(
readPool
.
num
<
readPool
.
min
);
}
}
dTrace
(
"pVnode:%p, read queue:%p is allocated"
,
pVnode
,
queue
);
dTrace
(
"pVnode:%p, read queue:%p is allocated"
,
pVnode
,
queue
);
return
queue
;
return
queue
;
}
}
...
@@ -177,13 +177,13 @@ void dnodeFreeVnodeRqueue(void *rqueue) {
...
@@ -177,13 +177,13 @@ void dnodeFreeVnodeRqueue(void *rqueue) {
// dynamically adjust the number of threads
// dynamically adjust the number of threads
}
}
static
void
dnodeContinueExecuteQuery
(
void
*
pVnode
,
void
*
qhandle
,
SReadMsg
*
pMsg
)
{
static
void
dnodeContinueExecuteQuery
(
void
*
pVnode
,
void
*
qhandle
,
SReadMsg
*
pMsg
)
{
SReadMsg
*
pRead
=
(
SReadMsg
*
)
taosAllocateQitem
(
sizeof
(
SReadMsg
));
SReadMsg
*
pRead
=
(
SReadMsg
*
)
taosAllocateQitem
(
sizeof
(
SReadMsg
));
pRead
->
rpcMsg
=
pMsg
->
rpcMsg
;
pRead
->
rpcMsg
=
pMsg
->
rpcMsg
;
pRead
->
pCont
=
qhandle
;
pRead
->
pCont
=
qhandle
;
pRead
->
contLen
=
0
;
pRead
->
contLen
=
0
;
pRead
->
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
pRead
->
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
taos_queue
queue
=
vnodeGetRqueue
(
pVnode
);
taos_queue
queue
=
vnodeGetRqueue
(
pVnode
);
taosWriteQitem
(
queue
,
TAOS_QTYPE_RPC
,
pRead
);
taosWriteQitem
(
queue
,
TAOS_QTYPE_RPC
,
pRead
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录