Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5e30641d
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看板
提交
5e30641d
编写于
12月 16, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ut test
上级
3ac8715c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
2 deletion
+51
-2
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+12
-1
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+39
-1
未找到文件。
source/libs/catalog/src/catalog.c
浏览文件 @
5e30641d
...
...
@@ -54,9 +54,20 @@ int32_t ctgGetDBVgroupFromMnode(struct SCatalog* pCatalog, void *pRpc, const SEp
return
code
;
}
char
*
pMsg
=
rpcMallocCont
(
msgLen
);
if
(
NULL
==
pMsg
)
{
ctgError
(
"rpc malloc %d failed"
,
msgLen
);
tfree
(
msg
);
return
TSDB_CODE_CTG_MEM_ERROR
;
}
memcpy
(
pMsg
,
msg
,
msgLen
);
tfree
(
msg
);
SRpcMsg
rpcMsg
=
{
.
msgType
=
TSDB_MSG_TYPE_USE_DB
,
.
pCont
=
m
sg
,
.
pCont
=
pM
sg
,
.
contLen
=
msgLen
,
};
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
5e30641d
...
...
@@ -28,6 +28,7 @@
#include "tvariant.h"
#include "catalog.h"
#include "tep.h"
#include "trpc.h"
typedef
struct
SAppInstInfo
{
int64_t
numOfConns
;
...
...
@@ -50,6 +51,41 @@ typedef struct STscObj {
namespace
{
void
sendCreateDbMsg
(
void
*
shandle
,
SEpSet
*
pEpSet
)
{
SCreateDbMsg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDbMsg
));
strcpy
(
pReq
->
db
,
"1.db1"
);
pReq
->
numOfVgroups
=
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
->
minRowsPerFileBlock
=
htonl
(
100
);
pReq
->
maxRowsPerFileBlock
=
htonl
(
4096
);
pReq
->
commitTime
=
htonl
(
3600
);
pReq
->
fsyncPeriod
=
htonl
(
3000
);
pReq
->
walLevel
=
1
;
pReq
->
precision
=
0
;
pReq
->
compression
=
2
;
pReq
->
replications
=
1
;
pReq
->
quorum
=
1
;
pReq
->
update
=
0
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateDbMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_DB
;
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
shandle
,
pEpSet
,
&
rpcMsg
,
&
rpcRsp
);
ASSERT_EQ
(
rpcRsp
.
code
,
0
);
}
}
TEST
(
testCase
,
normalCase
)
{
...
...
@@ -57,13 +93,15 @@ TEST(testCase, normalCase) {
assert
(
pConn
!=
NULL
);
char
*
clusterId
=
"cluster1"
;
char
*
dbname
=
"db1"
;
char
*
dbname
=
"
1.
db1"
;
char
*
tablename
=
"table1"
;
struct
SCatalog
*
pCtg
=
NULL
;
void
*
mockPointer
=
(
void
*
)
0x1
;
SVgroupInfo
vgInfo
=
{
0
};
msgInit
();
sendCreateDbMsg
(
pConn
->
pTransporter
,
&
pConn
->
pAppInfo
->
mgmtEp
.
epSet
);
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录