Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58d819ee
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看板
提交
58d819ee
编写于
12月 15, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 add numOfVgroup to db object
上级
e5616887
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
32 addition
and
3 deletion
+32
-3
include/common/taosmsg.h
include/common/taosmsg.h
+1
-0
include/util/tdef.h
include/util/tdef.h
+3
-3
source/dnode/mgmt/impl/test/db/db.cpp
source/dnode/mgmt/impl/test/db/db.cpp
+1
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+10
-0
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+15
-0
未找到文件。
include/common/taosmsg.h
浏览文件 @
58d819ee
...
...
@@ -584,6 +584,7 @@ typedef struct SRetrieveTableRsp {
typedef
struct
{
char
db
[
TSDB_FULL_DB_NAME_LEN
];
int32_t
numOfVgroups
;
int32_t
cacheBlockSize
;
// MB
int32_t
totalBlocks
;
int32_t
daysPerFile
;
...
...
include/util/tdef.h
浏览文件 @
58d819ee
...
...
@@ -232,8 +232,8 @@ do { \
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MIN_VNODES 64
#define TSDB_MAX_VNODES 512
#define TSDB_MIN_VNODES_PER_DB
2
#define TSDB_MAX_VNODES_PER_DB
64
#define TSDB_MIN_VNODES_PER_DB
1
#define TSDB_MAX_VNODES_PER_DB
4096
#define TSDB_DNODE_ROLE_ANY 0
#define TSDB_DNODE_ROLE_MGMT 1
...
...
@@ -246,7 +246,7 @@ do { \
#define TSDB_RES_COL_ID (-5000)
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
#define TSDB_MIN_CACHE_BLOCK_SIZE 1
#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode
#define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16
...
...
source/dnode/mgmt/impl/test/db/db.cpp
浏览文件 @
58d819ee
...
...
@@ -208,6 +208,7 @@ TEST_F(DndTestDb, 02_CreateDb) {
{
SCreateDbMsg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
daysPerFile
=
htonl
(
10
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
58d819ee
...
...
@@ -208,6 +208,7 @@ typedef struct {
int64_t
updateTime
;
int64_t
uid
;
int32_t
version
;
int32_t
numOfVgroups
;
SDbCfg
cfg
;
}
SDbObj
;
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
58d819ee
...
...
@@ -26,6 +26,7 @@ int32_t mndInitVgroup(SMnode *pMnode);
void
mndCleanupVgroup
(
SMnode
*
pMnode
);
SVgObj
*
mndAcquireVgroup
(
SMnode
*
pMnode
,
int32_t
vgId
);
void
mndReleaseVgroup
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
);
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
58d819ee
...
...
@@ -20,6 +20,7 @@
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndVgroup.h"
#define TSDB_DB_VER_NUM 1
#define TSDB_DB_RESERVE_SIZE 64
...
...
@@ -75,6 +76,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pDb
->
updateTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pDb
->
uid
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
version
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
numOfVgroups
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
cacheBlockSize
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
totalBlocks
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysPerFile
)
...
...
@@ -119,6 +121,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
updateTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
uid
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
version
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
numOfVgroups
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
cfg
.
cacheBlockSize
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
cfg
.
totalBlocks
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pDb
->
cfg
.
daysPerFile
)
...
...
@@ -341,6 +344,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDbMsg *pCreat
dbObj
.
createdTime
=
taosGetTimestampMs
();
dbObj
.
updateTime
=
dbObj
.
createdTime
;
dbObj
.
uid
=
mndGenerateUid
(
dbObj
.
name
,
TSDB_FULL_DB_NAME_LEN
);
dbObj
.
numOfVgroups
=
pCreate
->
numOfVgroups
;
dbObj
.
cfg
=
(
SDbCfg
){.
cacheBlockSize
=
pCreate
->
cacheBlockSize
,
.
totalBlocks
=
pCreate
->
totalBlocks
,
.
daysPerFile
=
pCreate
->
daysPerFile
,
...
...
@@ -372,6 +376,11 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDbMsg *pCreat
return
-
1
;
}
if
(
mndAllocVgroup
(
pMnode
,
&
dbObj
)
!=
0
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
pMsg
->
rpcMsg
.
handle
);
if
(
pTrans
==
NULL
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
...
...
@@ -417,6 +426,7 @@ static int32_t mndProcessCreateDbMsg(SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateDbMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
numOfVgroups
=
htonl
(
pCreate
->
numOfVgroups
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
pCreate
->
totalBlocks
=
htonl
(
pCreate
->
totalBlocks
);
pCreate
->
daysPerFile
=
htonl
(
pCreate
->
daysPerFile
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
58d819ee
...
...
@@ -152,6 +152,21 @@ void mndReleaseVgroup(SMnode *pMnode, SVgObj *pVgroup) {
sdbRelease
(
pSdb
,
pVgroup
);
}
static
int32_t
mndGetDefaultVgroupSize
(
SMnode
*
pMnode
)
{
return
4
;
}
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
)
{
if
(
pDb
->
numOfVgroups
==
-
1
)
{
pDb
->
numOfVgroups
=
mndGetDefaultVgroupSize
(
pMnode
);
}
if
(
pDb
->
numOfVgroups
<
TSDB_MIN_VNODES_PER_DB
||
pDb
->
numOfVgroups
>
TSDB_MAX_VNODES_PER_DB
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
return
-
1
;
}
return
0
;
}
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录