Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8f6ba1fc
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8f6ba1fc
编写于
3月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more TDB
上级
6d1477e6
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
33 addition
and
15 deletion
+33
-15
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+14
-14
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+1
-1
source/libs/tdb/src/inc/tdbOs.h
source/libs/tdb/src/inc/tdbOs.h
+18
-0
未找到文件。
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
8f6ba1fc
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
struct
SPCache
{
struct
SPCache
{
int
pageSize
;
int
pageSize
;
int
cacheSize
;
int
cacheSize
;
pthread
_mutex_t
mutex
;
tdb
_mutex_t
mutex
;
int
nFree
;
int
nFree
;
SPage
*
pFree
;
SPage
*
pFree
;
int
nPage
;
int
nPage
;
...
@@ -116,13 +116,13 @@ void tdbPCacheRelease(SPCache *pCache, SPage *pPage) {
...
@@ -116,13 +116,13 @@ void tdbPCacheRelease(SPCache *pCache, SPage *pPage) {
}
}
}
}
static
void
tdbPCacheInitLock
(
SPCache
*
pCache
)
{
pthread_mutex_i
nit
(
&
(
pCache
->
mutex
),
NULL
);
}
static
void
tdbPCacheInitLock
(
SPCache
*
pCache
)
{
tdbMutexI
nit
(
&
(
pCache
->
mutex
),
NULL
);
}
static
void
tdbPCacheClearLock
(
SPCache
*
pCache
)
{
pthread_mutex_d
estroy
(
&
(
pCache
->
mutex
));
}
static
void
tdbPCacheClearLock
(
SPCache
*
pCache
)
{
tdbMutexD
estroy
(
&
(
pCache
->
mutex
));
}
static
void
tdbPCacheLock
(
SPCache
*
pCache
)
{
pthread_mutex_l
ock
(
&
(
pCache
->
mutex
));
}
static
void
tdbPCacheLock
(
SPCache
*
pCache
)
{
tdbMutexL
ock
(
&
(
pCache
->
mutex
));
}
static
void
tdbPCacheUnlock
(
SPCache
*
pCache
)
{
pthread_mutex_unlock
(
&
(
pCache
->
mutex
));
}
static
void
tdbPCacheUnlock
(
SPCache
*
pCache
)
{
tdbMutexDestroy
(
&
(
pCache
->
mutex
));
}
static
bool
tdbPCacheLocked
(
SPCache
*
pCache
)
{
static
bool
tdbPCacheLocked
(
SPCache
*
pCache
)
{
assert
(
0
);
assert
(
0
);
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
8f6ba1fc
...
@@ -206,7 +206,7 @@ int tdbPagerCommit(SPager *pPager) {
...
@@ -206,7 +206,7 @@ int tdbPagerCommit(SPager *pPager) {
// TODO: release the page
// TODO: release the page
}
}
fs
ync
(
pPager
->
fd
);
tdbOsFS
ync
(
pPager
->
fd
);
tdbOsClose
(
pPager
->
jfd
);
tdbOsClose
(
pPager
->
jfd
);
remove
(
pPager
->
jFileName
);
remove
(
pPager
->
jFileName
);
...
...
source/libs/tdb/src/inc/tdbOs.h
浏览文件 @
8f6ba1fc
...
@@ -45,12 +45,14 @@ typedef TdFilePtr tdb_fd_t;
...
@@ -45,12 +45,14 @@ typedef TdFilePtr tdb_fd_t;
#define tdbOsRead taosReadFile
#define tdbOsRead taosReadFile
#define tdbOsPRead taosPReadFile
#define tdbOsPRead taosPReadFile
#define tdbOsWrite taosWriteFile
#define tdbOsWrite taosWriteFile
#define tdbOsFSync taosFsyncFile
#else
#else
#define tdbOsOpen open
#define tdbOsOpen open
#define tdbOsClose close
#define tdbOsClose close
#define tdbOsRead read
#define tdbOsRead read
#define tdbOsPRead pread
#define tdbOsPRead pread
#define tdbOsWrite write
#define tdbOsWrite write
#define tdbOsFSync fsync
#endif
#endif
// For threads and lock
// For threads and lock
...
@@ -65,6 +67,14 @@ typedef TdThreadSpinlock tdb_spinlock_t;
...
@@ -65,6 +67,14 @@ typedef TdThreadSpinlock tdb_spinlock_t;
#define tdbSpinlockUnlock taosThreadSpinUnlock
#define tdbSpinlockUnlock taosThreadSpinUnlock
#define tdbSpinlockTrylock
#define tdbSpinlockTrylock
// mutex lock
typedef
TdThreadMutex
tdb_mutex_t
;
#define tdbMutexInit taosThreadMutexInit
#define tdbMutexDestroy taosThreadMutexDestroy
#define tdbMutexLock taosThreadMutexLock
#define tdbMutexUnlock taosThreadMutexUnlock
#else
#else
// spin lock
// spin lock
...
@@ -76,6 +86,14 @@ typedef pthread_spinlock_t tdb_spinlock_t;
...
@@ -76,6 +86,14 @@ typedef pthread_spinlock_t tdb_spinlock_t;
#define tdbSpinlockUnlock pthread_spin_unlock
#define tdbSpinlockUnlock pthread_spin_unlock
#define tdbSpinlockTrylock pthread_spin_trylock
#define tdbSpinlockTrylock pthread_spin_trylock
// mutex lock
typedef
pthread_mutex_t
tdb_mutex_t
;
#define tdbMutexInit pthread_mutex_init
#define tdbMutexDestroy pthread_mutex_destroy
#define tdbMutexLock pthread_mutex_lock
#define tdbMutexUnlock pthread_mutex_unlock
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录