Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38b4c5c1
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
38b4c5c1
编写于
12月 30, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
1d4a569d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
120 addition
and
9 deletion
+120
-9
include/common/tdataformat.h
include/common/tdataformat.h
+4
-3
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+101
-0
source/dnode/vnode/src/tsdb/tsdbCompact.c
source/dnode/vnode/src/tsdb/tsdbCompact.c
+15
-6
未找到文件。
include/common/tdataformat.h
浏览文件 @
38b4c5c1
...
@@ -137,6 +137,7 @@ void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn)
...
@@ -137,6 +137,7 @@ void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn)
void
tColDataClear
(
SColData
*
pColData
);
void
tColDataClear
(
SColData
*
pColData
);
void
tColDataDeepClear
(
SColData
*
pColData
);
void
tColDataDeepClear
(
SColData
*
pColData
);
int32_t
tColDataAppendValue
(
SColData
*
pColData
,
SColVal
*
pColVal
);
int32_t
tColDataAppendValue
(
SColData
*
pColData
,
SColVal
*
pColVal
);
int32_t
tColDataUpdateValue
(
SColData
*
pColData
,
SColVal
*
pColVal
,
int32_t
flag
);
void
tColDataGetValue
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
);
void
tColDataGetValue
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
);
uint8_t
tColDataGetBitValue
(
const
SColData
*
pColData
,
int32_t
iVal
);
uint8_t
tColDataGetBitValue
(
const
SColData
*
pColData
,
int32_t
iVal
);
int32_t
tColDataCopy
(
SColData
*
pColDataFrom
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
);
int32_t
tColDataCopy
(
SColData
*
pColDataFrom
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
);
...
@@ -146,9 +147,9 @@ extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max,
...
@@ -146,9 +147,9 @@ extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max,
int32_t
tColDataAddValueByBind
(
SColData
*
pColData
,
TAOS_MULTI_BIND
*
pBind
);
int32_t
tColDataAddValueByBind
(
SColData
*
pColData
,
TAOS_MULTI_BIND
*
pBind
);
void
tColDataSortMerge
(
SArray
*
colDataArr
);
void
tColDataSortMerge
(
SArray
*
colDataArr
);
//for raw block
//
for raw block
int32_t
tColDataAddValueByDataBlock
(
SColData
*
pColData
,
int8_t
type
,
int32_t
bytes
,
int32_t
tColDataAddValueByDataBlock
(
SColData
*
pColData
,
int8_t
type
,
int32_t
bytes
,
int32_t
nRows
,
char
*
lengthOrbitmap
,
int32_t
nRows
,
char
*
lengthOrbitmap
,
char
*
data
);
char
*
data
);
// for encode/decode
// for encode/decode
int32_t
tPutColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
int32_t
tPutColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
int32_t
tGetColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
int32_t
tGetColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
...
...
source/common/src/tdataformat.c
浏览文件 @
38b4c5c1
...
@@ -1910,6 +1910,107 @@ int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
...
@@ -1910,6 +1910,107 @@ int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
pColVal
->
value
.
nData
);
pColVal
->
value
.
nData
);
}
}
static
int32_t
tColDataUpdateValue10
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue11
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue12
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue20
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue21
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue22
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue30
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue31
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue32
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue40
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue41
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue42
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue50
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue51
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue52
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue60
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue61
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue62
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue70
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue71
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
tColDataUpdateValue72
(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
{
ASSERT
(
0
);
return
0
;
}
static
int32_t
(
*
tColDataUpdateValueImpl
[
8
][
3
])(
SColData
*
pColData
,
uint8_t
*
pData
,
uint32_t
nData
,
int32_t
flag
)
=
{
{
NULL
,
NULL
,
NULL
},
// 0
{
tColDataUpdateValue10
,
tColDataUpdateValue11
,
tColDataUpdateValue12
},
// HAS_NONE
{
tColDataUpdateValue20
,
tColDataUpdateValue21
,
tColDataUpdateValue22
},
// HAS_NULL
{
tColDataUpdateValue30
,
tColDataUpdateValue31
,
tColDataUpdateValue32
},
// HAS_NULL|HAS_NONE
{
tColDataUpdateValue40
,
tColDataUpdateValue41
,
tColDataUpdateValue42
},
// HAS_VALUE
{
tColDataUpdateValue50
,
tColDataUpdateValue51
,
tColDataUpdateValue52
},
// HAS_VALUE|HAS_NONE
{
tColDataUpdateValue60
,
tColDataUpdateValue61
,
tColDataUpdateValue62
},
// HAS_VALUE|HAS_NULL
{
tColDataUpdateValue70
,
tColDataUpdateValue71
,
tColDataUpdateValue72
},
// HAS_VALUE|HAS_NULL|HAS_NONE
};
int32_t
tColDataUpdateValue
(
SColData
*
pColData
,
SColVal
*
pColVal
,
int32_t
flag
)
{
ASSERT
(
pColData
->
cid
==
pColVal
->
cid
&&
pColData
->
type
==
pColVal
->
type
);
return
tColDataUpdateValueImpl
[
pColData
->
flag
][
pColVal
->
flag
](
pColData
,
IS_VAR_DATA_TYPE
(
pColData
->
type
)
?
pColVal
->
value
.
pData
:
(
uint8_t
*
)
&
pColVal
->
value
.
val
,
pColVal
->
value
.
nData
,
flag
);
}
static
FORCE_INLINE
void
tColDataGetValue1
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
)
{
// HAS_NONE
static
FORCE_INLINE
void
tColDataGetValue1
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
)
{
// HAS_NONE
*
pColVal
=
COL_VAL_NONE
(
pColData
->
cid
,
pColData
->
type
);
*
pColVal
=
COL_VAL_NONE
(
pColData
->
cid
,
pColData
->
type
);
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbCompact.c
浏览文件 @
38b4c5c1
...
@@ -530,6 +530,8 @@ static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) {
...
@@ -530,6 +530,8 @@ static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) {
int64_t
version
;
int64_t
version
;
if
(
pCompactor
->
iKey
<
taosArrayGetSize
(
pCompactor
->
aSkyLine
))
{
if
(
pCompactor
->
iKey
<
taosArrayGetSize
(
pCompactor
->
aSkyLine
))
{
version
=
TMAX
(
pCompactor
->
sKey
.
version
,
pCompactor
->
aTSDBKEY
[
pCompactor
->
iKey
].
version
);
version
=
TMAX
(
pCompactor
->
sKey
.
version
,
pCompactor
->
aTSDBKEY
[
pCompactor
->
iKey
].
version
);
}
else
{
version
=
pCompactor
->
sKey
.
version
;
}
}
if
(
tKey
.
version
>
version
)
{
if
(
tKey
.
version
>
version
)
{
...
@@ -858,15 +860,19 @@ int32_t tsdbCompact(STsdb *pTsdb, int32_t flag) {
...
@@ -858,15 +860,19 @@ int32_t tsdbCompact(STsdb *pTsdb, int32_t flag) {
if
(
pCompactor
->
pDFileSet
==
NULL
)
break
;
if
(
pCompactor
->
pDFileSet
==
NULL
)
break
;
// loop to merge row by row
// loop to merge row by row
SRowInfo
*
pRowInfo
=
NULL
;
SRowInfo
*
pRowInfo
;
STSchema
*
pTSchema
=
NULL
;
STSchema
*
pTSchema
;
int64_t
nRow
=
0
;
int64_t
nRow
=
0
;
for
(;;)
{
code
=
tsdbCompactGetRow
(
pCompactor
,
&
pRowInfo
,
&
pTSchema
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
pRowInfo
==
NULL
)
break
;
code
=
tsdbCompactGetRow
(
pCompactor
,
&
pRowInfo
,
&
pTSchema
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
pRowInfo
&&
(
code
=
tBlockDataInit
(
&
pCompactor
->
bData
,
&
(
TABLEID
){.
suid
=
pRowInfo
->
suid
,
.
uid
=
pRowInfo
->
uid
},
pTSchema
,
NULL
,
0
)))
{
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
while
(
pRowInfo
)
{
nRow
++
;
nRow
++
;
if
(
pCompactor
->
bData
.
suid
==
0
&&
pCompactor
->
bData
.
uid
==
0
)
{
// init the block data if not initialized yet
if
(
pCompactor
->
bData
.
suid
==
0
&&
pCompactor
->
bData
.
uid
==
0
)
{
// init the block data if not initialized yet
...
@@ -907,6 +913,9 @@ int32_t tsdbCompact(STsdb *pTsdb, int32_t flag) {
...
@@ -907,6 +913,9 @@ int32_t tsdbCompact(STsdb *pTsdb, int32_t flag) {
// iterate to next row
// iterate to next row
code
=
tsdbCompactNextRow
(
pCompactor
);
code
=
tsdbCompactNextRow
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbCompactGetRow
(
pCompactor
,
&
pRowInfo
,
&
pTSchema
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录