Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a5d6851c
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a5d6851c
编写于
2月 24, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement compact interfaces
上级
cc5e1ebb
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
59 addition
and
9 deletion
+59
-9
src/inc/tsdb.h
src/inc/tsdb.h
+3
-0
src/tsdb/inc/tsdbCommitQueue.h
src/tsdb/inc/tsdbCommitQueue.h
+3
-1
src/tsdb/inc/tsdbCompact.h
src/tsdb/inc/tsdbCompact.h
+28
-0
src/tsdb/inc/tsdbint.h
src/tsdb/inc/tsdbint.h
+2
-0
src/tsdb/src/tsdbCommitQueue.c
src/tsdb/src/tsdbCommitQueue.c
+17
-6
src/tsdb/src/tsdbCompact.c
src/tsdb/src/tsdbCompact.c
+5
-1
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+1
-1
未找到文件。
src/inc/tsdb.h
浏览文件 @
a5d6851c
...
...
@@ -355,6 +355,9 @@ void tsdbDecCommitRef(int vgId);
int
tsdbSyncSend
(
void
*
pRepo
,
SOCKET
socketFd
);
int
tsdbSyncRecv
(
void
*
pRepo
,
SOCKET
socketFd
);
// For TSDB Compact
int
tsdbCompact
(
STsdbRepo
*
pRepo
);
#ifdef __cplusplus
}
#endif
...
...
src/tsdb/inc/tsdbCommitQueue.h
浏览文件 @
a5d6851c
...
...
@@ -16,6 +16,8 @@
#ifndef _TD_TSDB_COMMIT_QUEUE_H_
#define _TD_TSDB_COMMIT_QUEUE_H_
int
tsdbScheduleCommit
(
STsdbRepo
*
pRepo
);
typedef
enum
{
COMMIT_REQ
,
COMPACT_REQ
}
TSDB_REQ_T
;
int
tsdbScheduleCommit
(
STsdbRepo
*
pRepo
,
TSDB_REQ_T
req
);
#endif
/* _TD_TSDB_COMMIT_QUEUE_H_ */
\ No newline at end of file
src/tsdb/inc/tsdbCompact.h
0 → 100644
浏览文件 @
a5d6851c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_TSDB_COMPACT_H_
#define _TD_TSDB_COMPACT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
void
*
tsdbCompactImpl
(
STsdbRepo
*
pRepo
);
#ifdef __cplusplus
}
#endif
#endif
/* _TD_TSDB_COMPACT_H_ */
\ No newline at end of file
src/tsdb/inc/tsdbint.h
浏览文件 @
a5d6851c
...
...
@@ -64,6 +64,8 @@ extern "C" {
#include "tsdbReadImpl.h"
// Commit
#include "tsdbCommit.h"
// Compact
#include "tsdbCompact.h"
// Commit Queue
#include "tsdbCommitQueue.h"
// Main definitions
...
...
src/tsdb/src/tsdbCommitQueue.c
浏览文件 @
a5d6851c
...
...
@@ -26,8 +26,9 @@ typedef struct {
}
SCommitQueue
;
typedef
struct
{
TSDB_REQ_T
req
;
STsdbRepo
*
pRepo
;
}
S
Commit
Req
;
}
SReq
;
static
void
*
tsdbLoopCommit
(
void
*
arg
);
...
...
@@ -90,16 +91,17 @@ void tsdbDestroyCommitQueue() {
pthread_mutex_destroy
(
&
(
pQueue
->
lock
));
}
int
tsdbScheduleCommit
(
STsdbRepo
*
pRepo
)
{
int
tsdbScheduleCommit
(
STsdbRepo
*
pRepo
,
TSDB_REQ_T
req
)
{
SCommitQueue
*
pQueue
=
&
tsCommitQueue
;
SListNode
*
pNode
=
(
SListNode
*
)
calloc
(
1
,
sizeof
(
SListNode
)
+
sizeof
(
S
Commit
Req
));
SListNode
*
pNode
=
(
SListNode
*
)
calloc
(
1
,
sizeof
(
SListNode
)
+
sizeof
(
SReq
));
if
(
pNode
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
}
((
SCommitReq
*
)
pNode
->
data
)
->
pRepo
=
pRepo
;
((
SReq
*
)
pNode
->
data
)
->
req
=
req
;
((
SReq
*
)
pNode
->
data
)
->
pRepo
=
pRepo
;
pthread_mutex_lock
(
&
(
pQueue
->
lock
));
...
...
@@ -116,6 +118,7 @@ static void *tsdbLoopCommit(void *arg) {
SCommitQueue
*
pQueue
=
&
tsCommitQueue
;
SListNode
*
pNode
=
NULL
;
STsdbRepo
*
pRepo
=
NULL
;
TSDB_REQ_T
req
;
while
(
true
)
{
pthread_mutex_lock
(
&
(
pQueue
->
lock
));
...
...
@@ -136,9 +139,17 @@ static void *tsdbLoopCommit(void *arg) {
pthread_mutex_unlock
(
&
(
pQueue
->
lock
));
pRepo
=
((
SCommitReq
*
)
pNode
->
data
)
->
pRepo
;
req
=
((
SReq
*
)
pNode
->
data
)
->
req
;
pRepo
=
((
SReq
*
)
pNode
->
data
)
->
pRepo
;
if
(
req
==
COMMIT_REQ
)
{
tsdbCommitData
(
pRepo
);
}
else
if
(
req
==
COMPACT_REQ
)
{
tsdbCompactImpl
(
pRepo
);
}
else
{
ASSERT
(
0
);
}
listNodeFree
(
pNode
);
}
...
...
src/tsdb/src/tsdbCompact.c
浏览文件 @
a5d6851c
...
...
@@ -12,3 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tsdb.h"
int
tsdbCompact
(
STsdbRepo
*
pRepo
)
{
return
0
;
}
void
*
tsdbCompactImpl
(
STsdbRepo
*
pRepo
)
{
return
NULL
;
}
\ No newline at end of file
src/tsdb/src/tsdbMemTable.c
浏览文件 @
a5d6851c
...
...
@@ -232,7 +232,7 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) {
if
(
tsdbLockRepo
(
pRepo
)
<
0
)
return
-
1
;
pRepo
->
imem
=
pRepo
->
mem
;
pRepo
->
mem
=
NULL
;
tsdbScheduleCommit
(
pRepo
);
tsdbScheduleCommit
(
pRepo
,
COMMIT_REQ
);
if
(
tsdbUnlockRepo
(
pRepo
)
<
0
)
return
-
1
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录