Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
caeab780
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
caeab780
编写于
1月 09, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dnode restart error while vnode size is 0
上级
95347ff6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
55 deletion
+66
-55
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+53
-52
source/dnode/mgmt/impl/test/vnode/vnode.cpp
source/dnode/mgmt/impl/test/vnode/vnode.cpp
+13
-3
未找到文件。
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
caeab780
...
...
@@ -165,6 +165,8 @@ static void dndCloseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
vnodeClose
(
pVnode
->
pImpl
);
pVnode
->
pImpl
=
NULL
;
dDebug
(
"vgId:%d, vnode is closed"
,
pVnode
->
vgId
);
free
(
pVnode
->
path
);
free
(
pVnode
->
db
);
free
(
pVnode
);
...
...
@@ -238,59 +240,57 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SWrapperCfg **ppCfgs, int32_
}
int32_t
vnodesNum
=
cJSON_GetArraySize
(
vnodes
);
if
(
vnodesNum
<=
0
)
{
dError
(
"failed to read %s since vnodes size:%d invalid"
,
file
,
vnodesNum
);
goto
PRASE_VNODE_OVER
;
}
if
(
vnodesNum
>
0
)
{
pCfgs
=
calloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
if
(
pCfgs
==
NULL
)
{
dError
(
"failed to read %s since out of memory"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfgs
=
calloc
(
vnodesNum
,
sizeof
(
SWrapperCfg
));
if
(
pCfgs
==
NULL
)
{
dError
(
"failed to read %s since out of memory"
,
file
);
goto
PRASE_VNODE_OVER
;
}
for
(
int32_t
i
=
0
;
i
<
vnodesNum
;
++
i
)
{
cJSON
*
vnode
=
cJSON_GetArrayItem
(
vnodes
,
i
);
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
for
(
int32_t
i
=
0
;
i
<
vnodesNum
;
++
i
)
{
cJSON
*
vnode
=
cJSON_GetArrayItem
(
vnodes
,
i
);
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
if
(
!
vgId
||
vgId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgId not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgId
=
vgId
->
valueint
;
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
if
(
!
vgId
||
vgId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgId not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgId
=
vgId
->
valueint
;
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since dropped not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dropped
=
dropped
->
valueint
;
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped
"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since dropped
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dropped
=
dropped
->
valueint
;
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion
"
);
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgVersion
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgVersion
=
vgVersion
->
valueint
;
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion
"
);
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read %s since vgVersion
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
vgVersion
=
vgVersion
->
valueint
;
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid
"
);
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since dbUid
not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
pCfg
->
dbUid
=
atoll
(
dbUid
->
valuestring
)
;
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid"
);
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since dbUid not found"
,
file
);
goto
PRASE_VNODE_OVER
;
cJSON
*
db
=
cJSON_GetObjectItem
(
vnode
,
"db"
);
if
(
!
db
||
db
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since db not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
tstrncpy
(
pCfg
->
db
,
db
->
valuestring
,
TSDB_DB_FNAME_LEN
);
}
pCfg
->
dbUid
=
atoll
(
dbUid
->
valuestring
);
cJSON
*
db
=
cJSON_GetObjectItem
(
vnode
,
"db"
);
if
(
!
db
||
db
->
type
!=
cJSON_String
)
{
dError
(
"failed to read %s since db not found"
,
file
);
goto
PRASE_VNODE_OVER
;
}
tstrncpy
(
pCfg
->
db
,
db
->
valuestring
,
TSDB_DB_FNAME_LEN
);
*
ppCfgs
=
pCfgs
;
}
*
ppCfgs
=
pCfgs
;
*
numOfVnodes
=
vnodesNum
;
code
=
0
;
dInfo
(
"succcessed to read file %s"
,
file
);
...
...
@@ -548,13 +548,13 @@ static void dndGenerateWrapperCfg(SDnode *pDnode, SCreateVnodeReq *pCreate, SWra
pCfg
->
vgVersion
=
pCreate
->
vgVersion
;
}
static
SDropVnodeReq
*
vnode
ParseDropVnodeReq
(
SRpcMsg
*
pReq
)
{
static
SDropVnodeReq
*
dnd
ParseDropVnodeReq
(
SRpcMsg
*
pReq
)
{
SDropVnodeReq
*
pDrop
=
pReq
->
pCont
;
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
return
pDrop
;
}
static
SAuthVnodeReq
*
vnode
ParseAuthVnodeReq
(
SRpcMsg
*
pReq
)
{
static
SAuthVnodeReq
*
dnd
ParseAuthVnodeReq
(
SRpcMsg
*
pReq
)
{
SAuthVnodeReq
*
pAuth
=
pReq
->
pCont
;
pAuth
->
vgId
=
htonl
(
pAuth
->
vgId
);
return
pAuth
;
...
...
@@ -572,10 +572,10 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
pCreate
->
vgId
);
if
(
pVnode
!=
NULL
)
{
dDebug
(
"vgId:%d, already exist
, return success
"
,
pCreate
->
vgId
);
dDebug
(
"vgId:%d, already exist"
,
pCreate
->
vgId
);
dndReleaseVnode
(
pDnode
,
pVnode
);
terrno
=
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
;
return
0
;
return
-
1
;
}
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
&
vnodeCfg
);
...
...
@@ -641,7 +641,7 @@ int32_t dndProcessAlterVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessDropVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDropVnodeReq
*
pDrop
=
vnode
ParseDropVnodeReq
(
pReq
);
SDropVnodeReq
*
pDrop
=
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pDrop
->
vgId
;
dDebug
(
"vgId:%d, drop vnode req is received"
,
vgId
);
...
...
@@ -649,7 +649,8 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
return
0
;
terrno
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
return
-
1
;
}
pVnode
->
dropped
=
1
;
...
...
@@ -668,7 +669,7 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessAuthVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SAuthVnodeReq
*
pAuth
=
(
SAuthVnodeReq
*
)
vnode
ParseAuthVnodeReq
(
pReq
);
SAuthVnodeReq
*
pAuth
=
(
SAuthVnodeReq
*
)
dnd
ParseAuthVnodeReq
(
pReq
);
int32_t
vgId
=
pAuth
->
vgId
;
dDebug
(
"vgId:%d, auth vnode req is received"
,
vgId
);
...
...
@@ -685,7 +686,7 @@ int32_t dndProcessAuthVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SSyncVnodeReq
*
pSync
=
(
SSyncVnodeReq
*
)
vnode
ParseDropVnodeReq
(
pReq
);
SSyncVnodeReq
*
pSync
=
(
SSyncVnodeReq
*
)
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pSync
->
vgId
;
dDebug
(
"vgId:%d, sync vnode req is received"
,
vgId
);
...
...
@@ -707,7 +708,7 @@ int32_t dndProcessSyncVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
int32_t
dndProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SCompactVnodeReq
*
pCompact
=
(
SCompactVnodeReq
*
)
vnode
ParseDropVnodeReq
(
pReq
);
SCompactVnodeReq
*
pCompact
=
(
SCompactVnodeReq
*
)
dnd
ParseDropVnodeReq
(
pReq
);
int32_t
vgId
=
pCompact
->
vgId
;
dDebug
(
"vgId:%d, compact vnode req is received"
,
vgId
);
...
...
source/dnode/mgmt/impl/test/vnode/vnode.cpp
浏览文件 @
caeab780
/**
* @file db.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module v
group-msg
tests
* @brief DNODE module v
node
tests
* @version 0.1
* @date 2021-12-20
*
...
...
@@ -62,7 +62,12 @@ TEST_F(DndTestVnode, 01_Create_Restart_Drop_Vnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_VNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
if
(
i
==
0
)
{
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
);
}
}
}
...
...
@@ -123,7 +128,12 @@ TEST_F(DndTestVnode, 01_Create_Restart_Drop_Vnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_VNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
if
(
i
==
0
)
{
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录