Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a3cedbf1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
a3cedbf1
编写于
9月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
0e5b0e59
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
77 addition
and
67 deletion
+77
-67
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+46
-36
source/dnode/vnode/src/tsdb/tsdbDiskData.c
source/dnode/vnode/src/tsdb/tsdbDiskData.c
+31
-31
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
a3cedbf1
...
...
@@ -38,41 +38,42 @@ extern "C" {
goto LABEL; \
}
typedef
struct
TSDBROW
TSDBROW
;
typedef
struct
TABLEID
TABLEID
;
typedef
struct
TSDBKEY
TSDBKEY
;
typedef
struct
SDelData
SDelData
;
typedef
struct
SDelIdx
SDelIdx
;
typedef
struct
STbData
STbData
;
typedef
struct
SMemTable
SMemTable
;
typedef
struct
STbDataIter
STbDataIter
;
typedef
struct
SMapData
SMapData
;
typedef
struct
SBlockIdx
SBlockIdx
;
typedef
struct
SDataBlk
SDataBlk
;
typedef
struct
SSttBlk
SSttBlk
;
typedef
struct
SDiskDataHdr
SDiskDataHdr
;
typedef
struct
SBlockData
SBlockData
;
typedef
struct
SDelFile
SDelFile
;
typedef
struct
SHeadFile
SHeadFile
;
typedef
struct
SDataFile
SDataFile
;
typedef
struct
SSttFile
SSttFile
;
typedef
struct
SSmaFile
SSmaFile
;
typedef
struct
SDFileSet
SDFileSet
;
typedef
struct
SDataFWriter
SDataFWriter
;
typedef
struct
SDataFReader
SDataFReader
;
typedef
struct
SDelFWriter
SDelFWriter
;
typedef
struct
SDelFReader
SDelFReader
;
typedef
struct
SRowIter
SRowIter
;
typedef
struct
STsdbFS
STsdbFS
;
typedef
struct
SRowMerger
SRowMerger
;
typedef
struct
STsdbReadSnap
STsdbReadSnap
;
typedef
struct
SBlockInfo
SBlockInfo
;
typedef
struct
SSmaInfo
SSmaInfo
;
typedef
struct
SBlockCol
SBlockCol
;
typedef
struct
SVersionRange
SVersionRange
;
typedef
struct
SLDataIter
SLDataIter
;
typedef
struct
SDiskCol
SDiskCol
;
typedef
struct
SDiskData
SDiskData
;
typedef
struct
TSDBROW
TSDBROW
;
typedef
struct
TABLEID
TABLEID
;
typedef
struct
TSDBKEY
TSDBKEY
;
typedef
struct
SDelData
SDelData
;
typedef
struct
SDelIdx
SDelIdx
;
typedef
struct
STbData
STbData
;
typedef
struct
SMemTable
SMemTable
;
typedef
struct
STbDataIter
STbDataIter
;
typedef
struct
SMapData
SMapData
;
typedef
struct
SBlockIdx
SBlockIdx
;
typedef
struct
SDataBlk
SDataBlk
;
typedef
struct
SSttBlk
SSttBlk
;
typedef
struct
SDiskDataHdr
SDiskDataHdr
;
typedef
struct
SBlockData
SBlockData
;
typedef
struct
SDelFile
SDelFile
;
typedef
struct
SHeadFile
SHeadFile
;
typedef
struct
SDataFile
SDataFile
;
typedef
struct
SSttFile
SSttFile
;
typedef
struct
SSmaFile
SSmaFile
;
typedef
struct
SDFileSet
SDFileSet
;
typedef
struct
SDataFWriter
SDataFWriter
;
typedef
struct
SDataFReader
SDataFReader
;
typedef
struct
SDelFWriter
SDelFWriter
;
typedef
struct
SDelFReader
SDelFReader
;
typedef
struct
SRowIter
SRowIter
;
typedef
struct
STsdbFS
STsdbFS
;
typedef
struct
SRowMerger
SRowMerger
;
typedef
struct
STsdbReadSnap
STsdbReadSnap
;
typedef
struct
SBlockInfo
SBlockInfo
;
typedef
struct
SSmaInfo
SSmaInfo
;
typedef
struct
SBlockCol
SBlockCol
;
typedef
struct
SVersionRange
SVersionRange
;
typedef
struct
SLDataIter
SLDataIter
;
typedef
struct
SDiskCol
SDiskCol
;
typedef
struct
SDiskData
SDiskData
;
typedef
struct
SDiskDataBuilder
SDiskDataBuilder
;
#define TSDB_FILE_DLMT ((uint32_t)0xF00AFA0F)
#define TSDB_MAX_SUBBLOCKS 8
...
...
@@ -302,7 +303,7 @@ int32_t tsdbMerge(STsdb *pTsdb);
#define TSDB_CACHE_LAST_ROW(c) (((c).cacheLast & 1) > 0)
#define TSDB_CACHE_LAST(c) (((c).cacheLast & 2) > 0)
// tsdbCache
// tsdbCache
==============================================================================================
int32_t
tsdbOpenCache
(
STsdb
*
pTsdb
);
void
tsdbCloseCache
(
STsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
,
STsdb
*
pTsdb
);
...
...
@@ -320,6 +321,15 @@ size_t tsdbCacheGetCapacity(SVnode *pVnode);
int32_t
tsdbCacheLastArray2Row
(
SArray
*
pLastArray
,
STSRow
**
ppRow
,
STSchema
*
pSchema
);
// tsdbDiskData ==============================================================================================
int32_t
tDiskDataBuilderCreate
(
SDiskDataBuilder
**
ppBuilder
);
void
*
tDiskDataBuilderDestroy
(
SDiskDataBuilder
*
pBuilder
);
int32_t
tDiskDataBuilderInit
(
SDiskDataBuilder
*
pBuilder
,
STSchema
*
pTSchema
,
TABLEID
*
pId
,
uint8_t
cmprAlg
,
uint8_t
calcSma
);
int32_t
tDiskDataBuilderAddRow
(
SDiskDataBuilder
*
pBuilder
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
,
TABLEID
*
pId
);
int32_t
tGnrtDiskData
(
SDiskDataBuilder
*
pBuilder
,
SDiskData
*
pDiskData
);
int32_t
tDiskDataDestroy
(
SDiskData
*
pDiskData
);
// structs =======================
struct
STsdbFS
{
SDelFile
*
pDelFile
;
...
...
source/dnode/vnode/src/tsdb/tsdbDiskData.c
浏览文件 @
a3cedbf1
...
...
@@ -15,8 +15,7 @@
#include "tsdb.h"
typedef
struct
SDiskDataBuilder
SDiskDataBuilder
;
typedef
struct
SDiskColBuilder
SDiskColBuilder
;
typedef
struct
SDiskColBuilder
SDiskColBuilder
;
struct
SDiskColBuilder
{
int16_t
cid
;
...
...
@@ -45,6 +44,19 @@ struct SDiskDataBuilder {
};
// SDiskColBuilder ================================================
#define tDiskColBuilderCreate() \
(SDiskColBuilder) { 0 }
static
int32_t
tDiskColBuilderDestroy
(
SDiskColBuilder
*
pBuilder
)
{
int32_t
code
=
0
;
tFree
(
pBuilder
->
pBitMap
);
if
(
pBuilder
->
pOffC
)
tCompressorDestroy
(
pBuilder
->
pOffC
);
if
(
pBuilder
->
pValC
)
tCompressorDestroy
(
pBuilder
->
pValC
);
return
code
;
}
static
int32_t
tDiskColBuilderInit
(
SDiskColBuilder
*
pBuilder
,
int16_t
cid
,
int8_t
type
,
uint8_t
cmprAlg
)
{
int32_t
code
=
0
;
...
...
@@ -74,16 +86,6 @@ static int32_t tDiskColBuilderInit(SDiskColBuilder *pBuilder, int16_t cid, int8_
return
code
;
}
static
int32_t
tDiskColBuilderClear
(
SDiskColBuilder
*
pBuilder
)
{
int32_t
code
=
0
;
tFree
(
pBuilder
->
pBitMap
);
if
(
pBuilder
->
pOffC
)
tCompressorDestroy
(
pBuilder
->
pOffC
);
if
(
pBuilder
->
pValC
)
tCompressorDestroy
(
pBuilder
->
pValC
);
return
code
;
}
static
int32_t
tGnrtDiskCol
(
SDiskColBuilder
*
pBuilder
,
SDiskCol
*
pDiskCol
)
{
int32_t
code
=
0
;
...
...
@@ -419,7 +421,7 @@ void *tDiskDataBuilderDestroy(SDiskDataBuilder *pBuilder) {
if
(
pBuilder
->
aBuilder
)
{
for
(
int32_t
iBuilder
=
0
;
iBuilder
<
taosArrayGetSize
(
pBuilder
->
aBuilder
);
iBuilder
++
)
{
SDiskColBuilder
*
pDCBuilder
=
(
SDiskColBuilder
*
)
taosArrayGet
(
pBuilder
->
aBuilder
,
iBuilder
);
tDiskColBuilder
Clear
(
pDCBuilder
);
tDiskColBuilder
Destroy
(
pDCBuilder
);
}
taosArrayDestroy
(
pBuilder
->
aBuilder
);
}
...
...
@@ -466,7 +468,7 @@ int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TAB
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iCol
];
if
(
pBuilder
->
nBuilder
>=
taosArrayGetSize
(
pBuilder
->
aBuilder
))
{
SDiskColBuilder
dc
=
{
0
}
;
SDiskColBuilder
dc
=
tDiskColBuilderCreate
()
;
if
(
taosArrayPush
(
pBuilder
->
aBuilder
,
&
dc
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
...
...
@@ -491,51 +493,51 @@ int32_t tDiskDataBuilderAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSche
// uid
if
(
pBuilder
->
uid
&&
pBuilder
->
uid
!=
pId
->
uid
)
{
ASSERT
(
!
pBuilder
->
calcSma
);
for
(
int32_t
iRow
=
0
;
iRow
<
pBuilder
->
nRow
;
iRow
++
)
{
code
=
tCompress
(
pBuilder
->
pUidC
,
&
pBuilder
->
uid
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
if
(
code
)
return
code
;
}
pBuilder
->
uid
=
0
;
}
if
(
pBuilder
->
uid
==
0
)
{
code
=
tCompress
(
pBuilder
->
pUidC
,
&
pId
->
uid
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
if
(
code
)
return
code
;
}
// version
int64_t
version
=
TSDBROW_VERSION
(
pRow
);
code
=
tCompress
(
pBuilder
->
pVerC
,
&
version
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
if
(
code
)
return
code
;
// TSKEY
TSKEY
ts
=
TSDBROW_TS
(
pRow
);
code
=
tCompress
(
pBuilder
->
pKeyC
,
&
ts
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
if
(
code
)
return
code
;
SRowIter
iter
=
{
0
};
tRowIterInit
(
&
iter
,
pRow
,
pTSchema
);
SColVal
*
pColVal
=
tRowIterNext
(
&
iter
);
for
(
int32_t
i
DiskColBuilder
=
0
;
iDiskColBuilder
<
pBuilder
->
nBuilder
;
iDiskCol
Builder
++
)
{
SDiskColBuilder
*
pD
iskColBuilder
=
(
SDiskColBuilder
*
)
taosArrayGet
(
pBuilder
->
aBuilder
,
iDiskCol
Builder
);
for
(
int32_t
i
Builder
=
0
;
iBuilder
<
pBuilder
->
nBuilder
;
i
Builder
++
)
{
SDiskColBuilder
*
pD
CBuilder
=
(
SDiskColBuilder
*
)
taosArrayGet
(
pBuilder
->
aBuilder
,
i
Builder
);
while
(
pColVal
&&
pColVal
->
cid
<
pD
iskCol
Builder
->
cid
)
{
while
(
pColVal
&&
pColVal
->
cid
<
pD
C
Builder
->
cid
)
{
pColVal
=
tRowIterNext
(
&
iter
);
}
if
(
pColVal
==
NULL
||
pColVal
->
cid
>
pD
iskCol
Builder
->
cid
)
{
SColVal
cv
=
COL_VAL_NONE
(
pD
iskColBuilder
->
cid
,
pDiskCol
Builder
->
type
);
code
=
tDiskColAddValImpl
[
pD
iskColBuilder
->
flag
](
pDiskCol
Builder
,
&
cv
);
if
(
code
)
goto
_exit
;
if
(
pColVal
==
NULL
||
pColVal
->
cid
>
pD
C
Builder
->
cid
)
{
SColVal
cv
=
COL_VAL_NONE
(
pD
CBuilder
->
cid
,
pDC
Builder
->
type
);
code
=
tDiskColAddValImpl
[
pD
CBuilder
->
flag
](
pDC
Builder
,
&
cv
);
if
(
code
)
return
code
;
}
else
{
code
=
tDiskColAddValImpl
[
pD
iskColBuilder
->
flag
](
pDiskCol
Builder
,
pColVal
);
if
(
code
)
goto
_exit
;
code
=
tDiskColAddValImpl
[
pD
CBuilder
->
flag
](
pDC
Builder
,
pColVal
);
if
(
code
)
return
code
;
pColVal
=
tRowIterNext
(
&
iter
);
}
}
pBuilder
->
nRow
++
;
_exit:
return
code
;
}
...
...
@@ -601,9 +603,7 @@ int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, SDiskData *pDiskData) {
return
code
;
}
if
(
pDCBuilder
->
flag
!=
HAS_NULL
)
{
pDiskData
->
hdr
.
szBlkCol
+=
tPutBlockCol
(
NULL
,
&
dCol
.
bCol
);
}
pDiskData
->
hdr
.
szBlkCol
+=
tPutBlockCol
(
NULL
,
&
dCol
.
bCol
);
}
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录