Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3146ac2d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
3146ac2d
编写于
3月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more TDB
上级
a8882c5c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
12 deletion
+28
-12
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+4
-4
source/libs/tdb/src/inc/tdbOs.h
source/libs/tdb/src/inc/tdbOs.h
+24
-8
未找到文件。
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
3146ac2d
...
...
@@ -80,7 +80,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
// pPager->pCache
pPager
->
pCache
=
pCache
;
pPager
->
fd
=
tdbOsOpen
(
pPager
->
dbFileName
,
O_RDWR
|
O_CREAT
,
0755
);
pPager
->
fd
=
tdbOsOpen
(
pPager
->
dbFileName
,
O_RDWR
|
O_CREAT
);
if
(
pPager
->
fd
<
0
)
{
return
-
1
;
}
...
...
@@ -90,7 +90,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
return
-
1
;
}
pPager
->
jfd
=
-
1
;
//
pPager->jfd = -1;
pPager
->
pageSize
=
tdbPCacheGetPageSize
(
pCache
);
*
ppPager
=
pPager
;
...
...
@@ -168,7 +168,7 @@ int tdbPagerBegin(SPager *pPager) {
}
// Open the journal
pPager
->
jfd
=
tdbOsOpen
(
pPager
->
jFileName
,
O_RDWR
|
O_CREAT
,
0755
);
pPager
->
jfd
=
tdbOsOpen
(
pPager
->
jFileName
,
O_RDWR
|
O_CREAT
);
if
(
pPager
->
jfd
<
0
)
{
return
-
1
;
}
...
...
@@ -210,7 +210,7 @@ int tdbPagerCommit(SPager *pPager) {
tdbOsClose
(
pPager
->
jfd
);
remove
(
pPager
->
jFileName
);
pPager
->
jfd
=
-
1
;
//
pPager->jfd = -1;
return
0
;
}
...
...
source/libs/tdb/src/inc/tdbOs.h
浏览文件 @
3146ac2d
...
...
@@ -20,10 +20,10 @@
extern
"C"
{
#endif
// TODO:
kmake
// TODO:
use cmake to control the option
#define TDB_FOR_TDENGINE
// For memor
// For memor
y
#ifdef TDB_FOR_TDENGINE
#define tdbOsMalloc taosMemoryMalloc
#define tdbOsCalloc taosMemoryCalloc
...
...
@@ -36,8 +36,10 @@ extern "C" {
#define tdbOsFree free
#endif
// For file
// For file
and directory
#ifdef TDB_FOR_TDENGINE
// file
typedef
TdFilePtr
tdb_fd_t
;
#define tdbOsOpen taosOpenFile
...
...
@@ -46,28 +48,42 @@ typedef TdFilePtr tdb_fd_t;
#define tdbOsPRead taosPReadFile
#define tdbOsWrite taosWriteFile
#define tdbOsFSync taosFsyncFile
// directory
#define tdbOsMkdir taosMkDir
#define tdbOsRmdir taosRemoveDir
#else
// file
typedef
int
tdb_fd_t
;
#define tdbOsOpen open
#define tdbOsClose close
#define tdbOsRead read // TODO
#define tdbOsPRead pread // TODO
#define tdbOsWrite write // TODO
#define tdbOsFSync fsync
// directory
#define tdbOsMkdir mkdir
#define tdbOsRmdir rmdir
#endif
// For threads and lock
#ifdef TDB_FOR_TDENGINE
/
/ spin lock
/
* spin lock */
typedef
TdThreadSpinlock
tdb_spinlock_t
;
#define tdbSpinlockInit taosThreadSpinInit
#define tdbSpinlockDestroy taosThreadSpinDestroy
#define tdbSpinlockLock taosThreadSpinLock
#define tdbSpinlockUnlock taosThreadSpinUnlock
#define tdbSpinlockTrylock pthread_spin_trylock
// TODO
#define tdbSpinlockTrylock pthread_spin_trylock
/
/ mutex lock
/
* mutex lock */
typedef
TdThreadMutex
tdb_mutex_t
;
#define tdbMutexInit taosThreadMutexInit
...
...
@@ -77,7 +93,7 @@ typedef TdThreadMutex tdb_mutex_t;
#else
/
/ spin lock
/
* spin lock */
typedef
pthread_spinlock_t
tdb_spinlock_t
;
#define tdbSpinlockInit pthread_spin_init
...
...
@@ -86,7 +102,7 @@ typedef pthread_spinlock_t tdb_spinlock_t;
#define tdbSpinlockUnlock pthread_spin_unlock
#define tdbSpinlockTrylock pthread_spin_trylock
/
/ mutex lock
/
* mutex lock */
typedef
pthread_mutex_t
tdb_mutex_t
;
#define tdbMutexInit pthread_mutex_init
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录