Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e2f99ba0
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2f99ba0
编写于
8月 30, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
5a636ae5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
140 addition
and
6 deletion
+140
-6
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-0
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+6
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+0
-6
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+133
-0
未找到文件。
source/dnode/vnode/CMakeLists.txt
浏览文件 @
e2f99ba0
...
@@ -52,6 +52,7 @@ target_sources(
...
@@ -52,6 +52,7 @@ target_sources(
"src/tsdb/tsdbDiskData.c"
"src/tsdb/tsdbDiskData.c"
"src/tsdb/tsdbCompress.c"
"src/tsdb/tsdbCompress.c"
"src/tsdb/tsdbCompact.c"
"src/tsdb/tsdbCompact.c"
"src/tsdb/tsdbMergeTree.c"
# tq
# tq
"src/tq/tq.c"
"src/tq/tq.c"
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
e2f99ba0
...
@@ -620,6 +620,12 @@ struct SDataFReader {
...
@@ -620,6 +620,12 @@ struct SDataFReader {
uint8_t
*
aBuf
[
3
];
uint8_t
*
aBuf
[
3
];
};
};
typedef
struct
{
int64_t
suid
;
int64_t
uid
;
TSDBROW
row
;
}
SRowInfo
;
// ========== inline functions ==========
// ========== inline functions ==========
static
FORCE_INLINE
int32_t
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
static
FORCE_INLINE
int32_t
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
TSDBKEY
*
pKey1
=
(
TSDBKEY
*
)
p1
;
TSDBKEY
*
pKey1
=
(
TSDBKEY
*
)
p1
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
e2f99ba0
...
@@ -20,12 +20,6 @@ typedef struct {
...
@@ -20,12 +20,6 @@ typedef struct {
STSchema
*
pTSchema
;
STSchema
*
pTSchema
;
}
SSkmInfo
;
}
SSkmInfo
;
typedef
struct
{
int64_t
suid
;
int64_t
uid
;
TSDBROW
row
;
}
SRowInfo
;
typedef
enum
{
MEMORY_DATA_ITER
=
0
,
LAST_DATA_ITER
}
EDataIterT
;
typedef
enum
{
MEMORY_DATA_ITER
=
0
,
LAST_DATA_ITER
}
EDataIterT
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
0 → 100644
浏览文件 @
e2f99ba0
/*
* 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/>.
*/
#include "tsdb.h"
// SLDataIter =================================================
typedef
struct
{
SRBTreeNode
node
;
SBlockL
*
pBlockL
;
SRowInfo
*
pRowInfo
;
SDataFReader
*
pReader
;
int32_t
iLast
;
int8_t
backward
;
SArray
*
aBlockL
;
int32_t
iBlockL
;
SBlockData
bData
;
int32_t
iRow
;
SRowInfo
rInfo
;
}
SLDataIter
;
int32_t
tLDataIterOpen
(
SLDataIter
*
pIter
,
SDataFReader
*
pReader
,
int32_t
iLast
,
int8_t
backward
)
{
int32_t
code
=
0
;
pIter
->
pReader
=
pReader
;
pIter
->
iLast
=
iLast
;
pIter
->
backward
=
backward
;
pIter
->
aBlockL
=
taosArrayInit
(
0
,
sizeof
(
SBlockL
));
if
(
pIter
->
aBlockL
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
code
=
tBlockDataCreate
(
&
pIter
->
bData
);
if
(
code
)
goto
_exit
;
code
=
tsdbReadBlockL
(
pReader
,
iLast
,
pIter
->
aBlockL
);
if
(
code
)
goto
_exit
;
if
(
backward
)
{
pIter
->
iBlockL
=
taosArrayGetSize
(
pIter
->
aBlockL
)
-
1
;
}
else
{
pIter
->
iBlockL
=
0
;
}
_exit:
return
code
;
}
void
tLDataIterClose
(
SLDataIter
*
pIter
)
{
tBlockDataDestroy
(
&
pIter
->
bData
,
1
);
taosArrayDestroy
(
pIter
->
aBlockL
);
}
extern
int32_t
tsdbReadLastBlockEx
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
);
void
tLDataIterNextBlock
(
SLDataIter
*
pIter
)
{
if
(
pIter
->
backward
)
{
pIter
->
iBlockL
--
;
}
else
{
pIter
->
iBlockL
++
;
}
if
(
pIter
->
iBlockL
>=
0
&&
pIter
->
iBlockL
<
taosArrayGetSize
(
pIter
->
aBlockL
))
{
pIter
->
pBlockL
=
(
SBlockL
*
)
taosArrayGet
(
pIter
->
aBlockL
,
pIter
->
iBlockL
);
}
else
{
pIter
->
pBlockL
=
NULL
;
}
}
int32_t
tLDataIterNextRow
(
SLDataIter
*
pIter
)
{
int32_t
code
=
0
;
if
(
pIter
->
backward
)
{
pIter
->
iRow
--
;
if
(
pIter
->
iRow
<
0
)
{
pIter
->
iBlockL
--
;
if
(
pIter
->
iBlockL
>=
0
)
{
code
=
tsdbReadLastBlockEx
(
pIter
->
pReader
,
pIter
->
iLast
,
taosArrayGet
(
pIter
->
aBlockL
,
pIter
->
iBlockL
),
&
pIter
->
bData
);
if
(
code
)
goto
_exit
;
}
else
{
// TODO: no more data here
}
}
}
else
{
pIter
->
iRow
++
;
if
(
pIter
->
iRow
>=
pIter
->
bData
.
nRow
)
{
pIter
->
iBlockL
++
;
if
(
pIter
->
iBlockL
<
taosArrayGetSize
(
pIter
->
aBlockL
))
{
code
=
tsdbReadLastBlockEx
(
pIter
->
pReader
,
pIter
->
iLast
,
taosArrayGet
(
pIter
->
aBlockL
,
pIter
->
iBlockL
),
&
pIter
->
bData
);
if
(
code
)
goto
_exit
;
}
else
{
// TODO: not more data
goto
_exit
;
}
}
}
pIter
->
rInfo
.
suid
=
pIter
->
bData
.
suid
;
pIter
->
rInfo
.
uid
=
pIter
->
bData
.
uid
;
pIter
->
rInfo
.
row
=
tsdbRowFromBlockData
(
&
pIter
->
bData
,
pIter
->
iRow
);
_exit:
return
code
;
}
SRowInfo
*
tLDataIterGet
(
SLDataIter
*
pIter
)
{
// TODO
return
NULL
;
}
// SMergeTree =================================================
typedef
struct
{
int8_t
backward
;
SRBTreeNode
*
pNode
;
SRBTree
rbt
;
}
SMergeTree
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录