Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aef124af
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
aef124af
编写于
12月 20, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 testing for create/drop vnode msg
上级
6c1e5acd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
150 addition
and
65 deletion
+150
-65
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+47
-27
source/dnode/mgmt/impl/test/sut/deploy.cpp
source/dnode/mgmt/impl/test/sut/deploy.cpp
+1
-1
source/dnode/mgmt/impl/test/vgroup/vgroup.cpp
source/dnode/mgmt/impl/test/vgroup/vgroup.cpp
+102
-37
未找到文件。
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
aef124af
...
@@ -87,8 +87,8 @@ static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SVnode
...
@@ -87,8 +87,8 @@ static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SVnode
static
SVnodeObj
*
dndAcquireVnode
(
SDnode
*
pDnode
,
int32_t
vgId
);
static
SVnodeObj
*
dndAcquireVnode
(
SDnode
*
pDnode
,
int32_t
vgId
);
static
void
dndReleaseVnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
);
static
void
dndReleaseVnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
);
static
int32_t
dnd
Create
Vnode
(
SDnode
*
pDnode
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
);
static
int32_t
dnd
Open
Vnode
(
SDnode
*
pDnode
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
);
static
void
dnd
Drop
Vnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
);
static
void
dnd
Close
Vnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
);
static
SVnodeObj
**
dndGetVnodesFromHash
(
SDnode
*
pDnode
,
int32_t
*
numOfVnodes
);
static
SVnodeObj
**
dndGetVnodesFromHash
(
SDnode
*
pDnode
,
int32_t
*
numOfVnodes
);
static
int32_t
dndGetVnodesFromFile
(
SDnode
*
pDnode
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
);
static
int32_t
dndGetVnodesFromFile
(
SDnode
*
pDnode
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
);
static
int32_t
dndWriteVnodesToFile
(
SDnode
*
pDnode
);
static
int32_t
dndWriteVnodesToFile
(
SDnode
*
pDnode
);
...
@@ -136,7 +136,7 @@ static void dndReleaseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
...
@@ -136,7 +136,7 @@ static void dndReleaseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
dTrace
(
"vgId:%d, release vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
dTrace
(
"vgId:%d, release vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
}
}
static
int32_t
dnd
Create
Vnode
(
SDnode
*
pDnode
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
)
{
static
int32_t
dnd
Open
Vnode
(
SDnode
*
pDnode
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
SVnodeObj
*
pVnode
=
calloc
(
1
,
sizeof
(
SVnodeObj
));
SVnodeObj
*
pVnode
=
calloc
(
1
,
sizeof
(
SVnodeObj
));
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
...
@@ -189,7 +189,7 @@ static int32_t dndCreateVnode(SDnode *pDnode, SWrapperCfg *pCfg, SVnode *pImpl)
...
@@ -189,7 +189,7 @@ static int32_t dndCreateVnode(SDnode *pDnode, SWrapperCfg *pCfg, SVnode *pImpl)
return
code
;
return
code
;
}
}
static
void
dnd
Drop
Vnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
)
{
static
void
dnd
Close
Vnode
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
taosWLockLatch
(
&
pMgmt
->
latch
);
taosWLockLatch
(
&
pMgmt
->
latch
);
taosHashRemove
(
pMgmt
->
hash
,
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
taosHashRemove
(
pMgmt
->
hash
,
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
...
@@ -297,26 +297,26 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SWrapperCfg **ppCfgs, int32_
...
@@ -297,26 +297,26 @@ static int32_t dndGetVnodesFromFile(SDnode *pDnode, SWrapperCfg **ppCfgs, int32_
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
SWrapperCfg
*
pCfg
=
&
pCfgs
[
i
];
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
cJSON
*
vgId
=
cJSON_GetObjectItem
(
vnode
,
"vgId"
);
if
(
!
vgId
||
vgId
->
type
!=
cJSON_
String
)
{
if
(
!
vgId
||
vgId
->
type
!=
cJSON_
Number
)
{
dError
(
"failed to read %s since vgId not found"
,
file
);
dError
(
"failed to read %s since vgId not found"
,
file
);
goto
PRASE_VNODE_OVER
;
goto
PRASE_VNODE_OVER
;
}
}
pCfg
->
vgId
=
atoi
(
vgId
->
valuestring
)
;
pCfg
->
vgId
=
vgId
->
valueint
;
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s/vnode%d"
,
pDnode
->
dir
.
vnodes
,
pCfg
->
vgId
);
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped"
);
cJSON
*
dropped
=
cJSON_GetObjectItem
(
vnode
,
"dropped"
);
if
(
!
dropped
||
dropped
->
type
!=
cJSON_
String
)
{
if
(
!
dropped
||
dropped
->
type
!=
cJSON_
Number
)
{
dError
(
"failed to read %s since dropped not found"
,
file
);
dError
(
"failed to read %s since dropped not found"
,
file
);
goto
PRASE_VNODE_OVER
;
goto
PRASE_VNODE_OVER
;
}
}
pCfg
->
dropped
=
atoi
(
dropped
->
valuestring
)
;
pCfg
->
dropped
=
dropped
->
valueint
;
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion"
);
cJSON
*
vgVersion
=
cJSON_GetObjectItem
(
vnode
,
"vgVersion"
);
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_
String
)
{
if
(
!
vgVersion
||
vgVersion
->
type
!=
cJSON_
Number
)
{
dError
(
"failed to read %s since vgVersion not found"
,
file
);
dError
(
"failed to read %s since vgVersion not found"
,
file
);
goto
PRASE_VNODE_OVER
;
goto
PRASE_VNODE_OVER
;
}
}
pCfg
->
vgVersion
=
atoi
(
vgVersion
->
valuestring
)
;
pCfg
->
vgVersion
=
vgVersion
->
valueint
;
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid"
);
cJSON
*
dbUid
=
cJSON_GetObjectItem
(
vnode
,
"dbUid"
);
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
if
(
!
dbUid
||
dbUid
->
type
!=
cJSON_String
)
{
...
@@ -358,28 +358,30 @@ static int32_t dndWriteVnodesToFile(SDnode *pDnode) {
...
@@ -358,28 +358,30 @@ static int32_t dndWriteVnodesToFile(SDnode *pDnode) {
dError
(
"failed to write %s since %s"
,
file
,
terrstr
());
dError
(
"failed to write %s since %s"
,
file
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
int32_t
numOfVnodes
=
0
;
int32_t
numOfVnodes
=
0
;
SVnodeObj
**
pVnodes
=
dndGetVnodesFromHash
(
pDnode
,
&
numOfVnodes
);
SVnodeObj
**
pVnodes
=
dndGetVnodesFromHash
(
pDnode
,
&
numOfVnodes
);
int32_t
len
=
0
;
int32_t
maxLen
=
65536
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vnodes
\"
: [
{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vnodes
\"
: [
\n
"
);
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgId
\"
:
\"
%d
\"
,
\n
"
,
pVnode
->
vgId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" {
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dropped
\"
:
\"
%d
\"
,
\n
"
,
pVnode
->
dropped
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgId
\"
: %d,
\n
"
,
pVnode
->
vgId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgVersion
\"
:
\"
%d
\"
,
\n
"
,
pVnode
->
vgVersion
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dropped
\"
: %d,
\n
"
,
pVnode
->
dropped
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dbUid
\"
:
\"
%"
PRIu64
"
\"
,
\n
"
,
pVnode
->
dbUid
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgVersion
\"
: %d,
\n
"
,
pVnode
->
vgVersion
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
db
\"
:
\"
%s
\"\n
"
,
pVnode
->
db
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dbUid
\"
:
\"
%"
PRIu64
"
\"
,
\n
"
,
pVnode
->
dbUid
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
db
\"
:
\"
%s
\"\n
"
,
pVnode
->
db
);
if
(
i
<
numOfVnodes
-
1
)
{
if
(
i
<
numOfVnodes
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
},{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
},
\n
"
);
}
else
{
}
else
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
}]
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
}
\n
"
);
}
}
}
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" ]
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fwrite
(
content
,
1
,
len
,
fp
);
...
@@ -422,7 +424,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
...
@@ -422,7 +424,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
failed
++
;
pThread
->
failed
++
;
}
else
{
}
else
{
dnd
Create
Vnode
(
pDnode
,
pCfg
,
pImpl
);
dnd
Open
Vnode
(
pDnode
,
pCfg
,
pImpl
);
dDebug
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
dDebug
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
opened
++
;
pThread
->
opened
++
;
}
}
...
@@ -507,7 +509,8 @@ static void dndCloseVnodes(SDnode *pDnode) {
...
@@ -507,7 +509,8 @@ static void dndCloseVnodes(SDnode *pDnode) {
SVnodeObj
**
pVnodes
=
dndGetVnodesFromHash
(
pDnode
,
&
numOfVnodes
);
SVnodeObj
**
pVnodes
=
dndGetVnodesFromHash
(
pDnode
,
&
numOfVnodes
);
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
dndDropVnode
(
pDnode
,
pVnodes
[
i
]);
dndReleaseVnode
(
pDnode
,
pVnodes
[
i
]);
dndCloseVnode
(
pDnode
,
pVnodes
[
i
]);
}
}
if
(
pVnodes
!=
NULL
)
{
if
(
pVnodes
!=
NULL
)
{
...
@@ -613,7 +616,7 @@ static int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
...
@@ -613,7 +616,7 @@ static int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
return
-
1
;
return
-
1
;
}
}
int32_t
code
=
dnd
Create
Vnode
(
pDnode
,
&
wrapperCfg
,
pImpl
);
int32_t
code
=
dnd
Open
Vnode
(
pDnode
,
&
wrapperCfg
,
pImpl
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
vnodeClose
(
pImpl
);
vnodeClose
(
pImpl
);
vnodeDestroy
(
wrapperCfg
.
path
);
vnodeDestroy
(
wrapperCfg
.
path
);
...
@@ -639,20 +642,36 @@ static int32_t dndProcessAlterVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
...
@@ -639,20 +642,36 @@ static int32_t dndProcessAlterVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
SVnodeCfg
vnodeCfg
=
{
0
};
SVnodeCfg
vnodeCfg
=
{
0
};
dndGenerateVnodeCfg
(
pAlter
,
&
vnodeCfg
);
dndGenerateVnodeCfg
(
pAlter
,
&
vnodeCfg
);
SWrapperCfg
wrapperCfg
=
{
0
};
dndGenerateWrapperCfg
(
pDnode
,
pAlter
,
&
wrapperCfg
);
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
pAlter
->
vgId
);
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
pAlter
->
vgId
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to alter vnode since %s"
,
pAlter
->
vgId
,
terrstr
());
dDebug
(
"vgId:%d, failed to alter vnode since %s"
,
pAlter
->
vgId
,
terrstr
());
return
terrno
;
return
terrno
;
}
}
if
(
wrapperCfg
.
vgVersion
==
pVnode
->
vgVersion
)
{
dndReleaseVnode
(
pDnode
,
pVnode
);
dDebug
(
"vgId:%d, no need to alter vnode cfg for version unchanged "
,
pAlter
->
vgId
);
return
0
;
}
if
(
vnodeAlter
(
pVnode
->
pImpl
,
&
vnodeCfg
)
!=
0
)
{
if
(
vnodeAlter
(
pVnode
->
pImpl
,
&
vnodeCfg
)
!=
0
)
{
dError
(
"vgId:%d, failed to alter vnode since %s"
,
pAlter
->
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to alter vnode since %s"
,
pAlter
->
vgId
,
terrstr
());
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
return
terrno
;
return
terrno
;
}
}
int32_t
oldVersion
=
pVnode
->
vgVersion
;
pVnode
->
vgVersion
=
wrapperCfg
.
vgVersion
;
int32_t
code
=
dndWriteVnodesToFile
(
pDnode
);
if
(
code
!=
0
)
{
pVnode
->
vgVersion
=
oldVersion
;
}
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
return
0
;
return
code
;
}
}
static
int32_t
dndProcessDropVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
rpcMsg
)
{
static
int32_t
dndProcessDropVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
rpcMsg
)
{
...
@@ -673,7 +692,8 @@ static int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
...
@@ -673,7 +692,8 @@ static int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
return
terrno
;
return
terrno
;
}
}
dndDropVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
dndCloseVnode
(
pDnode
,
pVnode
);
vnodeClose
(
pVnode
->
pImpl
);
vnodeClose
(
pVnode
->
pImpl
);
vnodeDestroy
(
pVnode
->
path
);
vnodeDestroy
(
pVnode
->
path
);
dndWriteVnodesToFile
(
pDnode
);
dndWriteVnodesToFile
(
pDnode
);
...
...
source/dnode/mgmt/impl/test/sut/deploy.cpp
浏览文件 @
aef124af
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "deploy.h"
#include "deploy.h"
void
initLog
(
const
char
*
path
)
{
void
initLog
(
const
char
*
path
)
{
dDebugFlag
=
143
;
dDebugFlag
=
207
;
vDebugFlag
=
0
;
vDebugFlag
=
0
;
mDebugFlag
=
207
;
mDebugFlag
=
207
;
cDebugFlag
=
0
;
cDebugFlag
=
0
;
...
...
source/dnode/mgmt/impl/test/vgroup/vgroup.cpp
浏览文件 @
aef124af
...
@@ -178,45 +178,110 @@ int32_t DndTestVgroup::connId;
...
@@ -178,45 +178,110 @@ int32_t DndTestVgroup::connId;
TEST_F
(
DndTestVgroup
,
01
_Create_Restart_Drop_Vnode
)
{
TEST_F
(
DndTestVgroup
,
01
_Create_Restart_Drop_Vnode
)
{
{
{
SCreateVnodeMsg
*
pReq
=
(
SCreateVnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateVnodeMsg
));
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
pReq
->
vgId
=
htonl
(
2
);
SCreateVnodeMsg
*
pReq
=
(
SCreateVnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateVnodeMsg
));
pReq
->
dnodeId
=
htonl
(
1
);
pReq
->
vgId
=
htonl
(
2
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
dnodeId
=
htonl
(
1
);
pReq
->
dbUid
=
htobe64
(
9527
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
vgVersion
=
htonl
(
1
);
pReq
->
dbUid
=
htobe64
(
9527
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
vgVersion
=
htonl
(
1
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
daysPerFile
=
htonl
(
10
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
daysToKeep0
=
htonl
(
3650
);
pReq
->
daysPerFile
=
htonl
(
10
);
pReq
->
daysToKeep1
=
htonl
(
3650
);
pReq
->
daysToKeep0
=
htonl
(
3650
);
pReq
->
daysToKeep2
=
htonl
(
3650
);
pReq
->
daysToKeep1
=
htonl
(
3650
);
pReq
->
minRows
=
htonl
(
100
);
pReq
->
daysToKeep2
=
htonl
(
3650
);
pReq
->
minRows
=
htonl
(
4096
);
pReq
->
minRows
=
htonl
(
100
);
pReq
->
commitTime
=
htonl
(
3600
);
pReq
->
minRows
=
htonl
(
4096
);
pReq
->
fsyncPeriod
=
htonl
(
3000
);
pReq
->
commitTime
=
htonl
(
3600
);
pReq
->
walLevel
=
1
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
pReq
->
precision
=
0
;
pReq
->
walLevel
=
1
;
pReq
->
compression
=
2
;
pReq
->
precision
=
0
;
pReq
->
replica
=
1
;
pReq
->
compression
=
2
;
pReq
->
quorum
=
1
;
pReq
->
replica
=
1
;
pReq
->
update
=
0
;
pReq
->
quorum
=
1
;
pReq
->
cacheLastRow
=
0
;
pReq
->
update
=
0
;
pReq
->
selfIndex
=
0
;
pReq
->
cacheLastRow
=
0
;
for
(
int
r
=
0
;
r
<
pReq
->
replica
;
++
r
)
{
pReq
->
selfIndex
=
0
;
SReplica
*
pReplica
=
&
pReq
->
replicas
[
r
];
for
(
int
r
=
0
;
r
<
pReq
->
replica
;
++
r
)
{
pReplica
->
id
=
htonl
(
1
);
SReplica
*
pReplica
=
&
pReq
->
replicas
[
r
];
pReplica
->
port
=
htons
(
9150
);
pReplica
->
id
=
htonl
(
1
);
pReplica
->
port
=
htons
(
9150
);
}
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateVnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_VNODE_IN
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
}
{
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
SAlterVnodeMsg
*
pReq
=
(
SAlterVnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterVnodeMsg
));
pReq
->
vgId
=
htonl
(
2
);
pReq
->
dnodeId
=
htonl
(
1
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
dbUid
=
htobe64
(
9527
);
pReq
->
vgVersion
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
daysPerFile
=
htonl
(
10
);
pReq
->
daysToKeep0
=
htonl
(
3650
);
pReq
->
daysToKeep1
=
htonl
(
3650
);
pReq
->
daysToKeep2
=
htonl
(
3650
);
pReq
->
minRows
=
htonl
(
100
);
pReq
->
minRows
=
htonl
(
4096
);
pReq
->
commitTime
=
htonl
(
3600
);
pReq
->
fsyncPeriod
=
htonl
(
3000
);
pReq
->
walLevel
=
1
;
pReq
->
precision
=
0
;
pReq
->
compression
=
2
;
pReq
->
replica
=
1
;
pReq
->
quorum
=
1
;
pReq
->
update
=
0
;
pReq
->
cacheLastRow
=
0
;
pReq
->
selfIndex
=
0
;
for
(
int
r
=
0
;
r
<
pReq
->
replica
;
++
r
)
{
SReplica
*
pReplica
=
&
pReq
->
replicas
[
r
];
pReplica
->
id
=
htonl
(
1
);
pReplica
->
port
=
htons
(
9150
);
}
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SAlterVnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_VNODE_IN
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
}
}
SRpcMsg
rpcMsg
=
{
0
};
{
rpcMsg
.
pCont
=
pReq
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
rpcMsg
.
contLen
=
sizeof
(
SCreateVnodeMsg
);
SDropVnodeMsg
*
pReq
=
(
SDropVnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SDropVnodeMsg
));
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_VNODE_IN
;
pReq
->
vgId
=
htonl
(
2
);
pReq
->
dnodeId
=
htonl
(
1
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
dbUid
=
htobe64
(
9527
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateVnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_VNODE_IN
;
sendMsg
(
pClient
,
&
rpcMsg
);
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
// taosMsleep(1000000);
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录