Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e710802f
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看板
提交
e710802f
编写于
1月 05, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
fef89768
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
38 addition
and
35 deletion
+38
-35
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+14
-7
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+18
-22
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+4
-4
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
e710802f
...
...
@@ -61,7 +61,7 @@ struct SVBufPoolNode {
};
struct
SVBufPool
{
SVBufPool
*
n
ext
;
SVBufPool
*
freeN
ext
;
SVnode
*
pVnode
;
TdThreadSpinlock
*
lock
;
volatile
int32_t
nRef
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
e710802f
...
...
@@ -87,6 +87,8 @@ typedef struct SCommitInfo SCommitInfo;
#define VNODE_RSMA1_DIR "rsma1"
#define VNODE_RSMA2_DIR "rsma2"
#define VNODE_BUFPOOL_SEGMENTS 3
#define VND_INFO_FNAME "vnode.json"
// vnd.h
...
...
@@ -332,10 +334,15 @@ struct SVnode {
SVStatis
statis
;
STfs
*
pTfs
;
SMsgCb
msgCb
;
// Buffer Pool
TdThreadMutex
mutex
;
TdThreadCond
poolNotEmpty
;
SVBufPool
*
pPool
;
SVBufPool
*
aBufPool
[
VNODE_BUFPOOL_SEGMENTS
];
SVBufPool
*
freeList
;
SVBufPool
*
inUse
;
SVBufPool
*
recycling
;
SMeta
*
pMeta
;
SSma
*
pSma
;
STsdb
*
pTsdb
;
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
e710802f
...
...
@@ -16,8 +16,6 @@
#include "vnd.h"
/* ------------------------ STRUCTURES ------------------------ */
#define VNODE_BUFPOOL_SEGMENTS 3
static
int
vnodeBufPoolCreate
(
SVnode
*
pVnode
,
int64_t
size
,
SVBufPool
**
ppPool
)
{
SVBufPool
*
pPool
;
...
...
@@ -44,7 +42,7 @@ static int vnodeBufPoolCreate(SVnode *pVnode, int64_t size, SVBufPool **ppPool)
pPool
->
lock
=
NULL
;
}
pPool
->
n
ext
=
NULL
;
pPool
->
freeN
ext
=
NULL
;
pPool
->
pVnode
=
pVnode
;
pPool
->
nRef
=
0
;
pPool
->
size
=
0
;
...
...
@@ -69,22 +67,21 @@ static int vnodeBufPoolDestroy(SVBufPool *pPool) {
}
int
vnodeOpenBufPool
(
SVnode
*
pVnode
)
{
SVBufPool
*
pPool
=
NULL
;
int64_t
size
=
pVnode
->
config
.
szBuf
/
VNODE_BUFPOOL_SEGMENTS
;
ASSERT
(
pVnode
->
pPool
==
NULL
);
ASSERT
(
pVnode
->
freeList
==
NULL
);
for
(
int
i
=
0
;
i
<
VNODE_BUFPOOL_SEGMENTS
;
i
++
)
{
// create pool
if
(
vnodeBufPoolCreate
(
pVnode
,
size
,
&
p
Pool
))
{
if
(
vnodeBufPoolCreate
(
pVnode
,
size
,
&
p
Vnode
->
aBufPool
[
i
]
))
{
vError
(
"vgId:%d, failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vnodeCloseBufPool
(
pVnode
);
return
-
1
;
}
// add
pool to vnode
p
Pool
->
next
=
pVnode
->
pPool
;
pVnode
->
pPool
=
pPool
;
// add
to free list
p
Vnode
->
aBufPool
[
i
]
->
freeNext
=
pVnode
->
freeList
;
pVnode
->
freeList
=
pVnode
->
aBufPool
[
i
]
;
}
vDebug
(
"vgId:%d, vnode buffer pool is opened, size:%"
PRId64
,
TD_VID
(
pVnode
),
size
);
...
...
@@ -92,19 +89,18 @@ int vnodeOpenBufPool(SVnode *pVnode) {
}
int
vnodeCloseBufPool
(
SVnode
*
pVnode
)
{
SVBufPool
*
pPool
;
for
(
pPool
=
pVnode
->
pPool
;
pPool
;
pPool
=
pVnode
->
pPool
)
{
pVnode
->
pPool
=
pPool
->
next
;
vnodeBufPoolDestroy
(
pPool
);
for
(
int32_t
i
=
0
;
i
<
VNODE_BUFPOOL_SEGMENTS
;
i
++
)
{
if
(
pVnode
->
aBufPool
[
i
])
{
vnodeBufPoolDestroy
(
pVnode
->
aBufPool
[
i
]);
pVnode
->
aBufPool
[
i
]
=
NULL
;
}
if
(
pVnode
->
inUse
)
{
vnodeBufPoolDestroy
(
pVnode
->
inUse
);
pVnode
->
inUse
=
NULL
;
}
vDebug
(
"vgId:%d, vnode buffer pool is closed"
,
TD_VID
(
pVnode
));
pVnode
->
freeList
=
NULL
;
ASSERT
(
pVnode
->
inUse
==
NULL
);
ASSERT
(
pVnode
->
recycling
==
NULL
);
vDebug
(
"vgId:%d, vnode buffer pool is closed"
,
TD_VID
(
pVnode
));
return
0
;
}
...
...
@@ -240,8 +236,8 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
}
}
pPool
->
next
=
pVnode
->
pPool
;
pVnode
->
pPool
=
pPool
;
pPool
->
freeNext
=
pVnode
->
freeList
;
pVnode
->
freeList
=
pPool
;
taosThreadCondSignal
(
&
pVnode
->
poolNotEmpty
);
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
e710802f
...
...
@@ -25,14 +25,14 @@ int vnodeBegin(SVnode *pVnode) {
// alloc buffer pool
taosThreadMutexLock
(
&
pVnode
->
mutex
);
while
(
pVnode
->
pPool
==
NULL
)
{
while
(
pVnode
->
freeList
==
NULL
)
{
taosThreadCondWait
(
&
pVnode
->
poolNotEmpty
,
&
pVnode
->
mutex
);
}
pVnode
->
inUse
=
pVnode
->
pPool
;
pVnode
->
inUse
=
pVnode
->
freeList
;
pVnode
->
inUse
->
nRef
=
1
;
pVnode
->
pPool
=
pVnode
->
inUse
->
n
ext
;
pVnode
->
inUse
->
n
ext
=
NULL
;
pVnode
->
freeList
=
pVnode
->
inUse
->
freeN
ext
;
pVnode
->
inUse
->
freeN
ext
=
NULL
;
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
e710802f
...
...
@@ -238,7 +238,7 @@ _err:
if
(
pVnode
->
pTsdb
)
tsdbClose
(
&
pVnode
->
pTsdb
);
if
(
pVnode
->
pSma
)
smaClose
(
pVnode
->
pSma
);
if
(
pVnode
->
pMeta
)
metaClose
(
pVnode
->
pMeta
);
if
(
pVnode
->
pPool
)
vnodeCloseBufPool
(
pVnode
);
if
(
pVnode
->
freeList
)
vnodeCloseBufPool
(
pVnode
);
tsem_destroy
(
&
(
pVnode
->
canCommit
));
taosMemoryFree
(
pVnode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录