Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ee56c500
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee56c500
编写于
10月 09, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
823b1c3f
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
67 addition
and
53 deletion
+67
-53
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+3
-3
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-1
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+54
-48
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+8
-0
未找到文件。
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
ee56c500
...
...
@@ -631,7 +631,7 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
terrno
=
TSDB_CODE_MND_DB_OPTION_UNCHANGED
;
if
(
pAlter
->
buffer
>
0
&&
pAlter
->
buffer
!=
pDb
->
cfg
.
buffer
)
{
#if
1
#if
0
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
return terrno;
#else
...
...
@@ -641,7 +641,7 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
}
if
(
pAlter
->
pages
>
0
&&
pAlter
->
pages
!=
pDb
->
cfg
.
pages
)
{
#if
1
#if
0
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
return terrno;
#else
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
ee56c500
...
...
@@ -72,7 +72,7 @@ struct SVBufPool {
SVBufPoolNode
node
;
};
int32_t
vnodeOpenBufPool
(
SVnode
*
pVnode
,
int64_t
size
);
int32_t
vnodeOpenBufPool
(
SVnode
*
pVnode
);
int32_t
vnodeCloseBufPool
(
SVnode
*
pVnode
);
void
vnodeBufPoolReset
(
SVBufPool
*
pPool
);
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
ee56c500
...
...
@@ -16,20 +16,53 @@
#include "vnd.h"
/* ------------------------ STRUCTURES ------------------------ */
#define VNODE_BUFPOOL_SEGMENTS 3
static
int
vnodeBufPoolCreate
(
SVnode
*
pVnode
,
int64_t
size
,
SVBufPool
**
ppPool
);
static
int
vnodeBufPoolDestroy
(
SVBufPool
*
pPool
);
static
int
vnodeBufPoolCreate
(
SVnode
*
pVnode
,
int64_t
size
,
SVBufPool
**
ppPool
)
{
SVBufPool
*
pPool
;
pPool
=
taosMemoryMalloc
(
sizeof
(
SVBufPool
)
+
size
);
if
(
pPool
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
taosThreadSpinInit
(
&
pPool
->
lock
,
0
)
!=
0
)
{
taosMemoryFree
(
pPool
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pPool
->
next
=
NULL
;
pPool
->
pVnode
=
pVnode
;
pPool
->
nRef
=
0
;
pPool
->
size
=
0
;
pPool
->
ptr
=
pPool
->
node
.
data
;
pPool
->
pTail
=
&
pPool
->
node
;
pPool
->
node
.
prev
=
NULL
;
pPool
->
node
.
pnext
=
&
pPool
->
pTail
;
pPool
->
node
.
size
=
size
;
*
ppPool
=
pPool
;
return
0
;
}
static
int
vnodeBufPoolDestroy
(
SVBufPool
*
pPool
)
{
vnodeBufPoolReset
(
pPool
);
taosThreadSpinDestroy
(
&
pPool
->
lock
);
taosMemoryFree
(
pPool
);
return
0
;
}
int
vnodeOpenBufPool
(
SVnode
*
pVnode
,
int64_t
size
)
{
int
vnodeOpenBufPool
(
SVnode
*
pVnode
)
{
SVBufPool
*
pPool
=
NULL
;
int
ret
;
int
64_t
size
=
pVnode
->
config
.
szBuf
/
VNODE_BUFPOOL_SEGMENTS
;
ASSERT
(
pVnode
->
pPool
==
NULL
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
// create pool
ret
=
vnodeBufPoolCreate
(
pVnode
,
size
,
&
pPool
);
if
(
ret
<
0
)
{
if
(
vnodeBufPoolCreate
(
pVnode
,
size
,
&
pPool
))
{
vError
(
"vgId:%d, failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vnodeCloseBufPool
(
pVnode
);
return
-
1
;
...
...
@@ -41,7 +74,6 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
}
vDebug
(
"vgId:%d, vnode buffer pool is opened, size:%"
PRId64
,
TD_VID
(
pVnode
),
size
);
return
0
;
}
...
...
@@ -63,9 +95,7 @@ int vnodeCloseBufPool(SVnode *pVnode) {
}
void
vnodeBufPoolReset
(
SVBufPool
*
pPool
)
{
SVBufPoolNode
*
pNode
;
for
(
pNode
=
pPool
->
pTail
;
pNode
->
prev
;
pNode
=
pPool
->
pTail
)
{
for
(
SVBufPoolNode
*
pNode
=
pPool
->
pTail
;
pNode
->
prev
;
pNode
=
pPool
->
pTail
)
{
ASSERT
(
pNode
->
pnext
==
&
pPool
->
pTail
);
pNode
->
prev
->
pnext
=
&
pPool
->
pTail
;
pPool
->
pTail
=
pNode
->
prev
;
...
...
@@ -81,7 +111,7 @@ void vnodeBufPoolReset(SVBufPool *pPool) {
void
*
vnodeBufPoolMalloc
(
SVBufPool
*
pPool
,
int
size
)
{
SVBufPoolNode
*
pNode
;
void
*
p
;
void
*
p
=
NULL
;
taosThreadSpinLock
(
&
pPool
->
lock
);
if
(
pPool
->
node
.
size
>=
pPool
->
ptr
-
pPool
->
node
.
data
+
size
)
{
// allocate from the anchor node
...
...
@@ -124,43 +154,6 @@ void vnodeBufPoolFree(SVBufPool *pPool, void *p) {
}
}
// STATIC METHODS -------------------
static
int
vnodeBufPoolCreate
(
SVnode
*
pVnode
,
int64_t
size
,
SVBufPool
**
ppPool
)
{
SVBufPool
*
pPool
;
pPool
=
taosMemoryMalloc
(
sizeof
(
SVBufPool
)
+
size
);
if
(
pPool
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
taosThreadSpinInit
(
&
pPool
->
lock
,
0
)
!=
0
)
{
taosMemoryFree
(
pPool
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pPool
->
next
=
NULL
;
pPool
->
pVnode
=
pVnode
;
pPool
->
nRef
=
0
;
pPool
->
size
=
0
;
pPool
->
ptr
=
pPool
->
node
.
data
;
pPool
->
pTail
=
&
pPool
->
node
;
pPool
->
node
.
prev
=
NULL
;
pPool
->
node
.
pnext
=
&
pPool
->
pTail
;
pPool
->
node
.
size
=
size
;
*
ppPool
=
pPool
;
return
0
;
}
static
int
vnodeBufPoolDestroy
(
SVBufPool
*
pPool
)
{
vnodeBufPoolReset
(
pPool
);
taosThreadSpinDestroy
(
&
pPool
->
lock
);
taosMemoryFree
(
pPool
);
return
0
;
}
void
vnodeBufPoolRef
(
SVBufPool
*
pPool
)
{
int32_t
nRef
=
atomic_fetch_add_32
(
&
pPool
->
nRef
,
1
);
ASSERT
(
nRef
>
0
);
...
...
@@ -175,6 +168,19 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
taosThreadMutexLock
(
&
pVnode
->
mutex
);
int64_t
size
=
pVnode
->
config
.
szBuf
/
VNODE_BUFPOOL_SEGMENTS
;
if
(
pPool
->
node
.
size
!=
size
)
{
SVBufPool
*
pPoolT
=
NULL
;
if
(
vnodeBufPoolCreate
(
pVnode
,
size
,
&
pPoolT
)
<
0
)
{
vWarn
(
"vgId:%d try to change buf pools size from %"
PRId64
" to %"
PRId64
" since %s"
,
TD_VID
(
pVnode
),
pPool
->
node
.
size
,
size
,
tstrerror
(
errno
));
}
else
{
vnodeBufPoolDestroy
(
pPool
);
pPool
=
pPoolT
;
vDebug
(
"vgId:%d change buf pools size from %"
PRId64
" to %"
PRId64
,
TD_VID
(
pVnode
),
pPool
->
node
.
size
,
size
);
}
}
pPool
->
next
=
pVnode
->
pPool
;
pVnode
->
pPool
=
pPool
;
taosThreadCondSignal
(
&
pVnode
->
poolNotEmpty
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
ee56c500
...
...
@@ -96,7 +96,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
taosThreadCondInit
(
&
pVnode
->
poolNotEmpty
,
NULL
);
// open buffer pool
if
(
vnodeOpenBufPool
(
pVnode
,
pVnode
->
config
.
isHeap
?
0
:
pVnode
->
config
.
szBuf
/
3
)
<
0
)
{
if
(
vnodeOpenBufPool
(
pVnode
)
<
0
)
{
vError
(
"vgId:%d, failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
ee56c500
...
...
@@ -1040,6 +1040,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
tsdbCacheSetCapacity
(
pVnode
,
(
size_t
)
pVnode
->
config
.
cacheLastSize
*
1024
*
1024
);
}
if
(
pVnode
->
config
.
szBuf
!=
alterReq
.
buffer
*
1024LL
*
1024LL
)
{
pVnode
->
config
.
szBuf
=
alterReq
.
buffer
*
1024LL
*
1024LL
;
}
if
(
pVnode
->
config
.
szCache
!=
alterReq
.
pages
)
{
// TODO
}
if
(
pVnode
->
config
.
cacheLast
!=
alterReq
.
cacheLast
)
{
pVnode
->
config
.
cacheLast
=
alterReq
.
cacheLast
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录