Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c049678a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c049678a
编写于
11月 27, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-11265 fix deadlock while quit taosd
上级
7330b0f8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
45 addition
and
29 deletion
+45
-29
include/util/tworker.h
include/util/tworker.h
+11
-8
source/dnode/mgmt/daemon/src/daemon.c
source/dnode/mgmt/daemon/src/daemon.c
+4
-1
source/dnode/mgmt/impl/inc/dndInt.h
source/dnode/mgmt/impl/inc/dndInt.h
+11
-11
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+8
-4
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+7
-1
source/dnode/mgmt/impl/src/dnode.c
source/dnode/mgmt/impl/src/dnode.c
+1
-1
source/util/src/tqueue.c
source/util/src/tqueue.c
+1
-1
source/util/src/tworker.c
source/util/src/tworker.c
+2
-2
未找到文件。
include/util/tworker.h
浏览文件 @
c049678a
...
...
@@ -22,10 +22,13 @@
extern
"C"
{
#endif
typedef
struct
SWorkerPool
SWorkerPool
;
typedef
struct
SMWorkerPool
SMWorkerPool
;
typedef
struct
SWorker
{
int32_t
id
;
// worker ID
pthread_t
thread
;
// thread
struct
SWorkerPool
*
pool
;
int32_t
id
;
// worker ID
pthread_t
thread
;
// thread
SWorkerPool
*
pool
;
}
SWorker
;
typedef
struct
SWorkerPool
{
...
...
@@ -39,11 +42,11 @@ typedef struct SWorkerPool {
}
SWorkerPool
;
typedef
struct
SMWorker
{
int32_t
id
;
// worker id
pthread_t
thread
;
// thread
taos_qall
qall
;
taos_qset
qset
;
// queue set
struct
SMWorkerPool
*
pool
;
int32_t
id
;
// worker id
pthread_t
thread
;
// thread
taos_qall
qall
;
taos_qset
qset
;
// queue set
SMWorkerPool
*
pool
;
}
SMWorker
;
typedef
struct
SMWorkerPool
{
...
...
source/dnode/mgmt/daemon/src/daemon.c
浏览文件 @
c049678a
...
...
@@ -30,7 +30,10 @@ static struct {
char
configDir
[
PATH_MAX
];
}
global
=
{
0
};
void
dmnSigintHandle
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
global
.
stop
=
true
;
}
void
dmnSigintHandle
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
uError
(
"singal:%d is received"
,
signum
);
global
.
stop
=
true
;
}
void
dmnSetSignalHandle
()
{
taosSetSignal
(
SIGTERM
,
dmnSigintHandle
);
...
...
source/dnode/mgmt/impl/inc/dndInt.h
浏览文件 @
c049678a
...
...
@@ -74,31 +74,31 @@ typedef struct {
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
SWorkerPool
mgmtPool
;
SWorkerPool
readPool
;
SWorkerPool
writePool
;
SWorkerPool
syncPool
;
char
*
file
;
SMnode
*
pMnode
;
SRWLatch
latch
;
taos_queue
pReadQ
;
taos_queue
pWriteQ
;
taos_queue
pApplyQ
;
taos_queue
pSyncQ
;
taos_queue
pMgmtQ
;
char
*
file
;
SMnode
*
pMnode
;
SRWLatch
latch
;
SWorkerPool
mgmtPool
;
SWorkerPool
readPool
;
SWorkerPool
writePool
;
SWorkerPool
syncPool
;
}
SMnodeMgmt
;
typedef
struct
{
SHashObj
*
hash
;
int32_t
openVnodes
;
int32_t
totalVnodes
;
SRWLatch
latch
;
taos_queue
pMgmtQ
;
SWorkerPool
mgmtPool
;
SWorkerPool
queryPool
;
SWorkerPool
fetchPool
;
SMWorkerPool
syncPool
;
SMWorkerPool
writePool
;
taos_queue
pMgmtQ
;
int32_t
openVnodes
;
int32_t
totalVnodes
;
SRWLatch
latch
;
}
SVnodesMgmt
;
typedef
struct
{
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
c049678a
...
...
@@ -294,14 +294,14 @@ static void dndStopMnodeWorker(SDnode *pDnode) {
while
(
!
taosQueueEmpty
(
pMgmt
->
pWriteQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pMgmt
->
pSyncQ
))
taosMsleep
(
10
);
dndCleanupMnodeReadWorker
(
pDnode
);
dndCleanupMnodeWriteWorker
(
pDnode
);
dndCleanupMnodeSyncWorker
(
pDnode
);
dndFreeMnodeReadQueue
(
pDnode
);
dndFreeMnodeWriteQueue
(
pDnode
);
dndFreeMnodeApplyQueue
(
pDnode
);
dndFreeMnodeSyncQueue
(
pDnode
);
dndCleanupMnodeReadWorker
(
pDnode
);
dndCleanupMnodeWriteWorker
(
pDnode
);
dndCleanupMnodeSyncWorker
(
pDnode
);
}
static
bool
dndNeedDeployMnode
(
SDnode
*
pDnode
)
{
...
...
@@ -714,6 +714,7 @@ static int32_t dndInitMnodeMgmtWorker(SDnode *pDnode) {
static
void
dndCleanupMnodeMgmtWorker
(
SDnode
*
pDnode
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
tWorkerCleanup
(
&
pMgmt
->
mgmtPool
);
dDebug
(
"mnode mgmt worker is stopped"
);
}
static
int32_t
dndAllocMnodeReadQueue
(
SDnode
*
pDnode
)
{
...
...
@@ -750,6 +751,7 @@ static int32_t dndInitMnodeReadWorker(SDnode *pDnode) {
static
void
dndCleanupMnodeReadWorker
(
SDnode
*
pDnode
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
tWorkerCleanup
(
&
pMgmt
->
readPool
);
dDebug
(
"mnode read worker is stopped"
);
}
static
int32_t
dndAllocMnodeWriteQueue
(
SDnode
*
pDnode
)
{
...
...
@@ -803,6 +805,7 @@ static int32_t dndInitMnodeWriteWorker(SDnode *pDnode) {
static
void
dndCleanupMnodeWriteWorker
(
SDnode
*
pDnode
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
tWorkerCleanup
(
&
pMgmt
->
writePool
);
dDebug
(
"mnode write worker is stopped"
);
}
static
int32_t
dndAllocMnodeSyncQueue
(
SDnode
*
pDnode
)
{
...
...
@@ -839,6 +842,7 @@ static int32_t dndInitMnodeSyncWorker(SDnode *pDnode) {
static
void
dndCleanupMnodeSyncWorker
(
SDnode
*
pDnode
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
tWorkerCleanup
(
&
pMgmt
->
syncPool
);
dDebug
(
"mnode sync worker is stopped"
);
}
int32_t
dndInitMnode
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
c049678a
...
...
@@ -160,6 +160,7 @@ static int32_t dndInitClient(SDnode *pDnode) {
rpcInit
.
user
=
INTERNAL_USER
;
rpcInit
.
ckey
=
INTERNAL_CKEY
;
rpcInit
.
secret
=
INTERNAL_SECRET
;
rpcInit
.
parent
=
pDnode
;
pMgmt
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pMgmt
->
clientRpc
==
NULL
)
{
...
...
@@ -167,6 +168,7 @@ static int32_t dndInitClient(SDnode *pDnode) {
return
-
1
;
}
dDebug
(
"dnode rpc client is initialized"
);
return
0
;
}
...
...
@@ -175,7 +177,7 @@ static void dndCleanupClient(SDnode *pDnode) {
if
(
pMgmt
->
clientRpc
)
{
rpcClose
(
pMgmt
->
clientRpc
);
pMgmt
->
clientRpc
=
NULL
;
d
Info
(
"dnode peer
rpc client is closed"
);
d
Debug
(
"dnode
rpc client is closed"
);
}
}
...
...
@@ -315,6 +317,7 @@ static int32_t dndInitServer(SDnode *pDnode) {
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
pDnode
->
opt
.
shellActivityTimer
*
1000
;
rpcInit
.
afp
=
dndRetrieveUserAuthInfo
;
rpcInit
.
parent
=
pDnode
;
pMgmt
->
serverRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pMgmt
->
serverRpc
==
NULL
)
{
...
...
@@ -322,6 +325,7 @@ static int32_t dndInitServer(SDnode *pDnode) {
return
-
1
;
}
dDebug
(
"dnode rpc server is initialized"
);
return
0
;
}
...
...
@@ -330,6 +334,7 @@ static void dndCleanupServer(SDnode *pDnode) {
if
(
pMgmt
->
serverRpc
)
{
rpcClose
(
pMgmt
->
serverRpc
);
pMgmt
->
serverRpc
=
NULL
;
dDebug
(
"dnode rpc server is closed"
);
}
}
...
...
@@ -347,6 +352,7 @@ int32_t dndInitTrans(SDnode *pDnode) {
}
void
dndCleanupTrans
(
SDnode
*
pDnode
)
{
dInfo
(
"dnode-transport start to clean up"
);
dndCleanupServer
(
pDnode
);
dndCleanupClient
(
pDnode
);
dInfo
(
"dnode-transport is cleaned up"
);
...
...
source/dnode/mgmt/impl/src/dnode.c
浏览文件 @
c049678a
...
...
@@ -197,7 +197,7 @@ SDnode *dndInit(SDnodeOpt *pOption) {
dndReportStartup
(
pDnode
,
"TDengine"
,
"initialized successfully"
);
dInfo
(
"TDengine is initialized successfully"
);
return
0
;
return
pDnode
;
}
void
dndCleanup
(
SDnode
*
pDnode
)
{
...
...
source/util/src/tqueue.c
浏览文件 @
c049678a
...
...
@@ -107,7 +107,7 @@ bool taosQueueEmpty(taos_queue param) {
if
(
queue
->
head
==
NULL
&&
queue
->
tail
==
NULL
)
{
empty
=
true
;
}
pthread_mutex_
destroy
(
&
queue
->
mutex
);
pthread_mutex_
unlock
(
&
queue
->
mutex
);
return
empty
;
}
...
...
source/util/src/tworker.c
浏览文件 @
c049678a
...
...
@@ -50,7 +50,7 @@ void tWorkerCleanup(SWorkerPool *pool) {
}
}
free
(
pool
->
workers
);
t
free
(
pool
->
workers
);
taosCloseQset
(
pool
->
qset
);
pthread_mutex_destroy
(
&
pool
->
mutex
);
...
...
@@ -159,7 +159,7 @@ void tMWorkerCleanup(SMWorkerPool *pool) {
}
}
free
(
pool
->
workers
);
t
free
(
pool
->
workers
);
pthread_mutex_destroy
(
&
pool
->
mutex
);
uInfo
(
"worker:%s is closed"
,
pool
->
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录