Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a10e0649
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看板
提交
a10e0649
编写于
2月 11, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact TDB
上级
d83540ae
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
21 addition
and
21 deletion
+21
-21
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+3
-3
source/libs/tdb/src/db/btree.c
source/libs/tdb/src/db/btree.c
+2
-2
source/libs/tdb/src/db/pgcache.c
source/libs/tdb/src/db/pgcache.c
+1
-1
source/libs/tdb/src/db/pgfile.c
source/libs/tdb/src/db/pgfile.c
+1
-1
source/libs/tdb/src/db/tdbEnv.c
source/libs/tdb/src/db/tdbEnv.c
+3
-3
source/libs/tdb/src/db/tdb_mpool.c
source/libs/tdb/src/db/tdb_mpool.c
+3
-3
source/libs/tdb/src/inc/pgcache.h
source/libs/tdb/src/inc/pgcache.h
+3
-3
source/libs/tdb/src/inc/pgfile.h
source/libs/tdb/src/inc/pgfile.h
+1
-1
source/libs/tdb/src/inc/tdbInt.h
source/libs/tdb/src/inc/tdbInt.h
+2
-2
source/libs/tdb/src/inc/tdb_mpool.h
source/libs/tdb/src/inc/tdb_mpool.h
+2
-2
未找到文件。
source/libs/tdb/inc/tdb.h
浏览文件 @
a10e0649
...
@@ -26,7 +26,7 @@ typedef struct STDb TDB;
...
@@ -26,7 +26,7 @@ typedef struct STDb TDB;
typedef
struct
STDbEnv
TENV
;
typedef
struct
STDbEnv
TENV
;
typedef
struct
STDbCurosr
TDBC
;
typedef
struct
STDbCurosr
TDBC
;
typedef
int32_t
pgs
ize
_t
;
typedef
int32_t
pgs
z
_t
;
typedef
int32_t
cachesz_t
;
typedef
int32_t
cachesz_t
;
// TEVN
// TEVN
...
@@ -34,9 +34,9 @@ int tdbEnvCreate(TENV **ppEnv);
...
@@ -34,9 +34,9 @@ int tdbEnvCreate(TENV **ppEnv);
int
tdbEnvOpen
(
TENV
**
ppEnv
);
int
tdbEnvOpen
(
TENV
**
ppEnv
);
int
tdbEnvClose
(
TENV
*
pEnv
);
int
tdbEnvClose
(
TENV
*
pEnv
);
int
tdbEnvSetPageSize
(
TENV
*
pEnv
,
pgs
ize
_t
szPage
);
int
tdbEnvSetPageSize
(
TENV
*
pEnv
,
pgs
z
_t
szPage
);
int
tdbEnvSetCacheSize
(
TENV
*
pEnv
,
cachesz_t
szCache
);
int
tdbEnvSetCacheSize
(
TENV
*
pEnv
,
cachesz_t
szCache
);
pgs
ize_t
tdbEnvGetPageSize
(
TENV
*
pEnv
);
pgs
z_t
tdbEnvGetPageSize
(
TENV
*
pEnv
);
cachesz_t
tdbEnvGetCacheSize
(
TENV
*
pEnv
);
cachesz_t
tdbEnvGetCacheSize
(
TENV
*
pEnv
);
// TDB
// TDB
...
...
source/libs/tdb/src/db/btree.c
浏览文件 @
a10e0649
...
@@ -22,8 +22,8 @@ struct SBtCursor {
...
@@ -22,8 +22,8 @@ struct SBtCursor {
};
};
typedef
struct
{
typedef
struct
{
pgno_t
pgno
;
pgno_t
pgno
;
pgs
ize
_t
offset
;
pgs
z
_t
offset
;
}
SBtIdx
;
}
SBtIdx
;
static
int
btreeCreate
(
SBTree
**
pBt
);
static
int
btreeCreate
(
SBTree
**
pBt
);
...
...
source/libs/tdb/src/db/pgcache.c
浏览文件 @
a10e0649
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
static
void
pgCachePinPage
(
SPage
*
pPage
);
static
void
pgCachePinPage
(
SPage
*
pPage
);
static
void
pgCacheUnpinPage
(
SPage
*
pPage
);
static
void
pgCacheUnpinPage
(
SPage
*
pPage
);
int
pgCacheCreate
(
SPgCache
**
ppPgCache
,
pgs
ize
_t
pgSize
,
int32_t
npage
)
{
int
pgCacheCreate
(
SPgCache
**
ppPgCache
,
pgs
z
_t
pgSize
,
int32_t
npage
)
{
SPgCache
*
pPgCache
;
SPgCache
*
pPgCache
;
SPage
*
pPage
;
SPage
*
pPage
;
...
...
source/libs/tdb/src/db/pgfile.c
浏览文件 @
a10e0649
...
@@ -107,7 +107,7 @@ int pgFileWrite(SPage *pPage) {
...
@@ -107,7 +107,7 @@ int pgFileWrite(SPage *pPage) {
}
}
static
int
pgFileRead
(
SPgFile
*
pPgFile
,
pgno_t
pgno
,
uint8_t
*
pData
)
{
static
int
pgFileRead
(
SPgFile
*
pPgFile
,
pgno_t
pgno
,
uint8_t
*
pData
)
{
pgs
ize_t
pgSize
;
pgs
z_t
pgSize
;
ssize_t
rsize
;
ssize_t
rsize
;
uint8_t
*
pTData
;
uint8_t
*
pTData
;
size_t
szToRead
;
size_t
szToRead
;
...
...
source/libs/tdb/src/db/tdbEnv.c
浏览文件 @
a10e0649
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "tdbInt.h"
#include "tdbInt.h"
struct
STDbEnv
{
struct
STDbEnv
{
pgs
ize_t
pgSize
;
// Page size
pgs
z_t
pgSize
;
// Page size
cachesz_t
cacheSize
;
// Total cache size
cachesz_t
cacheSize
;
// Total cache size
STDbList
dbList
;
// TDB List
STDbList
dbList
;
// TDB List
SPgFileList
pgfList
;
// SPgFile List
SPgFileList
pgfList
;
// SPgFile List
...
@@ -74,7 +74,7 @@ int tdbEnvClose(TENV *pEnv) {
...
@@ -74,7 +74,7 @@ int tdbEnvClose(TENV *pEnv) {
return
0
;
return
0
;
}
}
int
tdbEnvSetPageSize
(
TENV
*
pEnv
,
pgs
ize
_t
szPage
)
{
int
tdbEnvSetPageSize
(
TENV
*
pEnv
,
pgs
z
_t
szPage
)
{
/* TODO */
/* TODO */
pEnv
->
pgSize
=
szPage
;
pEnv
->
pgSize
=
szPage
;
return
0
;
return
0
;
...
@@ -86,7 +86,7 @@ int tdbEnvSetCacheSize(TENV *pEnv, cachesz_t szCache) {
...
@@ -86,7 +86,7 @@ int tdbEnvSetCacheSize(TENV *pEnv, cachesz_t szCache) {
return
0
;
return
0
;
}
}
pgs
ize
_t
tdbEnvGetPageSize
(
TENV
*
pEnv
)
{
return
pEnv
->
pgSize
;
}
pgs
z
_t
tdbEnvGetPageSize
(
TENV
*
pEnv
)
{
return
pEnv
->
pgSize
;
}
cachesz_t
tdbEnvGetCacheSize
(
TENV
*
pEnv
)
{
return
pEnv
->
cacheSize
;
}
cachesz_t
tdbEnvGetCacheSize
(
TENV
*
pEnv
)
{
return
pEnv
->
cacheSize
;
}
...
...
source/libs/tdb/src/db/tdb_mpool.c
浏览文件 @
a10e0649
...
@@ -22,7 +22,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p);
...
@@ -22,7 +22,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p);
static
int
tdbMPoolFileWritePage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
const
void
*
p
);
static
int
tdbMPoolFileWritePage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
const
void
*
p
);
static
void
tdbMPoolClockEvictPage
(
TDB_MPOOL
*
mp
,
pg_t
**
pagepp
);
static
void
tdbMPoolClockEvictPage
(
TDB_MPOOL
*
mp
,
pg_t
**
pagepp
);
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgs
ize
_t
pgsize
)
{
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgs
z
_t
pgsize
)
{
TDB_MPOOL
*
mp
=
NULL
;
TDB_MPOOL
*
mp
=
NULL
;
size_t
tsize
;
size_t
tsize
;
pg_t
*
pagep
;
pg_t
*
pagep
;
...
@@ -300,7 +300,7 @@ static void tdbMPoolUnregFile(TDB_MPOOL *mp, TDB_MPFILE *mpf) {
...
@@ -300,7 +300,7 @@ static void tdbMPoolUnregFile(TDB_MPOOL *mp, TDB_MPFILE *mpf) {
}
}
static
int
tdbMPoolFileReadPage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
void
*
p
)
{
static
int
tdbMPoolFileReadPage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
void
*
p
)
{
pgs
ize_t
pgsize
;
pgs
z_t
pgsize
;
TDB_MPOOL
*
mp
;
TDB_MPOOL
*
mp
;
off_t
offset
;
off_t
offset
;
size_t
rsize
;
size_t
rsize
;
...
@@ -317,7 +317,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p) {
...
@@ -317,7 +317,7 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p) {
}
}
static
int
tdbMPoolFileWritePage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
const
void
*
p
)
{
static
int
tdbMPoolFileWritePage
(
TDB_MPFILE
*
mpf
,
pgno_t
pgno
,
const
void
*
p
)
{
pgs
ize_t
pgsize
;
pgs
z_t
pgsize
;
TDB_MPOOL
*
mp
;
TDB_MPOOL
*
mp
;
off_t
offset
;
off_t
offset
;
...
...
source/libs/tdb/src/inc/pgcache.h
浏览文件 @
a10e0649
...
@@ -24,7 +24,7 @@ typedef struct SPgCache SPgCache;
...
@@ -24,7 +24,7 @@ typedef struct SPgCache SPgCache;
typedef
struct
SPage
SPage
;
typedef
struct
SPage
SPage
;
// SPgCache
// SPgCache
int
pgCacheCreate
(
SPgCache
**
ppPgCache
,
pgs
ize
_t
pgSize
,
int32_t
npage
);
int
pgCacheCreate
(
SPgCache
**
ppPgCache
,
pgs
z
_t
pgSize
,
int32_t
npage
);
int
pgCacheDestroy
(
SPgCache
*
pPgCache
);
int
pgCacheDestroy
(
SPgCache
*
pPgCache
);
int
pgCacheOpen
(
SPgCache
**
ppPgCache
);
int
pgCacheOpen
(
SPgCache
**
ppPgCache
);
int
pgCacheClose
(
SPgCache
*
pPgCache
);
int
pgCacheClose
(
SPgCache
*
pPgCache
);
...
@@ -46,9 +46,9 @@ struct SPage {
...
@@ -46,9 +46,9 @@ struct SPage {
typedef
TD_DLIST
(
SPage
)
SPgList
;
typedef
TD_DLIST
(
SPage
)
SPgList
;
struct
SPgCache
{
struct
SPgCache
{
TENV
*
pEnv
;
// TENV containing this page cache
TENV
*
pEnv
;
// TENV containing this page cache
SRWLatch
mutex
;
SRWLatch
mutex
;
pgs
ize_t
pgsize
;
pgs
z_t
pgsize
;
int32_t
npage
;
int32_t
npage
;
SPage
*
pages
;
SPage
*
pages
;
SPgList
freeList
;
SPgList
freeList
;
...
...
source/libs/tdb/src/inc/pgfile.h
浏览文件 @
a10e0649
...
@@ -24,7 +24,7 @@ struct SPgFile {
...
@@ -24,7 +24,7 @@ struct SPgFile {
char
*
fname
;
// backend file name
char
*
fname
;
// backend file name
uint8_t
fileid
[
TDB_FILE_ID_LEN
];
// file id
uint8_t
fileid
[
TDB_FILE_ID_LEN
];
// file id
SPgCache
*
pPgCache
;
// page cache underline
SPgCache
*
pPgCache
;
// page cache underline
pgs
ize_t
pgSize
;
pgs
z_t
pgSize
;
int
fd
;
int
fd
;
pgno_t
pgFileSize
;
pgno_t
pgFileSize
;
};
};
...
...
source/libs/tdb/src/inc/tdbInt.h
浏览文件 @
a10e0649
...
@@ -64,9 +64,9 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) {
...
@@ -64,9 +64,9 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) {
// framd_id_t
// framd_id_t
typedef
int32_t
frame_id_t
;
typedef
int32_t
frame_id_t
;
// pgs
ize
_t
// pgs
z
_t
#define TDB_MIN_PGSIZE 512
#define TDB_MIN_PGSIZE 512
#define TDB_MAX_PGSIZE
16384
#define TDB_MAX_PGSIZE
65536
#define TDB_DEFAULT_PGSIZE 4096
#define TDB_DEFAULT_PGSIZE 4096
#define TDB_IS_PGSIZE_VLD(s) (((s) >= TDB_MIN_PGSIZE) && ((s) <= TDB_MAX_PGSIZE))
#define TDB_IS_PGSIZE_VLD(s) (((s) >= TDB_MIN_PGSIZE) && ((s) <= TDB_MAX_PGSIZE))
...
...
source/libs/tdb/src/inc/tdb_mpool.h
浏览文件 @
a10e0649
...
@@ -46,7 +46,7 @@ typedef struct {
...
@@ -46,7 +46,7 @@ typedef struct {
}
mpf_bucket_t
;
}
mpf_bucket_t
;
struct
TDB_MPOOL
{
struct
TDB_MPOOL
{
int64_t
cachesize
;
int64_t
cachesize
;
pgs
ize_t
pgsize
;
pgs
z_t
pgsize
;
int32_t
npages
;
int32_t
npages
;
pg_t
*
pages
;
pg_t
*
pages
;
pg_list_t
freeList
;
pg_list_t
freeList
;
...
@@ -74,7 +74,7 @@ struct TDB_MPFILE {
...
@@ -74,7 +74,7 @@ struct TDB_MPFILE {
/*=================================================== Exposed apis ==================================================*/
/*=================================================== Exposed apis ==================================================*/
// TDB_MPOOL
// TDB_MPOOL
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgs
ize
_t
pgsize
);
int
tdbMPoolOpen
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgs
z
_t
pgsize
);
int
tdbMPoolClose
(
TDB_MPOOL
*
mp
);
int
tdbMPoolClose
(
TDB_MPOOL
*
mp
);
int
tdbMPoolSync
(
TDB_MPOOL
*
mp
);
int
tdbMPoolSync
(
TDB_MPOOL
*
mp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录