Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9a261ab2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9a261ab2
编写于
2月 02, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improvement: optimize build table delete skyline performance
上级
c8394cbf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
142 addition
and
3 deletion
+142
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-2
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+137
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
9a261ab2
...
...
@@ -81,6 +81,7 @@ typedef struct SIOCostSummary {
double
createScanInfoList
;
double
getTbFromMemTime
;
double
getTbFromIMemTime
;
double
initDelSkylineIterTime
;
}
SIOCostSummary
;
typedef
struct
SBlockLoadSuppInfo
{
...
...
@@ -2227,7 +2228,9 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
tsdbDebug
(
"%p uid:%"
PRId64
", no data in imem, %s"
,
pReader
,
pBlockScanInfo
->
uid
,
pReader
->
idStr
);
}
st
=
taosGetTimestampUs
();
initDelSkylineIterator
(
pBlockScanInfo
,
pReader
,
d
,
di
);
pReader
->
cost
.
initDelSkylineIterTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pBlockScanInfo
->
iterInit
=
true
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -4013,12 +4016,12 @@ void tsdbReaderClose(STsdbReader* pReader) {
"build in-memory-block-time:%.2f ms, lastBlocks:%"
PRId64
", lastBlocks-time:%.2f ms, composed-blocks:%"
PRId64
", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, creatTime:%.2f ms,"
", getTbFromMem-time:%.2f ms, getTbFromIMem-time:%.2f ms, %s"
,
", getTbFromMem-time:%.2f ms, getTbFromIMem-time:%.2f ms,
initDelSkylineIterTime:%.2f ms,
%s"
,
pReader
,
pCost
->
headFileLoad
,
pCost
->
headFileLoadTime
,
pCost
->
smaDataLoad
,
pCost
->
smaLoadTime
,
pCost
->
numOfBlocks
,
pCost
->
blockLoadTime
,
pCost
->
buildmemBlock
,
pCost
->
lastBlockLoad
,
pCost
->
lastBlockLoadTime
,
pCost
->
composedBlocks
,
pCost
->
buildComposedBlockTime
,
numOfTables
*
sizeof
(
STableBlockScanInfo
)
/
1000
.
0
,
pCost
->
createScanInfoList
,
pCost
->
getTbFromMemTime
,
pCost
->
getTbFromIMemTime
,
pReader
->
idStr
);
pCost
->
getTbFromMemTime
,
pCost
->
getTbFromIMemTime
,
p
Cost
->
initDelSkylineIterTime
,
p
Reader
->
idStr
);
taosMemoryFree
(
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
pSchema
);
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
9a261ab2
...
...
@@ -929,8 +929,9 @@ int32_t tRowMergerGetRow(SRowMerger *pMerger, STSRow **ppRow) {
return
code
;
}
/*
// delete skyline ======================================================
static
int32_t
tsdbMergeSkyline
(
SArray
*
aSkyline1
,
SArray
*
aSkyline2
,
SArray
*
aSkyline
)
{
static int32_t tsdbMergeSkyline
2
(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) {
int32_t code = 0;
int32_t i1 = 0;
int32_t n1 = taosArrayGetSize(aSkyline1);
...
...
@@ -996,7 +997,141 @@ static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aS
_exit:
return code;
}
*/
// delete skyline ======================================================
static
int32_t
tsdbMergeSkyline
(
SArray
*
pSkyline1
,
SArray
*
pSkyline2
,
SArray
*
pSkyline
)
{
int32_t
code
=
0
;
int32_t
i1
=
0
;
int32_t
n1
=
taosArrayGetSize
(
pSkyline1
);
int32_t
i2
=
0
;
int32_t
n2
=
taosArrayGetSize
(
pSkyline2
);
TSDBKEY
*
pKey1
;
TSDBKEY
*
pKey2
;
int64_t
version1
=
0
;
int64_t
version2
=
0
;
ASSERT
(
n1
>
0
&&
n2
>
0
);
taosArrayClear
(
pSkyline
);
TSDBKEY
**
pItem
=
TARRAY_GET_ELEM
(
pSkyline
,
0
);
while
(
i1
<
n1
&&
i2
<
n2
)
{
pKey1
=
(
TSDBKEY
*
)
taosArrayGetP
(
pSkyline1
,
i1
);
pKey2
=
(
TSDBKEY
*
)
taosArrayGetP
(
pSkyline2
,
i2
);
if
(
pKey1
->
ts
<
pKey2
->
ts
)
{
version1
=
pKey1
->
version
;
*
pItem
=
pKey1
;
i1
++
;
}
else
if
(
pKey1
->
ts
>
pKey2
->
ts
)
{
version2
=
pKey2
->
version
;
*
pItem
=
pKey2
;
i2
++
;
}
else
{
version1
=
pKey1
->
version
;
version2
=
pKey2
->
version
;
*
pItem
=
pKey1
;
i1
++
;
i2
++
;
}
(
*
pItem
)
->
version
=
TMAX
(
version1
,
version2
);
pItem
++
;
}
while
(
i1
<
n1
)
{
pKey1
=
(
TSDBKEY
*
)
taosArrayGetP
(
pSkyline1
,
i1
);
*
pItem
=
pKey1
;
pItem
++
;
i1
++
;
}
while
(
i2
<
n2
)
{
pKey2
=
(
TSDBKEY
*
)
taosArrayGetP
(
pSkyline2
,
i2
);
*
pItem
=
pKey2
;
pItem
++
;
i2
++
;
}
taosArraySetSize
(
pSkyline
,
TARRAY_ELEM_IDX
(
pSkyline
,
pItem
));
_exit:
return
code
;
}
int32_t
tsdbBuildDeleteSkylineImpl
(
SArray
*
aSkyline
,
int32_t
sidx
,
int32_t
eidx
,
SArray
*
pSkyline
)
{
int32_t
code
=
0
;
SDelData
*
pDelData
;
int32_t
midx
;
taosArrayClear
(
pSkyline
);
if
(
sidx
==
eidx
)
{
TSDBKEY
*
pItem1
=
taosArrayGet
(
aSkyline
,
sidx
*
2
);
TSDBKEY
*
pItem2
=
taosArrayGet
(
aSkyline
,
sidx
*
2
+
1
);
taosArrayPush
(
pSkyline
,
&
pItem1
);
taosArrayPush
(
pSkyline
,
&
pItem2
);
}
else
{
SArray
*
pSkyline1
=
NULL
;
SArray
*
pSkyline2
=
NULL
;
midx
=
(
sidx
+
eidx
)
/
2
;
pSkyline1
=
taosArrayInit
((
midx
-
sidx
+
1
)
*
2
,
POINTER_BYTES
);
pSkyline2
=
taosArrayInit
((
eidx
-
midx
)
*
2
,
POINTER_BYTES
);
if
(
pSkyline1
==
NULL
||
pSkyline1
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_clear
;
}
code
=
tsdbBuildDeleteSkylineImpl
(
aSkyline
,
sidx
,
midx
,
pSkyline1
);
if
(
code
)
goto
_clear
;
code
=
tsdbBuildDeleteSkylineImpl
(
aSkyline
,
midx
+
1
,
eidx
,
pSkyline2
);
if
(
code
)
goto
_clear
;
code
=
tsdbMergeSkyline
(
pSkyline1
,
pSkyline2
,
pSkyline
);
_clear:
taosArrayDestroy
(
pSkyline1
);
taosArrayDestroy
(
pSkyline2
);
}
return
code
;
}
int32_t
tsdbBuildDeleteSkyline
(
SArray
*
aDelData
,
int32_t
sidx
,
int32_t
eidx
,
SArray
*
aSkyline
)
{
SDelData
*
pDelData
;
int32_t
code
=
0
;
int32_t
dataNum
=
eidx
-
sidx
+
1
;
SArray
*
aTmpSkyline
=
taosArrayInit
(
dataNum
*
2
,
sizeof
(
TSDBKEY
));
SArray
*
pSkyline
=
taosArrayInit
(
dataNum
*
2
,
POINTER_BYTES
);
for
(
int32_t
i
=
sidx
;
i
<=
eidx
;
++
i
)
{
pDelData
=
(
SDelData
*
)
taosArrayGet
(
aDelData
,
i
);
taosArrayPush
(
aTmpSkyline
,
&
(
TSDBKEY
){.
ts
=
pDelData
->
sKey
,
.
version
=
pDelData
->
version
});
taosArrayPush
(
aTmpSkyline
,
&
(
TSDBKEY
){.
ts
=
pDelData
->
eKey
,
.
version
=
0
});
}
code
=
tsdbBuildDeleteSkylineImpl
(
aTmpSkyline
,
sidx
,
eidx
,
pSkyline
);
if
(
code
)
goto
_clear
;
int32_t
skylineNum
=
taosArrayGetSize
(
pSkyline
);
for
(
int32_t
i
=
0
;
i
<
skylineNum
;
++
i
)
{
TSDBKEY
*
p
=
taosArrayGetP
(
pSkyline
,
i
);
taosArrayPush
(
aSkyline
,
p
);
}
_clear:
taosArrayDestroy
(
aTmpSkyline
);
taosArrayDestroy
(
pSkyline
);
return
code
;
}
/*
int32_t tsdbBuildDeleteSkyline2(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) {
int32_t code = 0;
SDelData *pDelData;
int32_t midx;
...
...
@@ -1033,6 +1168,7 @@ int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SAr
return code;
}
*/
// SBlockData ======================================================
int32_t
tBlockDataCreate
(
SBlockData
*
pBlockData
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录