Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e827d0bb
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,发现更多精彩内容 >>
提交
e827d0bb
编写于
8月 03, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more last file refact
上级
e996bb45
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
283 addition
and
254 deletion
+283
-254
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+13
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+239
-249
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+29
-5
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+2
-0
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
e827d0bb
...
...
@@ -233,6 +233,12 @@ int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, uint8_
SBlockIdx
*
pBlockIdx
,
SBlock
*
pBlock
,
int8_t
cmprAlg
);
int32_t
tsdbDFileSetCopy
(
STsdb
*
pTsdb
,
SDFileSet
*
pSetFrom
,
SDFileSet
*
pSetTo
);
/* new */
int32_t
tsdbWriteDataBlock
(
SDataFWriter
*
pWriter
,
SBlockData
*
pBlockData
,
SBlock
*
pBlock
,
uint8_t
**
ppBuf1
,
uint8_t
**
ppBuf2
,
int8_t
cmprAlg
);
int32_t
tsdbWriteLastBlock
(
SDataFWriter
*
pWriter
,
SBlockData
*
pBlockData
,
SBlockL
*
pBlockL
,
uint8_t
**
ppBuf1
,
uint8_t
**
ppBuf2
,
int8_t
cmprAlg
);
// SDataFReader
int32_t
tsdbDataFReaderOpen
(
SDataFReader
**
ppReader
,
STsdb
*
pTsdb
,
SDFileSet
*
pSet
);
int32_t
tsdbDataFReaderClose
(
SDataFReader
**
ppReader
);
...
...
@@ -244,6 +250,12 @@ int32_t tsdbReadColData(SDataFReader *pReader, SBlockIdx *pBlockIdx, SBlock *pBl
int32_t
tsdbReadBlockData
(
SDataFReader
*
pReader
,
SBlockIdx
*
pBlockIdx
,
SBlock
*
pBlock
,
SBlockData
*
pBlockData
,
uint8_t
**
ppBuf1
,
uint8_t
**
ppBuf2
);
int32_t
tsdbReadBlockSma
(
SDataFReader
*
pReader
,
SBlock
*
pBlock
,
SArray
*
aColumnDataAgg
,
uint8_t
**
ppBuf
);
/* new */
int32_t
tsdbReadDataBlock
(
SDataFReader
*
pReader
,
SBlock
*
pBlock
,
SBlockData
*
pBlockData
,
uint8_t
**
ppBuf1
,
uint8_t
**
ppBuf2
);
int32_t
tsdbReadLastBlock
(
SDataFReader
*
pReader
,
SBlockL
*
pBlockL
,
SBlockData
*
pBlockData
,
uint8_t
**
ppBuf1
,
uint8_t
**
ppBuf2
);
// SDelFWriter
int32_t
tsdbDelFWriterOpen
(
SDelFWriter
**
ppWriter
,
SDelFile
*
pFile
,
STsdb
*
pTsdb
);
int32_t
tsdbDelFWriterClose
(
SDelFWriter
**
ppWriter
,
int8_t
sync
);
...
...
@@ -457,6 +469,7 @@ struct SColData {
};
struct
SBlockData
{
int64_t
suid
;
int32_t
nRow
;
int64_t
*
aUid
;
int64_t
*
aVersion
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
e827d0bb
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
e827d0bb
...
...
@@ -543,9 +543,13 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx, uint8_t **ppB
uint32_t
delimiter
;
SBlockIdx
blockIdx
;
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
taosArrayClear
(
aBlockIdx
);
if
(
size
==
0
)
{
goto
_exit
;
}
// alloc
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
code
=
tRealloc
(
ppBuf
,
size
);
if
(
code
)
goto
_err
;
...
...
@@ -576,7 +580,6 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx, uint8_t **ppB
n
=
tGetU32
(
*
ppBuf
+
n
,
&
delimiter
);
ASSERT
(
delimiter
==
TSDB_FILE_DLMT
);
taosArrayClear
(
aBlockIdx
);
while
(
n
<
size
-
sizeof
(
TSCKSUM
))
{
n
+=
tGetBlockIdx
(
*
ppBuf
+
n
,
&
blockIdx
);
...
...
@@ -588,6 +591,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx, uint8_t **ppB
ASSERT
(
n
+
sizeof
(
TSCKSUM
)
==
size
);
_exit:
tFree
(
pBuf
);
return
code
;
...
...
@@ -606,9 +610,13 @@ int32_t tsdbReadBlockL(SDataFReader *pReader, SArray *aBlockL, uint8_t **ppBuf)
uint8_t
*
pBuf
=
NULL
;
SBlockL
blockl
;
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
taosArrayClear
(
aBlockL
);
if
(
size
==
0
)
{
goto
_exit
;
}
// alloc
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
code
=
tRealloc
(
ppBuf
,
size
);
if
(
code
)
goto
_err
;
...
...
@@ -639,7 +647,6 @@ int32_t tsdbReadBlockL(SDataFReader *pReader, SArray *aBlockL, uint8_t **ppBuf)
n
=
tGetU32
(
*
ppBuf
+
n
,
&
delimiter
);
ASSERT
(
delimiter
==
TSDB_FILE_DLMT
);
taosArrayClear
(
aBlockL
);
while
(
n
<
size
-
sizeof
(
TSCKSUM
))
{
n
+=
tGetBlockL
(
*
ppBuf
+
n
,
&
blockl
);
...
...
@@ -651,11 +658,13 @@ int32_t tsdbReadBlockL(SDataFReader *pReader, SArray *aBlockL, uint8_t **ppBuf)
ASSERT
(
n
+
sizeof
(
TSCKSUM
)
==
size
);
_exit:
tFree
(
pBuf
);
return
code
;
_err:
tsdbError
(
"vgId:%d read blockl failed since %s"
,
TD_VID
(
pReader
->
pTsdb
->
pVnode
),
tstrerror
(
code
));
tFree
(
pBuf
);
return
code
;
}
...
...
@@ -1562,7 +1571,11 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx, uint8_t **pp
int64_t
size
;
int64_t
n
;
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
// check
if
(
taosArrayGetSize
(
aBlockIdx
)
==
0
)
{
pHeadFile
->
offset
=
pHeadFile
->
size
;
goto
_exit
;
}
// prepare
size
=
tPutU32
(
NULL
,
TSDB_FILE_DLMT
);
...
...
@@ -1572,6 +1585,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx, uint8_t **pp
size
+=
sizeof
(
TSCKSUM
);
// alloc
if
(
!
ppBuf
)
ppBuf
=
&
pBuf
;
code
=
tRealloc
(
ppBuf
,
size
);
if
(
code
)
goto
_err
;
...
...
@@ -1596,6 +1610,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx, uint8_t **pp
pHeadFile
->
offset
=
pHeadFile
->
size
;
pHeadFile
->
size
+=
size
;
_exit:
tFree
(
pBuf
);
return
code
;
...
...
@@ -1662,6 +1677,12 @@ int32_t tsdbWriteBlockL(SDataFWriter *pWriter, SArray *aBlockL, uint8_t **ppBuf)
int64_t
size
;
int64_t
n
;
// check
if
(
taosArrayGetSize
(
aBlockL
)
==
0
)
{
pHeadFile
->
loffset
=
pHeadFile
->
size
;
goto
_exit
;
}
// size
size
=
sizeof
(
uint32_t
);
for
(
int32_t
iBlockL
=
0
;
iBlockL
<
taosArrayGetSize
(
aBlockL
);
iBlockL
++
)
{
...
...
@@ -1695,10 +1716,13 @@ int32_t tsdbWriteBlockL(SDataFWriter *pWriter, SArray *aBlockL, uint8_t **ppBuf)
pHeadFile
->
loffset
=
pHeadFile
->
size
;
pHeadFile
->
size
+=
size
;
_exit:
tFree
(
pBuf
);
return
code
;
_err:
tsdbError
(
"vgId:%d tsdb write blockl failed since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
tstrerror
(
code
));
tFree
(
pBuf
);
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
e827d0bb
...
...
@@ -1122,6 +1122,7 @@ int32_t tBlockDataInit(SBlockData *pBlockData) {
int32_t
code
=
0
;
pBlockData
->
nRow
=
0
;
pBlockData
->
aUid
=
NULL
;
pBlockData
->
aVersion
=
NULL
;
pBlockData
->
aTSKEY
=
NULL
;
pBlockData
->
aIdx
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
...
...
@@ -1146,6 +1147,7 @@ void tBlockDataReset(SBlockData *pBlockData) {
}
void
tBlockDataClear
(
SBlockData
*
pBlockData
,
int8_t
deepClear
)
{
tFree
((
uint8_t
*
)
pBlockData
->
aUid
);
tFree
((
uint8_t
*
)
pBlockData
->
aVersion
);
tFree
((
uint8_t
*
)
pBlockData
->
aTSKEY
);
taosArrayDestroy
(
pBlockData
->
aIdx
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录