Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
610832f0
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
610832f0
编写于
4月 06, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
keep committed data in TDB
上级
938ce798
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
49 addition
and
24 deletion
+49
-24
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+2
-1
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+22
-14
source/libs/tdb/src/db/tdbUtil.c
source/libs/tdb/src/db/tdbUtil.c
+13
-0
source/libs/tdb/src/inc/tdbOs.h
source/libs/tdb/src/inc/tdbOs.h
+11
-9
source/libs/tdb/src/inc/tdbUtil.h
source/libs/tdb/src/inc/tdbUtil.h
+1
-0
未找到文件。
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
610832f0
...
@@ -297,7 +297,8 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
...
@@ -297,7 +297,8 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
{
{
// 1. TODO: Search the main DB to check if the DB exists
// 1. TODO: Search the main DB to check if the DB exists
pgno
=
0
;
ret
=
tdbPagerOpenDB
(
pBt
->
pPager
,
&
pgno
,
true
);
ASSERT
(
ret
==
0
);
}
}
if
(
pgno
!=
0
)
{
if
(
pgno
!=
0
)
{
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
610832f0
...
@@ -76,6 +76,8 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
...
@@ -76,6 +76,8 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
// pPager->jfd = -1;
// pPager->jfd = -1;
pPager
->
pageSize
=
tdbPCacheGetPageSize
(
pCache
);
pPager
->
pageSize
=
tdbPCacheGetPageSize
(
pCache
);
// pPager->dbOrigSize
ret
=
tdbGetFileSize
(
pPager
->
fd
,
pPager
->
pageSize
,
&
(
pPager
->
dbOrigSize
));
*
ppPager
=
pPager
;
*
ppPager
=
pPager
;
return
0
;
return
0
;
...
@@ -91,9 +93,15 @@ int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate) {
...
@@ -91,9 +93,15 @@ int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate) {
SPage
*
pPage
;
SPage
*
pPage
;
int
ret
;
int
ret
;
if
(
pPager
->
dbOrigSize
>
0
)
{
pgno
=
1
;
}
else
{
pgno
=
0
;
}
{
{
// TODO: try to search the main DB to get the page number
// TODO: try to search the main DB to get the page number
pgno
=
0
;
//
pgno = 0;
}
}
// if (pgno == 0 && toCreate) {
// if (pgno == 0 && toCreate) {
...
...
source/libs/tdb/src/db/tdbUtil.c
浏览文件 @
610832f0
...
@@ -32,3 +32,16 @@ int tdbGnrtFileID(const char *fname, uint8_t *fileid, bool unique) {
...
@@ -32,3 +32,16 @@ int tdbGnrtFileID(const char *fname, uint8_t *fileid, bool unique) {
return
0
;
return
0
;
}
}
int
tdbGetFileSize
(
tdb_fd_t
fd
,
int
szPage
,
SPgno
*
size
)
{
int
ret
;
int64_t
szBytes
;
ret
=
tdbOsFileSize
(
fd
,
&
szBytes
);
if
(
ret
<
0
)
{
return
-
1
;
}
*
size
=
szBytes
/
szPage
;
return
0
;
}
\ No newline at end of file
source/libs/tdb/src/inc/tdbOs.h
浏览文件 @
610832f0
...
@@ -53,6 +53,7 @@ typedef TdFilePtr tdb_fd_t;
...
@@ -53,6 +53,7 @@ typedef TdFilePtr tdb_fd_t;
#define tdbOsFSync taosFsyncFile
#define tdbOsFSync taosFsyncFile
#define tdbOsLSeek taosLSeekFile
#define tdbOsLSeek taosLSeekFile
#define tdbOsRemove remove
#define tdbOsRemove remove
#define tdbOsFileSize(FD, PSIZE) taosFStatFile(FD, PSIZE, NULL)
/* directory */
/* directory */
#define tdbOsMkdir taosMkDir
#define tdbOsMkdir taosMkDir
...
@@ -110,6 +111,7 @@ i64 tdbOsWrite(tdb_fd_t fd, const void *pData, i64 nBytes);
...
@@ -110,6 +111,7 @@ i64 tdbOsWrite(tdb_fd_t fd, const void *pData, i64 nBytes);
#define tdbOsFSync fsync
#define tdbOsFSync fsync
#define tdbOsLSeek lseek
#define tdbOsLSeek lseek
#define tdbOsRemove remove
#define tdbOsRemove remove
#define tdbOsFileSize(FD, PSIZE)
/* directory */
/* directory */
#define tdbOsMkdir mkdir
#define tdbOsMkdir mkdir
...
...
source/libs/tdb/src/inc/tdbUtil.h
浏览文件 @
610832f0
...
@@ -29,6 +29,7 @@ extern "C" {
...
@@ -29,6 +29,7 @@ extern "C" {
#define TDB_ROUND8(x) (((x) + 7) & ~7)
#define TDB_ROUND8(x) (((x) + 7) & ~7)
int
tdbGnrtFileID
(
const
char
*
fname
,
uint8_t
*
fileid
,
bool
unique
);
int
tdbGnrtFileID
(
const
char
*
fname
,
uint8_t
*
fileid
,
bool
unique
);
int
tdbGetFileSize
(
tdb_fd_t
fd
,
int
szPage
,
SPgno
*
size
);
#define TDB_REALLOC(PTR, SIZE) \
#define TDB_REALLOC(PTR, SIZE) \
({ \
({ \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录