Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ed06d822
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看板
提交
ed06d822
编写于
1月 20, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact
上级
a00243ca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
21 deletion
+21
-21
source/libs/tdb/src/db/tdb_mpool.c
source/libs/tdb/src/db/tdb_mpool.c
+4
-4
source/libs/tdb/src/inc/tdb_inc.h
source/libs/tdb/src/inc/tdb_inc.h
+1
-0
source/libs/tdb/src/inc/tdb_mpool.h
source/libs/tdb/src/inc/tdb_mpool.h
+16
-17
未找到文件。
source/libs/tdb/src/db/tdb_mpool.c
浏览文件 @
ed06d822
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgsize_t
pgsize
)
{
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgsize_t
pgsize
)
{
TDB_MPOOL
*
mp
;
TDB_MPOOL
*
mp
;
size_t
tsize
;
size_t
tsize
;
MP_PAGE
*
pagep
;
pg_t
*
pagep
;
// check parameters
// check parameters
if
(
!
TDB_IS_PGSIZE_VLD
(
pgsize
))
{
if
(
!
TDB_IS_PGSIZE_VLD
(
pgsize
))
{
...
@@ -37,7 +37,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
...
@@ -37,7 +37,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
mp
->
cachesize
=
cachesize
;
mp
->
cachesize
=
cachesize
;
mp
->
pgsize
=
pgsize
;
mp
->
pgsize
=
pgsize
;
mp
->
npages
=
cachesize
/
pgsize
;
mp
->
npages
=
cachesize
/
pgsize
;
mp
->
pages
=
(
MP_PAGE
*
)
calloc
(
mp
->
npages
,
MP_PAGE_SIZE
(
pgsize
));
mp
->
pages
=
(
pg_t
*
)
calloc
(
mp
->
npages
,
MP_PAGE_SIZE
(
pgsize
));
if
(
mp
->
pages
==
NULL
)
{
if
(
mp
->
pages
==
NULL
)
{
tdbError
(
"failed to malloc memory pool pages"
);
tdbError
(
"failed to malloc memory pool pages"
);
free
(
mp
);
free
(
mp
);
...
@@ -47,7 +47,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
...
@@ -47,7 +47,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
TD_DLIST_INIT
(
&
(
mp
->
freeList
));
TD_DLIST_INIT
(
&
(
mp
->
freeList
));
mp
->
nbucket
=
mp
->
npages
;
mp
->
nbucket
=
mp
->
npages
;
mp
->
hashtab
=
(
MP_PAGE_LIST
*
)
calloc
(
mp
->
nbucket
,
sizeof
(
MP_PAGE_LIST
));
mp
->
hashtab
=
(
pg_list_t
*
)
calloc
(
mp
->
nbucket
,
sizeof
(
pg_list_t
));
if
(
mp
->
hashtab
==
NULL
)
{
if
(
mp
->
hashtab
==
NULL
)
{
tdbError
(
"failed to malloc memory pool hash table"
);
tdbError
(
"failed to malloc memory pool hash table"
);
free
(
mp
->
pages
);
free
(
mp
->
pages
);
...
@@ -56,7 +56,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
...
@@ -56,7 +56,7 @@ int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
}
}
for
(
int
i
=
0
;
i
<
mp
->
npages
;
i
++
)
{
for
(
int
i
=
0
;
i
<
mp
->
npages
;
i
++
)
{
pagep
=
(
MP_PAGE
*
)
MP_PAGE_AT
(
mp
,
i
);
pagep
=
(
pg_t
*
)
MP_PAGE_AT
(
mp
,
i
);
TD_DLIST_APPEND
(
&
mp
->
freeList
,
pagep
);
TD_DLIST_APPEND
(
&
mp
->
freeList
,
pagep
);
}
}
...
...
source/libs/tdb/src/inc/tdb_inc.h
浏览文件 @
ed06d822
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "os.h"
#include "os.h"
#include "tlist.h"
#include "tlist.h"
#include "tlockfree.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
source/libs/tdb/src/inc/tdb_mpool.h
浏览文件 @
ed06d822
...
@@ -26,28 +26,27 @@ extern "C" {
...
@@ -26,28 +26,27 @@ extern "C" {
typedef
struct
TDB_MPOOL
TDB_MPOOL
;
typedef
struct
TDB_MPOOL
TDB_MPOOL
;
typedef
struct
TDB_MPFILE
TDB_MPFILE
;
typedef
struct
TDB_MPFILE
TDB_MPFILE
;
typedef
struct
MP_PAGE
{
typedef
struct
pg_t
{
// SRWLatch rwLatch;
SRWLatch
rwLatch
;
pgid_t
mpgid
;
pgid_t
mpgid
;
uint8_t
dirty
;
uint8_t
dirty
;
uint8_t
fileid
[
TDB_FILE_UID_LEN
];
int32_t
pinRef
;
int32_t
pinRef
;
TD_DLIST_NODE
(
pg_t
);
TD_DLIST_NODE
(
MP_PAGE
);
char
*
page
[];
char
*
page
[];
}
MP_PAGE
;
}
pg_t
;
#define MP_PAGE_SIZE(pgsize) (sizeof(
MP_PAGE
) + (pgsize))
#define MP_PAGE_SIZE(pgsize) (sizeof(
pg_t
) + (pgsize))
typedef
TD_DLIST
(
MP_PAGE
)
MP_PAGE_LIST
;
typedef
TD_DLIST
(
pg_t
)
pg_list_t
;
struct
TDB_MPOOL
{
struct
TDB_MPOOL
{
int64_t
cachesize
;
int64_t
cachesize
;
pgsize_t
pgsize
;
pgsize_t
pgsize
;
int32_t
npages
;
int32_t
npages
;
MP_PAGE
*
pages
;
pg_t
*
pages
;
MP_PAGE_LIST
freeList
;
pg_list_t
freeList
;
// Hash<pgid_t, frame_id_t>
// Hash<pgid_t, frame_id_t>
int32_t
nbucket
;
int32_t
nbucket
;
MP_PAGE_LIST
*
hashtab
;
pg_list_t
*
hashtab
;
// TODO: TD_DLIST(TD_MPFILE) mpfList; // MPFILE registered on this memory pool
// TODO: TD_DLIST(TD_MPFILE) mpfList; // MPFILE registered on this memory pool
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录