Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eb2fb724
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,发现更多精彩内容 >>
提交
eb2fb724
编写于
8月 25, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
cfa666f2
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
68 addition
and
17 deletion
+68
-17
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbMerge.c
source/dnode/vnode/src/tsdb/tsdbMerge.c
+48
-12
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+16
-1
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
eb2fb724
...
...
@@ -266,7 +266,7 @@ int32_t tsdbReadBlock(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *pMa
int32_t
tsdbReadBlockL
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SArray
*
aBlockL
);
int32_t
tsdbReadBlockSma
(
SDataFReader
*
pReader
,
SBlock
*
pBlock
,
SArray
*
aColumnDataAgg
);
int32_t
tsdbReadDataBlock
(
SDataFReader
*
pReader
,
SBlock
*
pBlock
,
SBlockData
*
pBlockData
);
int32_t
tsdbReadLastBlock
(
SDataFReader
*
pReader
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
);
int32_t
tsdbReadLastBlock
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
);
// SDelFWriter
int32_t
tsdbDelFWriterOpen
(
SDelFWriter
**
ppWriter
,
SDelFile
*
pFile
,
STsdb
*
pTsdb
);
int32_t
tsdbDelFWriterClose
(
SDelFWriter
**
ppWriter
,
int8_t
sync
);
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
eb2fb724
...
...
@@ -503,7 +503,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
if
(
code
)
goto
_err
;
}
case
SFSLASTNEXTROW_BLOCKDATA
:
code
=
tsdbReadLastBlock
(
state
->
pDataFReader
,
state
->
pBlockL
,
state
->
pBlockDataL
);
code
=
tsdbReadLastBlock
(
state
->
pDataFReader
,
0
,
state
->
pBlockL
,
state
->
pBlockDataL
);
if
(
code
)
goto
_err
;
state
->
nRow
=
state
->
blockDataL
.
nRow
;
...
...
source/dnode/vnode/src/tsdb/tsdbMerge.c
浏览文件 @
eb2fb724
...
...
@@ -128,8 +128,8 @@ typedef struct {
struct
{
SDataFReader
*
pReader
;
SArray
*
aBlockIdx
;
SLDataIter
aLDataiter
[
TSDB_MAX_LAST_FILE
];
SDataMerger
merger
;
SArray
*
aBlockL
[
TSDB_MAX_LAST_FILE
];
}
dReader
;
struct
{
SDataFWriter
*
pWriter
;
...
...
@@ -140,6 +140,9 @@ typedef struct {
}
dWriter
;
}
STsdbMerger
;
extern
int32_t
tsdbReadLastBlockEx
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
);
// todo
static
int32_t
tsdbMergeFileDataStart
(
STsdbMerger
*
pMerger
,
SDFileSet
*
pSet
)
{
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pMerger
->
pTsdb
;
...
...
@@ -151,9 +154,42 @@ static int32_t tsdbMergeFileDataStart(STsdbMerger *pMerger, SDFileSet *pSet) {
code
=
tsdbReadBlockIdx
(
pMerger
->
dReader
.
pReader
,
pMerger
->
dReader
.
aBlockIdx
);
if
(
code
)
goto
_err
;
pMerger
->
dReader
.
merger
.
pNode
=
NULL
;
pMerger
->
dReader
.
merger
.
rbt
=
tRBTreeCreate
(
tRowInfoCmprFn
);
for
(
int8_t
iLast
=
0
;
iLast
<
pSet
->
nLastF
;
iLast
++
)
{
code
=
tsdbReadBlockL
(
pMerger
->
dReader
.
pReader
,
iLast
,
pMerger
->
dReader
.
aBlockL
[
iLast
]);
SRBTreeNode
*
pNode
=
(
SRBTreeNode
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pNode
)
+
sizeof
(
SLDataIter
));
if
(
pNode
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
SLDataIter
*
pIter
=
(
SLDataIter
*
)
pNode
->
payload
;
pIter
->
aBlockL
=
taosArrayInit
(
0
,
sizeof
(
SBlockL
));
if
(
pIter
->
aBlockL
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
code
=
tBlockDataCreate
(
&
pIter
->
bData
);
if
(
code
)
goto
_err
;
code
=
tsdbReadBlockL
(
pMerger
->
dReader
.
pReader
,
iLast
,
pIter
->
aBlockL
);
if
(
code
)
goto
_err
;
if
(
taosArrayGetSize
(
pIter
->
aBlockL
)
==
0
)
continue
;
pIter
->
iBlockL
=
0
;
SBlockL
*
pBlockL
=
(
SBlockL
*
)
taosArrayGet
(
pIter
->
aBlockL
,
0
);
code
=
tsdbReadLastBlockEx
(
pMerger
->
dReader
.
pReader
,
iLast
,
pBlockL
,
&
pIter
->
bData
);
if
(
code
)
goto
_err
;
pIter
->
iRow
=
0
;
pIter
->
rowInfo
.
suid
=
pIter
->
bData
.
suid
;
pIter
->
rowInfo
.
uid
=
pIter
->
bData
.
uid
?
pIter
->
bData
.
uid
:
pIter
->
bData
.
aUid
[
0
];
pIter
->
rowInfo
.
row
=
tsdbRowFromBlockData
(
&
pIter
->
bData
,
0
);
pNode
=
tRBTreePut
(
&
pMerger
->
dReader
.
merger
.
rbt
,
pNode
);
ASSERT
(
pNode
);
}
// writer
...
...
@@ -261,13 +297,13 @@ static int32_t tsdbStartMerge(STsdbMerger *pMerger, STsdb *pTsdb) {
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
for
(
int8_t
iLast
=
0
;
iLast
<
TSDB_MAX_LAST_FILE
;
iLast
++
)
{
pMerger
->
dReader
.
aBlockL
[
iLast
]
=
taosArrayInit
(
0
,
sizeof
(
SBlockL
));
if
(
pMerger
->
dReader
.
aBlockL
[
iLast
]
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
}
//
for (int8_t iLast = 0; iLast < TSDB_MAX_LAST_FILE; iLast++) {
//
pMerger->dReader.aBlockL[iLast] = taosArrayInit(0, sizeof(SBlockL));
//
if (pMerger->dReader.aBlockL[iLast] == NULL) {
//
code = TSDB_CODE_OUT_OF_MEMORY;
//
goto _exit;
//
}
//
}
// writer
pMerger
->
dWriter
.
aBlockIdx
=
taosArrayInit
(
0
,
sizeof
(
SBlockIdx
));
...
...
@@ -305,9 +341,9 @@ static int32_t tsdbEndMerge(STsdbMerger *pMerger) {
taosArrayDestroy
(
pMerger
->
dWriter
.
aBlockIdx
);
// reader
for
(
int8_t
iLast
=
0
;
iLast
<
TSDB_MAX_LAST_FILE
;
iLast
++
)
{
taosArrayDestroy
(
pMerger
->
dReader
.
aBlockL
[
iLast
]);
}
//
for (int8_t iLast = 0; iLast < TSDB_MAX_LAST_FILE; iLast++) {
//
taosArrayDestroy(pMerger->dReader.aBlockL[iLast]);
//
}
taosArrayDestroy
(
pMerger
->
dReader
.
aBlockIdx
);
tsdbFSDestroy
(
&
pMerger
->
fs
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
eb2fb724
...
...
@@ -2391,7 +2391,7 @@ static int32_t doLoadRelatedLastBlock(SLastBlockReader* pLastBlockReader, STable
return
code
;
}
code
=
tsdbReadLastBlock
(
pReader
->
pFileReader
,
pBlock
,
&
pLastBlockReader
->
lastBlockData
);
code
=
tsdbReadLastBlock
(
pReader
->
pFileReader
,
0
,
pBlock
,
&
pLastBlockReader
->
lastBlockData
);
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
eb2fb724
...
...
@@ -908,7 +908,7 @@ _err:
return
code
;
}
int32_t
tsdbReadLastBlock
(
SDataFReader
*
pReader
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
)
{
int32_t
tsdbReadLastBlock
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
)
{
int32_t
code
=
0
;
code
=
tsdbReadBlockDataImpl
(
pReader
,
&
pBlockL
->
bInfo
,
1
,
pBlockData
);
...
...
@@ -921,6 +921,21 @@ _err:
return
code
;
}
int32_t
tsdbReadLastBlockEx
(
SDataFReader
*
pReader
,
int32_t
iLast
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
)
{
int32_t
code
=
0
;
// read
code
=
tsdbReadAndCheck
(
pReader
->
aLastFD
[
iLast
],
pBlockL
->
bInfo
.
offset
,
&
pReader
->
aBuf
[
1
],
pBlockL
->
bInfo
.
szBlock
,
0
);
if
(
code
)
goto
_exit
;
// decmpr
code
=
tDecmprBlockData
(
pReader
->
aBuf
[
1
],
pBlockL
->
bInfo
.
szBlock
,
pBlockData
,
&
pReader
->
aBuf
[
1
]);
if
(
code
)
goto
_exit
;
_exit:
return
code
;
}
// SDataFWriter ====================================================
int32_t
tsdbDataFWriterOpen
(
SDataFWriter
**
ppWriter
,
STsdb
*
pTsdb
,
SDFileSet
*
pSet
)
{
int32_t
code
=
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
eb2fb724
...
...
@@ -1619,7 +1619,7 @@ _exit:
int32_t
tDecmprBlockData
(
uint8_t
*
pIn
,
int32_t
szIn
,
SBlockData
*
pBlockData
,
uint8_t
*
aBuf
[])
{
int32_t
code
=
0
;
tBlockData
Clear
(
pBlockData
);
tBlockData
Reset
(
pBlockData
);
int32_t
n
=
0
;
SDiskDataHdr
hdr
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录