Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
af4b0224
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看板
未验证
提交
af4b0224
编写于
7月 04, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2559 from taosdata/hotfix/crash
[TD-825] vnodehash may be null while close all vnodes
上级
19ba6ef2
0c91ffae
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
43 addition
and
14 deletion
+43
-14
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+11
-6
src/inc/vnode.h
src/inc/vnode.h
+3
-1
src/plugins/mqtt/src/mqttSystem.c
src/plugins/mqtt/src/mqttSystem.c
+1
-1
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+28
-6
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
af4b0224
...
@@ -176,6 +176,7 @@ void dnodeCleanupMgmt() {
...
@@ -176,6 +176,7 @@ void dnodeCleanupMgmt() {
tsMgmtQset
=
NULL
;
tsMgmtQset
=
NULL
;
tsMgmtQueue
=
NULL
;
tsMgmtQueue
=
NULL
;
vnodeCleanupResources
();
}
}
void
dnodeDispatchToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
void
dnodeDispatchToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
...
@@ -242,8 +243,14 @@ static int32_t dnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) {
...
@@ -242,8 +243,14 @@ static int32_t dnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) {
int32_t
vnode
=
atoi
(
de
->
d_name
+
5
);
int32_t
vnode
=
atoi
(
de
->
d_name
+
5
);
if
(
vnode
==
0
)
continue
;
if
(
vnode
==
0
)
continue
;
vnodeList
[
*
numOfVnodes
]
=
vnode
;
(
*
numOfVnodes
)
++
;
(
*
numOfVnodes
)
++
;
if
(
*
numOfVnodes
>=
TSDB_MAX_VNODES
)
{
dError
(
"vgId:%d, too many vnode directory in disk, exist:%d max:%d"
,
vnode
,
*
numOfVnodes
,
TSDB_MAX_VNODES
);
continue
;
}
else
{
vnodeList
[
*
numOfVnodes
-
1
]
=
vnode
;
}
}
}
}
}
closedir
(
dir
);
closedir
(
dir
);
...
@@ -337,7 +344,7 @@ static int32_t dnodeOpenVnodes() {
...
@@ -337,7 +344,7 @@ static int32_t dnodeOpenVnodes() {
void
dnodeStartStream
()
{
void
dnodeStartStream
()
{
int32_t
vnodeList
[
TSDB_MAX_VNODES
];
int32_t
vnodeList
[
TSDB_MAX_VNODES
];
int32_t
numOfVnodes
=
0
;
int32_t
numOfVnodes
=
0
;
int32_t
status
=
d
nodeGetVnodeList
(
vnodeList
,
&
numOfVnodes
);
int32_t
status
=
v
nodeGetVnodeList
(
vnodeList
,
&
numOfVnodes
);
if
(
status
!=
TSDB_CODE_SUCCESS
)
{
if
(
status
!=
TSDB_CODE_SUCCESS
)
{
dInfo
(
"get dnode list failed"
);
dInfo
(
"get dnode list failed"
);
...
@@ -352,15 +359,14 @@ void dnodeStartStream() {
...
@@ -352,15 +359,14 @@ void dnodeStartStream() {
}
}
static
void
dnodeCloseVnodes
()
{
static
void
dnodeCloseVnodes
()
{
int32_t
*
vnodeList
=
(
int32_t
*
)
malloc
(
sizeof
(
int32_t
)
*
TSDB_MAX_VNODES
)
;
int32_t
vnodeList
[
TSDB_MAX_VNODES
]
;
int32_t
numOfVnodes
;
int32_t
numOfVnodes
;
int32_t
status
;
int32_t
status
;
status
=
d
nodeGetVnodeList
(
vnodeList
,
&
numOfVnodes
);
status
=
v
nodeGetVnodeList
(
vnodeList
,
&
numOfVnodes
);
if
(
status
!=
TSDB_CODE_SUCCESS
)
{
if
(
status
!=
TSDB_CODE_SUCCESS
)
{
dInfo
(
"get dnode list failed"
);
dInfo
(
"get dnode list failed"
);
free
(
vnodeList
);
return
;
return
;
}
}
...
@@ -368,7 +374,6 @@ static void dnodeCloseVnodes() {
...
@@ -368,7 +374,6 @@ static void dnodeCloseVnodes() {
vnodeClose
(
vnodeList
[
i
]);
vnodeClose
(
vnodeList
[
i
]);
}
}
free
(
vnodeList
);
dInfo
(
"total vnodes:%d are all closed"
,
numOfVnodes
);
dInfo
(
"total vnodes:%d are all closed"
,
numOfVnodes
);
}
}
...
...
src/inc/vnode.h
浏览文件 @
af4b0224
...
@@ -58,8 +58,10 @@ void* vnodeGetWqueue(int32_t vgId);
...
@@ -58,8 +58,10 @@ void* vnodeGetWqueue(int32_t vgId);
void
*
vnodeGetWal
(
void
*
pVnode
);
void
*
vnodeGetWal
(
void
*
pVnode
);
int32_t
vnodeProcessWrite
(
void
*
pVnode
,
int
qtype
,
void
*
pHead
,
void
*
item
);
int32_t
vnodeProcessWrite
(
void
*
pVnode
,
int
qtype
,
void
*
pHead
,
void
*
item
);
void
vnodeBuildStatusMsg
(
void
*
param
);
int32_t
vnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
);
void
vnodeBuildStatusMsg
(
void
*
param
);
void
vnodeSetAccess
(
SDMVgroupAccess
*
pAccess
,
int32_t
numOfVnodes
);
void
vnodeSetAccess
(
SDMVgroupAccess
*
pAccess
,
int32_t
numOfVnodes
);
void
vnodeCleanupResources
();
int32_t
vnodeProcessRead
(
void
*
pVnode
,
SReadMsg
*
pReadMsg
);
int32_t
vnodeProcessRead
(
void
*
pVnode
,
SReadMsg
*
pReadMsg
);
...
...
src/plugins/mqtt/src/mqttSystem.c
浏览文件 @
af4b0224
...
@@ -111,7 +111,7 @@ void mqttStopSystem() {
...
@@ -111,7 +111,7 @@ void mqttStopSystem() {
}
}
void
mqttCleanUpSystem
()
{
void
mqttCleanUpSystem
()
{
mqttInfo
(
"starting to clean
up mqtt"
);
mqttInfo
(
"starting to cleanup mqtt"
);
free
(
recntStatus
.
user_name
);
free
(
recntStatus
.
user_name
);
free
(
recntStatus
.
password
);
free
(
recntStatus
.
password
);
free
(
recntStatus
.
hostname
);
free
(
recntStatus
.
hostname
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
af4b0224
...
@@ -68,6 +68,12 @@ static void vnodeInit() {
...
@@ -68,6 +68,12 @@ static void vnodeInit() {
}
}
}
}
void
vnodeCleanupResources
()
{
taosHashCleanup
(
tsDnodeVnodesHash
);
vnodeModuleInit
=
PTHREAD_ONCE_INIT
;
tsDnodeVnodesHash
=
NULL
;
}
int32_t
vnodeCreate
(
SMDCreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
vnodeCreate
(
SMDCreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
code
;
int32_t
code
;
pthread_once
(
&
vnodeModuleInit
,
vnodeInit
);
pthread_once
(
&
vnodeModuleInit
,
vnodeInit
);
...
@@ -362,12 +368,6 @@ void vnodeRelease(void *pVnodeRaw) {
...
@@ -362,12 +368,6 @@ void vnodeRelease(void *pVnodeRaw) {
int32_t
count
=
atomic_sub_fetch_32
(
&
tsOpennedVnodes
,
1
);
int32_t
count
=
atomic_sub_fetch_32
(
&
tsOpennedVnodes
,
1
);
vDebug
(
"vgId:%d, vnode is released, vnodes:%d"
,
vgId
,
count
);
vDebug
(
"vgId:%d, vnode is released, vnodes:%d"
,
vgId
,
count
);
if
(
count
<=
0
)
{
taosHashCleanup
(
tsDnodeVnodesHash
);
vnodeModuleInit
=
PTHREAD_ONCE_INIT
;
tsDnodeVnodesHash
=
NULL
;
}
}
}
void
*
vnodeGetVnode
(
int32_t
vgId
)
{
void
*
vnodeGetVnode
(
int32_t
vgId
)
{
...
@@ -433,6 +433,28 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) {
...
@@ -433,6 +433,28 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) {
pLoad
->
replica
=
pVnode
->
syncCfg
.
replica
;
pLoad
->
replica
=
pVnode
->
syncCfg
.
replica
;
}
}
int32_t
vnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
)
{
if
(
tsDnodeVnodesHash
==
NULL
)
return
TSDB_CODE_SUCCESS
;
SHashMutableIterator
*
pIter
=
taosHashCreateIter
(
tsDnodeVnodesHash
);
while
(
taosHashIterNext
(
pIter
))
{
SVnodeObj
**
pVnode
=
taosHashIterGet
(
pIter
);
if
(
pVnode
==
NULL
)
continue
;
if
(
*
pVnode
==
NULL
)
continue
;
(
*
numOfVnodes
)
++
;
if
(
*
numOfVnodes
>=
TSDB_MAX_VNODES
)
{
vError
(
"vgId:%d, too many open vnodes, exist:%d max:%d"
,
(
*
pVnode
)
->
vgId
,
*
numOfVnodes
,
TSDB_MAX_VNODES
);
continue
;
}
else
{
vnodeList
[
*
numOfVnodes
-
1
]
=
(
*
pVnode
)
->
vgId
;
}
}
taosHashDestroyIter
(
pIter
);
return
TSDB_CODE_SUCCESS
;
}
void
vnodeBuildStatusMsg
(
void
*
param
)
{
void
vnodeBuildStatusMsg
(
void
*
param
)
{
SDMStatusMsg
*
pStatus
=
param
;
SDMStatusMsg
*
pStatus
=
param
;
SHashMutableIterator
*
pIter
=
taosHashCreateIter
(
tsDnodeVnodesHash
);
SHashMutableIterator
*
pIter
=
taosHashCreateIter
(
tsDnodeVnodesHash
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录