Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c3dc290a
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看板
未验证
提交
c3dc290a
编写于
9月 13, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16817 from taosdata/fix/mnode
feat: database option 'tsdb_pagesize'
上级
e5da5802
9c6e8aad
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
37 addition
and
8 deletion
+37
-8
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/common/src/systable.c
source/common/src/systable.c
+2
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+6
-3
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+19
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+1
-0
source/dnode/vnode/src/vnd/vnodeCfg.c
source/dnode/vnode/src/vnd/vnodeCfg.c
+5
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
c3dc290a
...
...
@@ -1201,6 +1201,7 @@ typedef struct {
int16_t
sstTrigger
;
int16_t
hashPrefix
;
int16_t
hashSuffix
;
int32_t
tsdbPageSize
;
}
SCreateVnodeReq
;
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
...
...
source/common/src/systable.c
浏览文件 @
c3dc290a
...
...
@@ -102,9 +102,10 @@ static const SSysDbTableSchema userDBSchema[] = {
{.
name
=
"wal_retention_size"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
sysInfo
=
true
},
{.
name
=
"wal_roll_period"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
{.
name
=
"wal_segment_size"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
sysInfo
=
true
},
{.
name
=
"s
s
t_trigger"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
sysInfo
=
true
},
{.
name
=
"s
t
t_trigger"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
sysInfo
=
true
},
{.
name
=
"table_prefix"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
sysInfo
=
true
},
{.
name
=
"table_suffix"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
sysInfo
=
true
},
{.
name
=
"tsdb_pagesize"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
};
static
const
SSysDbTableSchema
userFuncSchema
[]
=
{
...
...
source/common/src/tmsg.c
浏览文件 @
c3dc290a
...
...
@@ -3782,6 +3782,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if
(
tEncodeI16
(
&
encoder
,
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pReq
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pReq
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
tsdbPageSize
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
...
...
@@ -3857,6 +3858,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
if
(
tDecodeI16
(
&
decoder
,
&
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pReq
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pReq
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
tsdbPageSize
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
c3dc290a
...
...
@@ -173,6 +173,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
pCfg
->
hashMethod
=
pCreate
->
hashMethod
;
pCfg
->
hashPrefix
=
pCreate
->
hashPrefix
;
pCfg
->
hashSuffix
=
pCreate
->
hashSuffix
;
pCfg
->
tsdbPageSize
=
pCreate
->
tsdbPageSize
*
1024
;
pCfg
->
standby
=
pCfg
->
standby
;
pCfg
->
syncCfg
.
myIndex
=
pCreate
->
selfIndex
;
...
...
@@ -222,9 +223,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
-
1
;
}
dInfo
(
"vgId:%d, start to create vnode, tsma:%d standby:%d cacheLast:%d cacheLastSize:%d sstTrigger:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
createReq
.
standby
,
createReq
.
cacheLast
,
createReq
.
cacheLastSize
,
createReq
.
sstTrigger
);
dInfo
(
"vgId:%d, start to create vnode, tsma:%d standby:%d cacheLast:%d cacheLastSize:%d sstTrigger:%d "
"tsdbPageSize:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
createReq
.
standby
,
createReq
.
cacheLast
,
createReq
.
cacheLastSize
,
createReq
.
sstTrigger
,
createReq
.
tsdbPageSize
);
dInfo
(
"vgId:%d, hashMethod:%d begin:%u end:%u prefix:%d surfix:%d"
,
createReq
.
vgId
,
createReq
.
hashMethod
,
createReq
.
hashBegin
,
createReq
.
hashEnd
,
createReq
.
hashPrefix
,
createReq
.
hashSuffix
);
vmGenerateVnodeCfg
(
&
createReq
,
&
vnodeCfg
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
c3dc290a
...
...
@@ -308,6 +308,7 @@ typedef struct {
int16_t
hashPrefix
;
int16_t
hashSuffix
;
int16_t
sstTrigger
;
int32_t
tsdbPageSize
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
int32_t
walRetentionPeriod
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
c3dc290a
...
...
@@ -31,7 +31,7 @@
#include "systable.h"
#define DB_VER_NUMBER 1
#define DB_RESERVE_SIZE 5
8
#define DB_RESERVE_SIZE 5
4
static
SSdbRaw
*
mndDbActionEncode
(
SDbObj
*
pDb
);
static
SSdbRow
*
mndDbActionDecode
(
SSdbRaw
*
pRaw
);
...
...
@@ -128,6 +128,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT16
(
pRaw
,
dataPos
,
pDb
->
cfg
.
sstTrigger
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pDb
->
cfg
.
hashPrefix
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pDb
->
cfg
.
hashSuffix
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
tsdbPageSize
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
...
...
@@ -214,10 +215,20 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
sstTrigger
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
hashPrefix
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
hashSuffix
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
tsdbPageSize
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
taosInitRWLatch
(
&
pDb
->
lock
);
if
(
pDb
->
cfg
.
tsdbPageSize
<=
TSDB_MIN_TSDB_PAGESIZE
)
{
mInfo
(
"db:%s, tsdbPageSize set from %d to default %d"
,
pDb
->
name
,
pDb
->
cfg
.
tsdbPageSize
,
TSDB_DEFAULT_TSDB_PAGESIZE
);
}
if
(
pDb
->
cfg
.
sstTrigger
<=
TSDB_MIN_STT_TRIGGER
)
{
mInfo
(
"db:%s, sstTrigger set from %d to default %d"
,
pDb
->
name
,
pDb
->
cfg
.
sstTrigger
,
TSDB_DEFAULT_SST_TRIGGER
);
}
terrno
=
0
;
_OVER:
...
...
@@ -262,6 +273,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
pOld
->
cfg
.
cacheLast
=
pNew
->
cfg
.
cacheLast
;
pOld
->
cfg
.
replications
=
pNew
->
cfg
.
replications
;
pOld
->
cfg
.
sstTrigger
=
pNew
->
cfg
.
sstTrigger
;
pOld
->
cfg
.
tsdbPageSize
=
pNew
->
cfg
.
tsdbPageSize
;
taosWUnLockLatch
(
&
pOld
->
lock
);
return
0
;
}
...
...
@@ -341,6 +353,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if
(
pCfg
->
sstTrigger
<
TSDB_MIN_STT_TRIGGER
||
pCfg
->
sstTrigger
>
TSDB_MAX_STT_TRIGGER
)
return
-
1
;
if
(
pCfg
->
hashPrefix
<
TSDB_MIN_HASH_PREFIX
||
pCfg
->
hashPrefix
>
TSDB_MAX_HASH_PREFIX
)
return
-
1
;
if
(
pCfg
->
hashSuffix
<
TSDB_MIN_HASH_SUFFIX
||
pCfg
->
hashSuffix
>
TSDB_MAX_HASH_SUFFIX
)
return
-
1
;
if
(
pCfg
->
tsdbPageSize
<
TSDB_MIN_TSDB_PAGESIZE
||
pCfg
->
tsdbPageSize
>
TSDB_MAX_TSDB_PAGESIZE
)
return
-
1
;
terrno
=
0
;
return
terrno
;
...
...
@@ -377,6 +390,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
sstTrigger
<=
0
)
pCfg
->
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
if
(
pCfg
->
hashPrefix
<
0
)
pCfg
->
hashPrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
if
(
pCfg
->
hashSuffix
<
0
)
pCfg
->
hashSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
if
(
pCfg
->
tsdbPageSize
<=
0
)
pCfg
->
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
;
}
static
int32_t
mndSetCreateDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
...
...
@@ -496,6 +510,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
.
sstTrigger
=
pCreate
->
sstTrigger
,
.
hashPrefix
=
pCreate
->
hashPrefix
,
.
hashSuffix
=
pCreate
->
hashSuffix
,
.
tsdbPageSize
=
pCreate
->
tsdbPageSize
,
};
dbObj
.
cfg
.
numOfRetensions
=
pCreate
->
numOfRetensions
;
...
...
@@ -1726,6 +1741,9 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
hashSuffix
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
tsdbPageSize
,
false
);
}
taosMemoryFree
(
buf
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
c3dc290a
...
...
@@ -237,6 +237,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
sstTrigger
=
pDb
->
cfg
.
sstTrigger
;
createReq
.
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
createReq
.
hashSuffix
=
pDb
->
cfg
.
hashSuffix
;
createReq
.
tsdbPageSize
=
pDb
->
cfg
.
tsdbPageSize
;
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
SReplica
*
pReplica
=
&
createReq
.
replicas
[
v
];
...
...
source/dnode/vnode/src/vnd/vnodeCfg.c
浏览文件 @
c3dc290a
...
...
@@ -115,6 +115,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashMethod"
,
pCfg
->
hashMethod
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashPrefix"
,
pCfg
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"hashSuffix"
,
pCfg
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"tsdbPageSize"
,
pCfg
->
tsdbPageSize
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"syncCfg.replicaNum"
,
pCfg
->
syncCfg
.
replicaNum
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"syncCfg.myIndex"
,
pCfg
->
syncCfg
.
myIndex
)
<
0
)
return
-
1
;
...
...
@@ -215,7 +216,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
tjsonGetNumberValue
(
pJson
,
"wal.level"
,
pCfg
->
walCfg
.
level
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"sstTrigger"
,
pCfg
->
sttTrigger
,
code
);
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
pCfg
->
sttTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
tjsonGetNumberValue
(
pJson
,
"hashBegin"
,
pCfg
->
hashBegin
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashEnd"
,
pCfg
->
hashEnd
,
code
);
...
...
@@ -223,9 +224,9 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
tjsonGetNumberValue
(
pJson
,
"hashMethod"
,
pCfg
->
hashMethod
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"hashPrefix"
,
pCfg
->
hashPrefix
,
code
);
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
pCfg
->
hashPrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
tjsonGetNumberValue
(
pJson
,
"hashSuffix"
,
pCfg
->
hashSuffix
,
code
);
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
pCfg
->
hashSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
tjsonGetNumberValue
(
pJson
,
"syncCfg.replicaNum"
,
pCfg
->
syncCfg
.
replicaNum
,
code
);
if
(
code
<
0
)
return
-
1
;
...
...
@@ -255,6 +256,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
}
tjsonGetNumberValue
(
pJson
,
"tsdbPageSize"
,
pCfg
->
tsdbPageSize
,
code
);
if
(
code
<
0
)
pCfg
->
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
*
1024
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录