Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d7fc732d
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
d7fc732d
编写于
2月 12, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
serailze db req
上级
1755559d
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
202 addition
and
199 deletion
+202
-199
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+55
-54
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+50
-46
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+25
-23
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+25
-23
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+46
-52
source/util/src/terror.c
source/util/src/terror.c
+1
-1
未找到文件。
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
d7fc732d
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndDb.h"
#include "mndDb.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndTrans.h"
...
@@ -452,53 +453,53 @@ CREATE_DB_OVER:
...
@@ -452,53 +453,53 @@ CREATE_DB_OVER:
static
int32_t
mndProcessCreateDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessCreateDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCreateDbReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
pCreate
->
numOfVgroups
=
htonl
(
pCreate
->
numOfVgroups
);
SUserObj
*
pUser
=
NULL
;
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
SCreateDbReq
createReq
=
{
0
};
pCreate
->
totalBlocks
=
htonl
(
pCreate
->
totalBlocks
);
pCreate
->
daysPerFile
=
htonl
(
pCreate
->
daysPerFile
);
if
(
tDeserializeSCreateDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
pCreate
->
daysToKeep0
=
htonl
(
pCreate
->
daysToKeep0
);
terrno
=
TSDB_CODE_INVALID_MSG
;
pCreate
->
daysToKeep1
=
htonl
(
pCreate
->
daysToKeep1
);
goto
CREATE_DB_OVER
;
pCreate
->
daysToKeep2
=
htonl
(
pCreate
->
daysToKeep2
);
}
pCreate
->
minRows
=
htonl
(
pCreate
->
minRows
);
pCreate
->
maxRows
=
htonl
(
pCreate
->
maxRows
);
mDebug
(
"db:%s, start to create, vgroups:%d"
,
createReq
.
db
,
createReq
.
numOfVgroups
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
fsyncPeriod
=
htonl
(
pCreate
->
fsyncPeriod
);
pDb
=
mndAcquireDb
(
pMnode
,
createReq
.
db
);
mDebug
(
"db:%s, start to create, vgroups:%d"
,
pCreate
->
db
,
pCreate
->
numOfVgroups
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
db
);
if
(
pDb
!=
NULL
)
{
if
(
pDb
!=
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
if
(
createReq
.
ignoreExist
)
{
if
(
pCreate
->
ignoreExist
)
{
mDebug
(
"db:%s, already exist, ignore exist is set"
,
createReq
.
db
);
mDebug
(
"db:%s, already exist, ignore exist is set"
,
pCreate
->
db
)
;
code
=
0
;
return
0
;
goto
CREATE_DB_OVER
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_MND_DB_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_DB_ALREADY_EXIST
;
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
goto
CREATE_DB_OVER
;
return
-
1
;
}
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_DB_NOT_EXIST
)
{
}
else
if
(
terrno
!=
TSDB_CODE_MND_DB_NOT_EXIST
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
goto
CREATE_DB_OVER
;
return
-
1
;
}
}
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pOperUser
==
NULL
)
{
if
(
pUser
==
NULL
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
goto
CREATE_DB_OVER
;
return
-
1
;
}
}
int32_t
code
=
mndCreateDb
(
pMnode
,
pReq
,
pCreate
,
pOperUser
);
if
(
mndCheckCreateDbAuth
(
pUser
)
!=
0
)
{
mndReleaseUser
(
pMnode
,
pOperUser
);
goto
CREATE_DB_OVER
;
}
if
(
code
!=
0
)
{
code
=
mndCreateDb
(
pMnode
,
pReq
,
&
createReq
,
pUser
);
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
return
-
1
;
CREATE_DB_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"db:%s, failed to create since %s"
,
createReq
.
db
,
terrstr
());
}
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
}
static
int32_t
mndSetDbCfgFromAlterDbReq
(
SDbObj
*
pDb
,
SAlterDbReq
*
pAlter
)
{
static
int32_t
mndSetDbCfgFromAlterDbReq
(
SDbObj
*
pDb
,
SAlterDbReq
*
pAlter
)
{
...
@@ -834,7 +835,7 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SVgroupInfo *vgLis
...
@@ -834,7 +835,7 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SVgroupInfo *vgLis
pInfo
->
epset
.
numOfEps
=
pVgroup
->
replica
;
pInfo
->
epset
.
numOfEps
=
pVgroup
->
replica
;
for
(
int32_t
gid
=
0
;
gid
<
pVgroup
->
replica
;
++
gid
)
{
for
(
int32_t
gid
=
0
;
gid
<
pVgroup
->
replica
;
++
gid
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SEp
*
pEp
=
&
pInfo
->
epset
.
eps
[
gid
];
SEp
*
pEp
=
&
pInfo
->
epset
.
eps
[
gid
];
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
if
(
pDnode
!=
NULL
)
{
if
(
pDnode
!=
NULL
)
{
memcpy
(
pEp
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
memcpy
(
pEp
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
...
...
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
d7fc732d
...
@@ -53,29 +53,31 @@ TEST_F(MndTestDb, 01_ShowDb) {
...
@@ -53,29 +53,31 @@ TEST_F(MndTestDb, 01_ShowDb) {
TEST_F
(
MndTestDb
,
02
_Create_Alter_Drop_Db
)
{
TEST_F
(
MndTestDb
,
02
_Create_Alter_Drop_Db
)
{
{
{
int32_t
contLen
=
sizeof
(
SCreateDbReq
);
SCreateDbReq
createReq
=
{
0
};
strcpy
(
createReq
.
db
,
"1.d1"
);
SCreateDbReq
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
createReq
.
numOfVgroups
=
2
;
strcpy
(
pReq
->
db
,
"1.d1"
);
createReq
.
cacheBlockSize
=
16
;
pReq
->
numOfVgroups
=
htonl
(
2
);
createReq
.
totalBlocks
=
10
;
pReq
->
cacheBlockSize
=
htonl
(
16
);
createReq
.
daysPerFile
=
10
;
pReq
->
totalBlocks
=
htonl
(
10
);
createReq
.
daysToKeep0
=
3650
;
pReq
->
daysPerFile
=
htonl
(
10
);
createReq
.
daysToKeep1
=
3650
;
pReq
->
daysToKeep0
=
htonl
(
3650
);
createReq
.
daysToKeep2
=
3650
;
pReq
->
daysToKeep1
=
htonl
(
3650
);
createReq
.
minRows
=
100
;
pReq
->
daysToKeep2
=
htonl
(
3650
);
createReq
.
maxRows
=
4096
;
pReq
->
minRows
=
htonl
(
100
);
createReq
.
commitTime
=
3600
;
pReq
->
maxRows
=
htonl
(
4096
);
createReq
.
fsyncPeriod
=
3000
;
pReq
->
commitTime
=
htonl
(
3600
);
createReq
.
walLevel
=
1
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
createReq
.
precision
=
0
;
pReq
->
walLevel
=
1
;
createReq
.
compression
=
2
;
pReq
->
precision
=
0
;
createReq
.
replications
=
1
;
pReq
->
compression
=
2
;
createReq
.
quorum
=
1
;
pReq
->
replications
=
1
;
createReq
.
update
=
0
;
pReq
->
quorum
=
1
;
createReq
.
cacheLastRow
=
0
;
pReq
->
update
=
0
;
createReq
.
ignoreExist
=
1
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDbReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
@@ -217,29 +219,31 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -217,29 +219,31 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
TEST_F
(
MndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
TEST_F
(
MndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
{
{
int32_t
contLen
=
sizeof
(
SCreateDbReq
);
SCreateDbReq
createReq
=
{
0
};
strcpy
(
createReq
.
db
,
"1.d2"
);
SCreateDbReq
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
createReq
.
numOfVgroups
=
2
;
strcpy
(
pReq
->
db
,
"1.d2"
);
createReq
.
cacheBlockSize
=
16
;
pReq
->
numOfVgroups
=
htonl
(
2
);
createReq
.
totalBlocks
=
10
;
pReq
->
cacheBlockSize
=
htonl
(
16
);
createReq
.
daysPerFile
=
10
;
pReq
->
totalBlocks
=
htonl
(
10
);
createReq
.
daysToKeep0
=
3650
;
pReq
->
daysPerFile
=
htonl
(
10
);
createReq
.
daysToKeep1
=
3650
;
pReq
->
daysToKeep0
=
htonl
(
3650
);
createReq
.
daysToKeep2
=
3650
;
pReq
->
daysToKeep1
=
htonl
(
3650
);
createReq
.
minRows
=
100
;
pReq
->
daysToKeep2
=
htonl
(
3650
);
createReq
.
maxRows
=
4096
;
pReq
->
minRows
=
htonl
(
100
);
createReq
.
commitTime
=
3600
;
pReq
->
maxRows
=
htonl
(
4096
);
createReq
.
fsyncPeriod
=
3000
;
pReq
->
commitTime
=
htonl
(
3600
);
createReq
.
walLevel
=
1
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
createReq
.
precision
=
0
;
pReq
->
walLevel
=
1
;
createReq
.
compression
=
2
;
pReq
->
precision
=
0
;
createReq
.
replications
=
1
;
pReq
->
compression
=
2
;
createReq
.
quorum
=
1
;
pReq
->
replications
=
1
;
createReq
.
update
=
0
;
pReq
->
quorum
=
1
;
createReq
.
cacheLastRow
=
0
;
pReq
->
update
=
0
;
createReq
.
ignoreExist
=
1
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDbReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
d7fc732d
...
@@ -38,29 +38,31 @@ class MndTestStb : public ::testing::Test {
...
@@ -38,29 +38,31 @@ class MndTestStb : public ::testing::Test {
Testbase
MndTestStb
::
test
;
Testbase
MndTestStb
::
test
;
void
*
MndTestStb
::
BuildCreateDbReq
(
const
char
*
dbname
,
int32_t
*
pContLen
)
{
void
*
MndTestStb
::
BuildCreateDbReq
(
const
char
*
dbname
,
int32_t
*
pContLen
)
{
int32_t
contLen
=
sizeof
(
SCreateDbReq
);
SCreateDbReq
createReq
=
{
0
};
strcpy
(
createReq
.
db
,
dbname
);
SCreateDbReq
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
createReq
.
numOfVgroups
=
2
;
strcpy
(
pReq
->
db
,
dbname
);
createReq
.
cacheBlockSize
=
16
;
pReq
->
numOfVgroups
=
htonl
(
2
);
createReq
.
totalBlocks
=
10
;
pReq
->
cacheBlockSize
=
htonl
(
16
);
createReq
.
daysPerFile
=
10
;
pReq
->
totalBlocks
=
htonl
(
10
);
createReq
.
daysToKeep0
=
3650
;
pReq
->
daysPerFile
=
htonl
(
10
);
createReq
.
daysToKeep1
=
3650
;
pReq
->
daysToKeep0
=
htonl
(
3650
);
createReq
.
daysToKeep2
=
3650
;
pReq
->
daysToKeep1
=
htonl
(
3650
);
createReq
.
minRows
=
100
;
pReq
->
daysToKeep2
=
htonl
(
3650
);
createReq
.
maxRows
=
4096
;
pReq
->
minRows
=
htonl
(
100
);
createReq
.
commitTime
=
3600
;
pReq
->
maxRows
=
htonl
(
4096
);
createReq
.
fsyncPeriod
=
3000
;
pReq
->
commitTime
=
htonl
(
3600
);
createReq
.
walLevel
=
1
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
createReq
.
precision
=
0
;
pReq
->
walLevel
=
1
;
createReq
.
compression
=
2
;
pReq
->
precision
=
0
;
createReq
.
replications
=
1
;
pReq
->
compression
=
2
;
createReq
.
quorum
=
1
;
pReq
->
replications
=
1
;
createReq
.
update
=
0
;
pReq
->
quorum
=
1
;
createReq
.
cacheLastRow
=
0
;
pReq
->
update
=
0
;
createReq
.
ignoreExist
=
1
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDbReq
(
pReq
,
contLen
,
&
createReq
);
*
pContLen
=
contLen
;
*
pContLen
=
contLen
;
return
pReq
;
return
pReq
;
...
...
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
d7fc732d
...
@@ -319,29 +319,31 @@ TEST_F(MndTestUser, 03_Alter_User) {
...
@@ -319,29 +319,31 @@ TEST_F(MndTestUser, 03_Alter_User) {
}
}
{
{
int32_t
contLen
=
sizeof
(
SCreateDbReq
);
SCreateDbReq
createReq
=
{
0
};
strcpy
(
createReq
.
db
,
"1.d2"
);
SCreateDbReq
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
createReq
.
numOfVgroups
=
2
;
strcpy
(
pReq
->
db
,
"1.d2"
);
createReq
.
cacheBlockSize
=
16
;
pReq
->
numOfVgroups
=
htonl
(
2
);
createReq
.
totalBlocks
=
10
;
pReq
->
cacheBlockSize
=
htonl
(
16
);
createReq
.
daysPerFile
=
10
;
pReq
->
totalBlocks
=
htonl
(
10
);
createReq
.
daysToKeep0
=
3650
;
pReq
->
daysPerFile
=
htonl
(
10
);
createReq
.
daysToKeep1
=
3650
;
pReq
->
daysToKeep0
=
htonl
(
3650
);
createReq
.
daysToKeep2
=
3650
;
pReq
->
daysToKeep1
=
htonl
(
3650
);
createReq
.
minRows
=
100
;
pReq
->
daysToKeep2
=
htonl
(
3650
);
createReq
.
maxRows
=
4096
;
pReq
->
minRows
=
htonl
(
100
);
createReq
.
commitTime
=
3600
;
pReq
->
maxRows
=
htonl
(
4096
);
createReq
.
fsyncPeriod
=
3000
;
pReq
->
commitTime
=
htonl
(
3600
);
createReq
.
walLevel
=
1
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
createReq
.
precision
=
0
;
pReq
->
walLevel
=
1
;
createReq
.
compression
=
2
;
pReq
->
precision
=
0
;
createReq
.
replications
=
1
;
pReq
->
compression
=
2
;
createReq
.
quorum
=
1
;
pReq
->
replications
=
1
;
createReq
.
update
=
0
;
pReq
->
quorum
=
1
;
createReq
.
cacheLastRow
=
0
;
pReq
->
update
=
0
;
createReq
.
ignoreExist
=
1
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDbReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DB
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
d7fc732d
...
@@ -39,7 +39,7 @@ namespace {
...
@@ -39,7 +39,7 @@ namespace {
extern
"C"
int32_t
ctgGetTableMetaFromCache
(
struct
SCatalog
*
pCatalog
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
extern
"C"
int32_t
ctgGetTableMetaFromCache
(
struct
SCatalog
*
pCatalog
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
*
exist
);
int32_t
*
exist
);
extern
"C"
int32_t
ctgUpdateTableMetaCache
(
struct
SCatalog
*
pCatalog
,
STableMetaOutput
*
output
);
extern
"C"
int32_t
ctgUpdateTableMetaCache
(
struct
SCatalog
*
pCatalog
,
STableMetaOutput
*
output
);
extern
"C"
int32_t
ctgDbgGetClusterCacheNum
(
struct
SCatalog
*
pCatalog
,
int32_t
type
);
extern
"C"
int32_t
ctgDbgGetClusterCacheNum
(
struct
SCatalog
*
pCatalog
,
int32_t
type
);
void
ctgTestSetPrepareTableMeta
();
void
ctgTestSetPrepareTableMeta
();
void
ctgTestSetPrepareCTableMeta
();
void
ctgTestSetPrepareCTableMeta
();
...
@@ -69,31 +69,35 @@ char *ctgTestCTablename = "ctable1";
...
@@ -69,31 +69,35 @@ char *ctgTestCTablename = "ctable1";
char
*
ctgTestSTablename
=
"stable1"
;
char
*
ctgTestSTablename
=
"stable1"
;
void
sendCreateDbMsg
(
void
*
shandle
,
SEpSet
*
pEpSet
)
{
void
sendCreateDbMsg
(
void
*
shandle
,
SEpSet
*
pEpSet
)
{
SCreateDbReq
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
sizeof
(
SCreateDbReq
));
SCreateDbReq
createReq
=
{
0
};
strcpy
(
pReq
->
db
,
"1.db1"
);
strcpy
(
createReq
.
db
,
"1.db1"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
createReq
.
numOfVgroups
=
2
;
pReq
->
cacheBlockSize
=
htonl
(
16
);
createReq
.
cacheBlockSize
=
16
;
pReq
->
totalBlocks
=
htonl
(
10
);
createReq
.
totalBlocks
=
10
;
pReq
->
daysPerFile
=
htonl
(
10
);
createReq
.
daysPerFile
=
10
;
pReq
->
daysToKeep0
=
htonl
(
3650
);
createReq
.
daysToKeep0
=
3650
;
pReq
->
daysToKeep1
=
htonl
(
3650
);
createReq
.
daysToKeep1
=
3650
;
pReq
->
daysToKeep2
=
htonl
(
3650
);
createReq
.
daysToKeep2
=
3650
;
pReq
->
minRows
=
htonl
(
100
);
createReq
.
minRows
=
100
;
pReq
->
maxRows
=
htonl
(
4096
);
createReq
.
maxRows
=
4096
;
pReq
->
commitTime
=
htonl
(
3600
);
createReq
.
commitTime
=
3600
;
pReq
->
fsyncPeriod
=
htonl
(
3000
);
createReq
.
fsyncPeriod
=
3000
;
pReq
->
walLevel
=
1
;
createReq
.
walLevel
=
1
;
pReq
->
precision
=
0
;
createReq
.
precision
=
0
;
pReq
->
compression
=
2
;
createReq
.
compression
=
2
;
pReq
->
replications
=
1
;
createReq
.
replications
=
1
;
pReq
->
quorum
=
1
;
createReq
.
quorum
=
1
;
pReq
->
update
=
0
;
createReq
.
update
=
0
;
pReq
->
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDbReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
rpcMsg
=
{
0
};
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateDbReq
)
;
rpcMsg
.
contLen
=
contLen
;
rpcMsg
.
msgType
=
TDMT_MND_CREATE_DB
;
rpcMsg
.
msgType
=
TDMT_MND_CREATE_DB
;
SRpcMsg
rpcRsp
=
{
0
};
SRpcMsg
rpcRsp
=
{
0
};
...
@@ -210,7 +214,6 @@ void ctgTestBuildDBVgroup(SDBVgroupInfo **pdbVgroup) {
...
@@ -210,7 +214,6 @@ void ctgTestBuildDBVgroup(SDBVgroupInfo **pdbVgroup) {
*
pdbVgroup
=
dbVgroup
;
*
pdbVgroup
=
dbVgroup
;
}
}
void
ctgTestBuildSTableMetaRsp
(
STableMetaRsp
*
rspMsg
)
{
void
ctgTestBuildSTableMetaRsp
(
STableMetaRsp
*
rspMsg
)
{
strcpy
(
rspMsg
->
dbFName
,
ctgTestDbname
);
strcpy
(
rspMsg
->
dbFName
,
ctgTestDbname
);
sprintf
(
rspMsg
->
tbName
,
"%s"
,
ctgTestSTablename
);
sprintf
(
rspMsg
->
tbName
,
"%s"
,
ctgTestSTablename
);
...
@@ -248,7 +251,6 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
...
@@ -248,7 +251,6 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
return
;
return
;
}
}
void
ctgTestPrepareDbVgroups
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
void
ctgTestPrepareDbVgroups
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
SUseDbRsp
*
rspMsg
=
NULL
;
// todo
SUseDbRsp
*
rspMsg
=
NULL
;
// todo
...
@@ -656,7 +658,6 @@ void *ctgTestSetSameDbVgroupThread(void *param) {
...
@@ -656,7 +658,6 @@ void *ctgTestSetSameDbVgroupThread(void *param) {
return
NULL
;
return
NULL
;
}
}
void
*
ctgTestSetDiffDbVgroupThread
(
void
*
param
)
{
void
*
ctgTestSetDiffDbVgroupThread
(
void
*
param
)
{
struct
SCatalog
*
pCtg
=
(
struct
SCatalog
*
)
param
;
struct
SCatalog
*
pCtg
=
(
struct
SCatalog
*
)
param
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -681,7 +682,6 @@ void *ctgTestSetDiffDbVgroupThread(void *param) {
...
@@ -681,7 +682,6 @@ void *ctgTestSetDiffDbVgroupThread(void *param) {
return
NULL
;
return
NULL
;
}
}
void
*
ctgTestGetCtableMetaThread
(
void
*
param
)
{
void
*
ctgTestGetCtableMetaThread
(
void
*
param
)
{
struct
SCatalog
*
pCtg
=
(
struct
SCatalog
*
)
param
;
struct
SCatalog
*
pCtg
=
(
struct
SCatalog
*
)
param
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -741,7 +741,6 @@ void *ctgTestSetCtableMetaThread(void *param) {
...
@@ -741,7 +741,6 @@ void *ctgTestSetCtableMetaThread(void *param) {
return
NULL
;
return
NULL
;
}
}
TEST
(
tableMeta
,
normalTable
)
{
TEST
(
tableMeta
,
normalTable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
struct
SCatalog
*
pCtg
=
NULL
;
void
*
mockPointer
=
(
void
*
)
0x1
;
void
*
mockPointer
=
(
void
*
)
0x1
;
...
@@ -1150,8 +1149,6 @@ TEST(tableMeta, updateStbMeta) {
...
@@ -1150,8 +1149,6 @@ TEST(tableMeta, updateStbMeta) {
catalogDestroy
();
catalogDestroy
();
}
}
TEST
(
tableDistVgroup
,
normalTable
)
{
TEST
(
tableDistVgroup
,
normalTable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
struct
SCatalog
*
pCtg
=
NULL
;
void
*
mockPointer
=
(
void
*
)
0x1
;
void
*
mockPointer
=
(
void
*
)
0x1
;
...
@@ -1418,8 +1415,6 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
...
@@ -1418,8 +1415,6 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
catalogDestroy
();
catalogDestroy
();
}
}
TEST
(
multiThread
,
ctableMeta
)
{
TEST
(
multiThread
,
ctableMeta
)
{
struct
SCatalog
*
pCtg
=
NULL
;
struct
SCatalog
*
pCtg
=
NULL
;
void
*
mockPointer
=
(
void
*
)
0x1
;
void
*
mockPointer
=
(
void
*
)
0x1
;
...
@@ -1470,8 +1465,6 @@ TEST(multiThread, ctableMeta) {
...
@@ -1470,8 +1465,6 @@ TEST(multiThread, ctableMeta) {
catalogDestroy
();
catalogDestroy
();
}
}
TEST
(
rentTest
,
allRent
)
{
TEST
(
rentTest
,
allRent
)
{
struct
SCatalog
*
pCtg
=
NULL
;
struct
SCatalog
*
pCtg
=
NULL
;
void
*
mockPointer
=
(
void
*
)
0x1
;
void
*
mockPointer
=
(
void
*
)
0x1
;
...
@@ -1530,7 +1523,8 @@ TEST(rentTest, allRent) {
...
@@ -1530,7 +1523,8 @@ TEST(rentTest, allRent) {
printf
(
"%d - expired stableNum:%d
\n
"
,
i
,
num
);
printf
(
"%d - expired stableNum:%d
\n
"
,
i
,
num
);
if
(
stable
)
{
if
(
stable
)
{
for
(
int32_t
n
=
0
;
n
<
num
;
++
n
)
{
for
(
int32_t
n
=
0
;
n
<
num
;
++
n
)
{
printf
(
"suid:%"
PRId64
", dbFName:%s, stbName:%s, sversion:%d, tversion:%d
\n
"
,
stable
[
n
].
suid
,
stable
[
n
].
dbFName
,
stable
[
n
].
stbName
,
stable
[
n
].
sversion
,
stable
[
n
].
tversion
);
printf
(
"suid:%"
PRId64
", dbFName:%s, stbName:%s, sversion:%d, tversion:%d
\n
"
,
stable
[
n
].
suid
,
stable
[
n
].
dbFName
,
stable
[
n
].
stbName
,
stable
[
n
].
sversion
,
stable
[
n
].
tversion
);
}
}
free
(
stable
);
free
(
stable
);
stable
=
NULL
;
stable
=
NULL
;
...
...
source/util/src/terror.c
浏览文件 @
d7fc732d
...
@@ -77,7 +77,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
...
@@ -77,7 +77,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MEMORY_CORRUPTED
,
"Memory corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MEMORY_CORRUPTED
,
"Memory corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FILE_CORRUPTED
,
"Data file corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FILE_CORRUPTED
,
"Data file corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CHECKSUM_ERROR
,
"Checksum error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CHECKSUM_ERROR
,
"Checksum error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG
,
"Invalid
config
message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG
,
"Invalid message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PARA
,
"Invalid parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PARA
,
"Invalid parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REPEAT_INIT
,
"Repeat initialization"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REPEAT_INIT
,
"Repeat initialization"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录