Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fc41f43c
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看板
提交
fc41f43c
编写于
11月 04, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: deadlock while drop db
上级
a0983cf8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
21 deletion
+43
-21
include/util/tworker.h
include/util/tworker.h
+2
-0
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+14
-6
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-6
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+15
-2
source/util/src/tworker.c
source/util/src/tworker.c
+10
-7
未找到文件。
include/util/tworker.h
浏览文件 @
fc41f43c
...
...
@@ -28,6 +28,7 @@ typedef struct SWWorkerPool SWWorkerPool;
typedef
struct
SQWorker
{
int32_t
id
;
// worker ID
TdThread
thread
;
// thread
int64_t
pid
;
SQWorkerPool
*
pool
;
}
SQWorker
;
...
...
@@ -44,6 +45,7 @@ typedef struct SQWorkerPool {
typedef
struct
SWWorker
{
int32_t
id
;
// worker id
TdThread
thread
;
// thread
int64_t
pid
;
STaosQall
*
qall
;
STaosQset
*
qset
;
// queue set
SWWorkerPool
*
pool
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
fc41f43c
...
...
@@ -79,35 +79,43 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
void
vmCloseVnode
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
char
path
[
TSDB_FILENAME_LEN
]
=
{
0
};
vnodePreClose
(
pVnode
->
pImpl
);
taosThreadRwlockWrlock
(
&
pMgmt
->
lock
);
taosHashRemove
(
pMgmt
->
hash
,
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
taosThreadRwlockUnlock
(
&
pMgmt
->
lock
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
dInfo
(
"vgId:%d, pre close"
,
pVnode
->
vgId
);
vnodePreClose
(
pVnode
->
pImpl
);
dInfo
(
"vgId:%d, wait for vnode ref become 0"
,
pVnode
->
vgId
);
while
(
pVnode
->
refCount
>
0
)
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode write queue:%p is empty, thread:%08"
PRId64
,
pVnode
->
vgId
,
pVnode
->
pWriteQ
,
pVnode
->
pWriteQ
->
threadId
);
while
(
!
taosQueueEmpty
(
pVnode
->
pWriteQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode sync queue:%p is empty, thread:%08"
PRId64
,
pVnode
->
vgId
,
pVnode
->
pSyncQ
,
pVnode
->
p
Write
Q
->
threadId
);
pVnode
->
p
Sync
Q
->
threadId
);
while
(
!
taosQueueEmpty
(
pVnode
->
pSyncQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode sync ctrl queue:%p is empty, thread:%08"
PRId64
,
pVnode
->
vgId
,
pVnode
->
pSyncCtrlQ
,
pVnode
->
p
Write
Q
->
threadId
);
pVnode
->
p
SyncCtrl
Q
->
threadId
);
while
(
!
taosQueueEmpty
(
pVnode
->
pSyncCtrlQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode apply queue:%p is empty, thread:%08"
PRId64
,
pVnode
->
vgId
,
pVnode
->
pApplyQ
,
pVnode
->
p
Write
Q
->
threadId
);
pVnode
->
p
Apply
Q
->
threadId
);
while
(
!
taosQueueEmpty
(
pVnode
->
pApplyQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode query queue:%p is empty"
,
pVnode
->
vgId
,
pVnode
->
pQueryQ
);
while
(
!
taosQueueEmpty
(
pVnode
->
pQueryQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode fetch queue:%p is empty, thread:%08"
PRId64
,
pVnode
->
vgId
,
pVnode
->
pFetchQ
,
pVnode
->
p
Write
Q
->
threadId
);
pVnode
->
p
Fetch
Q
->
threadId
);
while
(
!
taosQueueEmpty
(
pVnode
->
pFetchQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, wait for vnode stream queue:%p is empty"
,
pVnode
->
vgId
,
pVnode
->
pStreamQ
);
while
(
!
taosQueueEmpty
(
pVnode
->
pStreamQ
))
taosMsleep
(
10
);
dInfo
(
"vgId:%d, all vnode queues is empty"
,
pVnode
->
vgId
);
vmFreeQueue
(
pMgmt
,
pVnode
);
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
fc41f43c
...
...
@@ -97,6 +97,7 @@ bool vnodeShouldRollback(SVnode* pVnode);
// vnodeSync.c
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncPreClose
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeRedirectRpcMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
bool
vnodeIsLeader
(
SVnode
*
pVnode
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
fc41f43c
...
...
@@ -242,12 +242,7 @@ _err:
return
NULL
;
}
void
vnodePreClose
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
syncLeaderTransfer
(
pVnode
->
sync
);
syncPreStop
(
pVnode
->
sync
);
}
}
void
vnodePreClose
(
SVnode
*
pVnode
)
{
vnodeSyncPreClose
(
pVnode
);
}
void
vnodeClose
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
fc41f43c
...
...
@@ -474,12 +474,25 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
}
void
vnodeSyncStart
(
SVnode
*
pVnode
)
{
v
Debug
(
"vgId:%d, start sync"
,
pVnode
->
config
.
vgId
);
v
Info
(
"vgId:%d, start sync"
,
pVnode
->
config
.
vgId
);
syncStart
(
pVnode
->
sync
);
}
void
vnodeSyncPreClose
(
SVnode
*
pVnode
)
{
vInfo
(
"vgId:%d, pre close sync"
,
pVnode
->
config
.
vgId
);
syncLeaderTransfer
(
pVnode
->
sync
);
syncPreStop
(
pVnode
->
sync
);
taosThreadMutexLock
(
&
pVnode
->
lock
);
if
(
pVnode
->
blocked
)
{
vInfo
(
"vgId:%d, post block after close sync"
,
pVnode
->
config
.
vgId
);
pVnode
->
blocked
=
false
;
tsem_post
(
&
pVnode
->
syncSem
);
}
taosThreadMutexUnlock
(
&
pVnode
->
lock
);
}
void
vnodeSyncClose
(
SVnode
*
pVnode
)
{
v
Debug
(
"vgId:%d, close sync"
,
pVnode
->
config
.
vgId
);
v
Info
(
"vgId:%d, close sync"
,
pVnode
->
config
.
vgId
);
syncStop
(
pVnode
->
sync
);
}
...
...
source/util/src/tworker.c
浏览文件 @
fc41f43c
...
...
@@ -73,12 +73,13 @@ static void *tQWorkerThreadFp(SQWorker *worker) {
taosBlockSIGPIPE
();
setThreadName
(
pool
->
name
);
uInfo
(
"worker:%s:%d is running, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
taosGetSelfPthreadId
());
worker
->
pid
=
taosGetSelfPthreadId
();
uInfo
(
"worker:%s:%d is running, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
worker
->
pid
);
while
(
1
)
{
if
(
taosReadQitemFromQset
(
pool
->
qset
,
(
void
**
)
&
msg
,
&
qinfo
)
==
0
)
{
uInfo
(
"worker:%s:%d qset:%p, got no message and exiting, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
pool
->
qset
,
taosGetSelfPthreadId
()
);
worker
->
pid
);
break
;
}
...
...
@@ -125,7 +126,7 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
}
taosThreadMutexUnlock
(
&
pool
->
mutex
);
u
Debug
(
"worker:%s, queue:%p is allocated, ahandle:%p"
,
pool
->
name
,
queue
,
ahandle
);
u
Info
(
"worker:%s, queue:%p is allocated, ahandle:%p"
,
pool
->
name
,
queue
,
ahandle
);
return
queue
;
}
...
...
@@ -192,13 +193,14 @@ static void *tWWorkerThreadFp(SWWorker *worker) {
taosBlockSIGPIPE
();
setThreadName
(
pool
->
name
);
uInfo
(
"worker:%s:%d is running, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
taosGetSelfPthreadId
());
worker
->
pid
=
taosGetSelfPthreadId
();
uInfo
(
"worker:%s:%d is running, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
worker
->
pid
);
while
(
1
)
{
numOfMsgs
=
taosReadAllQitemsFromQset
(
worker
->
qset
,
worker
->
qall
,
&
qinfo
);
if
(
numOfMsgs
==
0
)
{
uInfo
(
"worker:%s:%d qset:%p, got no message and exiting, thread:%08"
PRId64
,
pool
->
name
,
worker
->
id
,
worker
->
qset
,
taosGetSelfPthreadId
()
);
worker
->
pid
);
break
;
}
...
...
@@ -246,8 +248,9 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
pool
->
nextId
=
(
pool
->
nextId
+
1
)
%
pool
->
max
;
}
queue
->
threadId
=
taosGetPthreadId
(
worker
->
thread
);
uDebug
(
"worker:%s, queue:%p is allocated, ahandle:%p thread:%08"
PRId64
,
pool
->
name
,
queue
,
ahandle
,
queue
->
threadId
);
while
(
worker
->
pid
<=
0
)
taosMsleep
(
10
);
queue
->
threadId
=
worker
->
pid
;
uInfo
(
"worker:%s, queue:%p is allocated, ahandle:%p thread:%08"
PRId64
,
pool
->
name
,
queue
,
ahandle
,
queue
->
threadId
);
code
=
0
;
_OVER:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录