Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aeb94733
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看板
提交
aeb94733
编写于
7月 05, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(tsdb): add some logs.
上级
a0a116b6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
20 deletion
+30
-20
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+30
-20
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
aeb94733
...
...
@@ -98,10 +98,9 @@ typedef struct SIOCostSummary {
int64_t
composedBlocks
;
double
buildComposedBlockTime
;
double
createScanInfoList
;
// double getTbFromMemTime;
// double getTbFromIMemTime;
double
initDelSkylineIterTime
;
}
SIOCostSummary
;
double
createSkylineIterTime
;
double
initLastBlockReader
;
}
SCostSummary
;
typedef
struct
SBlockLoadSuppInfo
{
TColumnDataAggArray
colAggArray
;
...
...
@@ -216,12 +215,12 @@ struct STsdbReader {
int32_t
type
;
// query type: 1. retrieve all data blocks, 2. retrieve direct prev|next rows
SBlockLoadSuppInfo
suppInfo
;
STsdbReadSnap
*
pReadSnap
;
S
IO
CostSummary
cost
;
SCostSummary
cost
;
SHashObj
**
pIgnoreTables
;
STSchema
*
pSchema
;
// the newest version schema
SSHashObj
*
pSchemaMap
;
// keep the retrieved schema info, to avoid the overhead by repeatly load schema
SDataFileReader
*
pFileReader
;
// the file reader
SDelFReader
*
pDelFReader
;
// the del file reader, todo remove it
SDelFReader
*
pDelFReader
;
// the del file reader, todo remove it
SArray
*
pDelIdx
;
// del file block index;
SBlockInfoBuf
blockInfoBuf
;
EContentData
step
;
...
...
@@ -252,7 +251,7 @@ static int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScan
static
int32_t
mergeRowsInFileBlocks
(
SBlockData
*
pBlockData
,
STableBlockScanInfo
*
pBlockScanInfo
,
int64_t
key
,
STsdbReader
*
pReader
);
static
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
);
static
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
int32_t
order
,
SCostSummary
*
pCost
);
static
STsdb
*
getTsdbByRetentions
(
SVnode
*
pVnode
,
TSKEY
winSKey
,
SRetention
*
retentions
,
const
char
*
idstr
,
int8_t
*
pLevel
);
static
SVersionRange
getQueryVerRange
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
int8_t
level
);
...
...
@@ -576,7 +575,7 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
return
TSDB_CODE_SUCCESS
;
}
S
IO
CostSummary
*
pSum
=
&
pReader
->
cost
;
SCostSummary
*
pSum
=
&
pReader
->
cost
;
pIter
->
pLastBlockReader
->
uid
=
0
;
tMergeTreeClose
(
&
pIter
->
pLastBlockReader
->
mergeTree
);
...
...
@@ -2950,8 +2949,10 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
w
.
ekey
=
pScanInfo
->
lastKeyInStt
;
}
int64_t
st
=
taosGetTimestampUs
();
tsdbDebug
(
"init last block reader, window:%"
PRId64
"-%"
PRId64
", uid:%"
PRIu64
", %s"
,
w
.
skey
,
w
.
ekey
,
pScanInfo
->
uid
,
pReader
->
idStr
);
int32_t
code
=
tMergeTreeOpen2
(
&
pLBlockReader
->
mergeTree
,
(
pLBlockReader
->
order
==
TSDB_ORDER_DESC
),
pReader
->
pTsdb
,
pReader
->
suid
,
pScanInfo
->
uid
,
&
w
,
&
pLBlockReader
->
verRange
,
pReader
->
idStr
,
false
,
pReader
->
status
.
pLDataIterArray
,
pReader
->
status
.
pCurrentFileset
,
pReader
->
pSchema
,
...
...
@@ -2967,9 +2968,14 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
initMemDataIterator
(
pScanInfo
,
pReader
);
// todo: del tomb order problem
initDelSkylineIterator
(
pScanInfo
,
pReader
);
return
nextRowFromLastBlocks
(
pLBlockReader
,
pScanInfo
,
&
pReader
->
verRange
);
initDelSkylineIterator
(
pScanInfo
,
pReader
->
order
,
&
pReader
->
cost
);
code
=
nextRowFromLastBlocks
(
pLBlockReader
,
pScanInfo
,
&
pReader
->
verRange
);
int64_t
el
=
taosGetTimestampUs
()
-
st
;
pReader
->
cost
.
initLastBlockReader
+=
(
el
/
1000
.
0
);
tsdbDebug
(
"init last block reader completed, elapsed time:%"
PRId64
"us %s"
,
el
,
pReader
->
idStr
);
return
code
;
}
static
bool
hasDataInLastBlock
(
SLastBlockReader
*
pLastBlockReader
)
{
return
pLastBlockReader
->
mergeTree
.
pIter
!=
NULL
;
}
...
...
@@ -3241,7 +3247,7 @@ int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order) {
return
ASCENDING_TRAVERSE
(
order
)
?
0
:
taosArrayGetSize
(
pDelSkyline
)
-
1
;
}
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
)
{
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
int32_t
order
,
SCostSummary
*
pCost
)
{
int32_t
code
=
0
;
int32_t
newDelDataInFile
=
taosArrayGetSize
(
pBlockScanInfo
->
pfileDelData
);
if
(
newDelDataInFile
==
0
&&
...
...
@@ -3249,6 +3255,8 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
return
code
;
}
int64_t
st
=
taosGetTimestampUs
();
if
(
pBlockScanInfo
->
delSkyline
!=
NULL
)
{
taosArrayClear
(
pBlockScanInfo
->
delSkyline
);
}
else
{
...
...
@@ -3265,13 +3273,16 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
code
=
tsdbBuildDeleteSkyline
(
pSource
,
0
,
taosArrayGetSize
(
pSource
)
-
1
,
pBlockScanInfo
->
delSkyline
);
taosArrayClear
(
pBlockScanInfo
->
pfileDelData
);
int32_t
index
=
getInitialDelIndex
(
pBlockScanInfo
->
delSkyline
,
pReader
->
order
);
int32_t
index
=
getInitialDelIndex
(
pBlockScanInfo
->
delSkyline
,
order
);
pBlockScanInfo
->
iter
.
index
=
index
;
pBlockScanInfo
->
iiter
.
index
=
index
;
pBlockScanInfo
->
fileDelIndex
=
index
;
pBlockScanInfo
->
lastBlockDelIndex
=
index
;
double
el
=
taosGetTimestampUs
()
-
st
;
pCost
->
createSkylineIterTime
=
el
/
1000
.
0
;
return
code
;
}
...
...
@@ -3723,7 +3734,7 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
}
initMemDataIterator
(
*
pBlockScanInfo
,
pReader
);
initDelSkylineIterator
(
*
pBlockScanInfo
,
pReader
);
initDelSkylineIterator
(
*
pBlockScanInfo
,
pReader
->
order
,
&
pReader
->
cost
);
int64_t
endKey
=
(
ASCENDING_TRAVERSE
(
pReader
->
order
))
?
INT64_MAX
:
INT64_MIN
;
int32_t
code
=
buildDataBlockFromBuf
(
pReader
,
*
pBlockScanInfo
,
endKey
);
...
...
@@ -4890,7 +4901,7 @@ void tsdbReaderClose2(STsdbReader* pReader) {
tsdbReleaseReader
(
pReader
);
tsdbUninitReaderLock
(
pReader
);
S
IO
CostSummary
*
pCost
=
&
pReader
->
cost
;
SCostSummary
*
pCost
=
&
pReader
->
cost
;
SFilesetIter
*
pFilesetIter
=
&
pReader
->
status
.
fileIter
;
if
(
pFilesetIter
->
pLastBlockReader
!=
NULL
)
{
SLastBlockReader
*
pLReader
=
pFilesetIter
->
pLastBlockReader
;
...
...
@@ -4903,15 +4914,14 @@ void tsdbReaderClose2(STsdbReader* pReader) {
tsdbDebug
(
"%p :io-cost summary: head-file:%"
PRIu64
", head-file time:%.2f ms, SMA:%"
PRId64
" SMA-time:%.2f ms, fileBlocks:%"
PRId64
", fileBlocks-load-time:%.2f ms, "
" SMA-time:%.2f ms, fileBlocks:%"
PRId64
", fileBlocks-load-time:%.2f ms, "
"build in-memory-block-time:%.2f ms, lastBlocks:%"
PRId64
", lastBlocks-time:%.2f ms, composed-blocks:%"
PRId64
", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,
initDel
SkylineIterTime:%.2f "
"ms, %s"
,
", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,
create
SkylineIterTime:%.2f "
"ms,
initLastBlockReader:%.2fms,
%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
->
initDelSkylineIterTime
,
pReader
->
idStr
);
pCost
->
createSkylineIterTime
,
pCost
->
initLastBlockReader
,
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
idStr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录