Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0bc5300d
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0bc5300d
编写于
6月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more progress
上级
de32cab3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
9 deletion
+51
-9
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+15
-1
source/dnode/vnode/src/tsdb/tsdbCommit2.c
source/dnode/vnode/src/tsdb/tsdbCommit2.c
+36
-7
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+0
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
0bc5300d
...
@@ -39,13 +39,21 @@ typedef struct SDelOp SDelOp;
...
@@ -39,13 +39,21 @@ typedef struct SDelOp SDelOp;
static
int
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
static
int
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
// tsdbMemTable2.c ==============================================================================================
// tsdbMemTable2.c ==============================================================================================
typedef
struct
SMemTable
SMemTable
;
typedef
struct
SMemTable
SMemTable
;
typedef
struct
SMemData
SMemData
;
typedef
struct
SMemDataIter
SMemDataIter
;
int32_t
tsdbMemTableCreate2
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTable
);
int32_t
tsdbMemTableCreate2
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy2
(
SMemTable
*
pMemTable
);
void
tsdbMemTableDestroy2
(
SMemTable
*
pMemTable
);
int32_t
tsdbInsertTableData2
(
STsdb
*
pTsdb
,
int64_t
version
,
SVSubmitBlk
*
pSubmitBlk
);
int32_t
tsdbInsertTableData2
(
STsdb
*
pTsdb
,
int64_t
version
,
SVSubmitBlk
*
pSubmitBlk
);
int32_t
tsdbDeleteTableData2
(
STsdb
*
pTsdb
,
int64_t
version
,
tb_uid_t
suid
,
tb_uid_t
uid
,
TSKEY
sKey
,
TSKEY
eKey
);
int32_t
tsdbDeleteTableData2
(
STsdb
*
pTsdb
,
int64_t
version
,
tb_uid_t
suid
,
tb_uid_t
uid
,
TSKEY
sKey
,
TSKEY
eKey
);
/* SMemDataIter */
void
tsdbMemDataIterOpen
(
SMemDataIter
*
pIter
,
TSDBKEY
*
pKey
,
int8_t
backward
);
void
tsdbMemDataIterClose
(
SMemDataIter
*
pIter
);
void
tsdbMemDataIterNext
(
SMemDataIter
*
pIter
);
void
tsdbMemDataIterGet
(
SMemDataIter
*
pIter
,
TSDBROW
**
ppRow
);
// tsdbCommit2.c ==============================================================================================
// tsdbCommit2.c ==============================================================================================
int32_t
tsdbBegin2
(
STsdb
*
pTsdb
);
int32_t
tsdbBegin2
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit2
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit2
(
STsdb
*
pTsdb
);
...
@@ -254,6 +262,7 @@ typedef struct {
...
@@ -254,6 +262,7 @@ typedef struct {
uint32_t
offset
;
uint32_t
offset
;
uint32_t
hasLast
:
2
;
uint32_t
hasLast
:
2
;
uint32_t
numOfBlocks
:
30
;
uint32_t
numOfBlocks
:
30
;
uint64_t
suid
;
uint64_t
uid
;
uint64_t
uid
;
TSKEY
maxKey
;
TSKEY
maxKey
;
}
SBlockIdx
;
}
SBlockIdx
;
...
@@ -910,6 +919,11 @@ static FORCE_INLINE int tsdbKeyCmprFn(const void *p1, const void *p2) {
...
@@ -910,6 +919,11 @@ static FORCE_INLINE int tsdbKeyCmprFn(const void *p1, const void *p2) {
return
0
;
return
0
;
}
}
struct
SMemDataIter
{
SMemData
*
pMemData
;
TSDBROW
row
;
};
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/tsdbCommit2.c
浏览文件 @
0bc5300d
...
@@ -78,7 +78,7 @@ static int32_t tsdbStartCommit(SCommitH *pCHandle, STsdb *pTsdb) {
...
@@ -78,7 +78,7 @@ static int32_t tsdbStartCommit(SCommitH *pCHandle, STsdb *pTsdb) {
ASSERT
(
pTsdb
->
imem
==
NULL
&&
pTsdb
->
mem
);
ASSERT
(
pTsdb
->
imem
==
NULL
&&
pTsdb
->
mem
);
pTsdb
->
imem
=
pTsdb
->
mem
;
pTsdb
->
imem
=
pTsdb
->
mem
;
pTsdb
->
mem
=
NULL
;
pTsdb
->
mem
=
NULL
;
// TODO
return
code
;
return
code
;
}
}
...
@@ -89,16 +89,45 @@ static int32_t tsdbEndCommit(SCommitH *pCHandle) {
...
@@ -89,16 +89,45 @@ static int32_t tsdbEndCommit(SCommitH *pCHandle) {
}
}
static
int32_t
tsdbCommitToFile
(
SCommitH
*
pCHandle
,
int32_t
fid
)
{
static
int32_t
tsdbCommitToFile
(
SCommitH
*
pCHandle
,
int32_t
fid
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
TSKEY
fidSKey
;
SMemDataIter
iter
=
{
0
};
TSKEY
fidEKey
;
TSDBROW
*
pRow
=
NULL
;
int8_t
hasData
=
0
;
TSKEY
fidSKey
;
TSKEY
fidEKey
;
int32_t
iMemData
=
0
;
int32_t
nMemData
=
taosArrayGetSize
(
pCHandle
->
pMemTable
->
aMemData
);
int32_t
iBlockIdx
=
0
;
int32_t
nBlockIdx
;
// check if there are data in the time range
// check if there are data in the time range
for
(
int32_t
iMemData
=
0
;
iMemData
<
taosArrayGetSize
(
pCHandle
->
pMemTable
->
aMemData
);
iMemData
++
)
{
for
(;
iMemData
<
nMemData
;
iMemData
++
)
{
/* code */
SMemData
*
pMemData
=
(
SMemData
*
)
taosArrayGetP
(
pCHandle
->
pMemTable
->
aMemData
,
iMemData
);
tsdbMemDataIterOpen
(
&
iter
,
&
(
TSDBKEY
){.
ts
=
fidSKey
,
.
version
=
0
},
0
);
tsdbMemDataIterGet
(
&
iter
,
&
pRow
);
if
(
pRow
->
tsRow
.
ts
>=
fidSKey
&&
pRow
->
tsRow
.
ts
<=
fidEKey
)
{
hasData
=
1
;
break
;
}
}
}
// has data, do commit to file
if
(
!
hasData
)
return
code
;
// loop to commit each table data
nBlockIdx
=
0
;
for
(;;)
{
if
(
iBlockIdx
>=
nBlockIdx
&&
iMemData
>=
nMemData
)
break
;
SMemData
*
pMemData
=
NULL
;
SBlockIdx
*
pBlockIdx
=
NULL
;
if
(
iMemData
<
nMemData
)
{
pMemData
=
(
SMemData
*
)
taosArrayGetP
(
pCHandle
->
pMemTable
->
aMemData
,
iBlockIdx
);
}
if
(
iBlockIdx
<
nBlockIdx
)
{
// pBlockIdx
}
}
return
code
;
return
code
;
}
}
\ No newline at end of file
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
0bc5300d
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
#include "tsdb.h"
#include "tsdb.h"
typedef
struct
SMemData
SMemData
;
typedef
struct
SMemSkipList
SMemSkipList
;
typedef
struct
SMemSkipList
SMemSkipList
;
typedef
struct
SMemSkipListNode
SMemSkipListNode
;
typedef
struct
SMemSkipListNode
SMemSkipListNode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录