Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6609882f
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看板
提交
6609882f
编写于
8月 16, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tsdb): add stt statistics block buffer, and do some internal refactor.
上级
71c3c710
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
126 addition
and
108 deletion
+126
-108
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+14
-5
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+1
-4
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+2
-7
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+88
-66
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+8
-8
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+12
-16
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
+1
-2
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
6609882f
...
...
@@ -708,14 +708,21 @@ typedef struct {
TSDBROW
row
;
}
SRowInfo
;
typedef
struct
SSttBlockLoadCostInfo
{
int64_t
loadBlocks
;
int64_t
loadStatisBlocks
;
double
blockElapsedTime
;
double
statisElapsedTime
;
}
SSttBlockLoadCostInfo
;
typedef
struct
SSttBlockLoadInfo
{
SBlockData
blockData
[
2
];
SBlockData
blockData
[
2
];
// buffered block data
int32_t
statisBlockIndex
;
// buffered statistics block index
void
*
statisBlock
;
// buffered statistics block data
void
*
pSttStatisBlkArray
;
SArray
*
aSttBlk
;
int32_t
blockIndex
[
2
];
// to denote the loaded block in the corresponding position.
int32_t
currentLoadBlockIndex
;
int32_t
loadBlocks
;
double
elapsedTime
;
STSchema
*
pSchema
;
int16_t
*
colIds
;
int32_t
numOfCols
;
...
...
@@ -723,6 +730,8 @@ typedef struct SSttBlockLoadInfo {
bool
isLast
;
bool
sttBlockLoaded
;
SSttBlockLoadCostInfo
cost
;
// keep the last access position, this position may be used to reduce the binary times for
// starting last block data for a new table
struct
{
...
...
@@ -831,9 +840,9 @@ void tMergeTreeClose(SMergeTree *pMTree);
SSttBlockLoadInfo
*
tCreateLastBlockLoadInfo
(
STSchema
*
pSchema
,
int16_t
*
colList
,
int32_t
numOfCols
,
int32_t
numOfStt
);
SSttBlockLoadInfo
*
tCreateOneLastBlockLoadInfo
(
STSchema
*
pSchema
,
int16_t
*
colList
,
int32_t
numOfCols
);
void
resetLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
);
void
get
LastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
,
int64_t
*
blocks
,
double
*
el
);
void
get
SttBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
,
SSttBlockLoadCostInfo
*
pLoadCost
);
void
*
destroyLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
);
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
int64_t
*
blocks
,
double
*
el
);
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
SSttBlockLoadCostInfo
*
pLoadCost
);
// tsdbCache ==============================================================================================
typedef
enum
{
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
6609882f
...
...
@@ -1760,10 +1760,7 @@ typedef struct {
static
int32_t
lastIterOpen
(
SFSLastIter
*
iter
,
STFileSet
*
pFileSet
,
STsdb
*
pTsdb
,
STSchema
*
pTSchema
,
tb_uid_t
suid
,
tb_uid_t
uid
,
SCacheRowsReader
*
pr
,
int64_t
lastTs
,
int16_t
*
aCols
,
int
nCols
)
{
int32_t
code
=
0
;
int64_t
loadBlocks
=
0
;
double
elapse
=
0
;
pr
->
pLDataIterArray
=
destroySttBlockReader
(
pr
->
pLDataIterArray
,
&
loadBlocks
,
&
elapse
);
pr
->
pLDataIterArray
=
destroySttBlockReader
(
pr
->
pLDataIterArray
,
NULL
);
pr
->
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
SMergeTreeConf
conf
=
{
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
6609882f
...
...
@@ -125,10 +125,7 @@ int32_t tsdbReuseCacherowsReader(void* reader, void* pTableIdList, int32_t numOf
pReader
->
pTableList
=
pTableIdList
;
pReader
->
numOfTables
=
numOfTables
;
pReader
->
lastTs
=
INT64_MIN
;
int64_t
blocks
;
double
elapse
;
pReader
->
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
pLDataIterArray
,
&
blocks
,
&
elapse
);
pReader
->
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
pLDataIterArray
,
NULL
);
pReader
->
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -208,9 +205,7 @@ void* tsdbCacherowsReaderClose(void* pReader) {
taosMemoryFree
(
p
->
pCurrSchema
);
if
(
p
->
pLDataIterArray
)
{
int64_t
loadBlocks
=
0
;
double
elapse
=
0
;
destroySttBlockReader
(
p
->
pLDataIterArray
,
&
loadBlocks
,
&
elapse
);
destroySttBlockReader
(
p
->
pLDataIterArray
,
NULL
);
}
if
(
p
->
pFileReader
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
6609882f
...
...
@@ -91,25 +91,26 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
taosArrayClear
(
pLoadInfo
[
i
].
aSttBlk
);
pLoadInfo
[
i
].
elapsedTime
=
0
;
pLoadInfo
[
i
].
loadBlocks
=
0
;
pLoadInfo
[
i
].
cost
.
loadBlocks
=
0
;
pLoadInfo
[
i
].
cost
.
blockElapsedTime
=
0
;
pLoadInfo
[
i
].
cost
.
statisElapsedTime
=
0
;
pLoadInfo
[
i
].
cost
.
loadStatisBlocks
=
0
;
pLoadInfo
[
i
].
statisBlockIndex
=
-
1
;
tStatisBlockDestroy
(
pLoadInfo
[
i
].
statisBlock
);
pLoadInfo
[
i
].
sttBlockLoaded
=
false
;
}
}
void
get
LastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
,
int64_t
*
blocks
,
double
*
el
)
{
void
get
SttBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
,
SSttBlockLoadCostInfo
*
pLoadCost
)
{
for
(
int32_t
i
=
0
;
i
<
1
;
++
i
)
{
*
el
+=
pLoadInfo
[
i
].
elapsedTime
;
*
blocks
+=
pLoadInfo
[
i
].
loadBlocks
;
pLoadCost
->
blockElapsedTime
+=
pLoadInfo
[
i
].
cost
.
blockElapsedTime
;
pLoadCost
->
loadBlocks
+=
pLoadInfo
[
i
].
cost
.
loadBlocks
;
pLoadCost
->
loadStatisBlocks
+=
pLoadInfo
[
i
].
cost
.
loadStatisBlocks
;
pLoadCost
->
statisElapsedTime
+=
pLoadInfo
[
i
].
cost
.
statisElapsedTime
;
}
}
static
void
freeTombBlock
(
void
*
param
)
{
STombBlock
**
pTombBlock
=
(
STombBlock
**
)
param
;
tTombBlockDestroy
(
*
pTombBlock
);
taosMemoryFree
(
*
pTombBlock
);
}
void
*
destroyLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
)
{
if
(
pLoadInfo
==
NULL
)
{
return
NULL
;
...
...
@@ -136,7 +137,7 @@ static void destroyLDataIter(SLDataIter *pIter) {
taosMemoryFree
(
pIter
);
}
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
int64_t
*
blocks
,
double
*
el
)
{
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
SSttBlockLoadCostInfo
*
pLoadCost
)
{
if
(
pLDataIterArray
==
NULL
)
{
return
NULL
;
}
...
...
@@ -146,8 +147,13 @@ void *destroySttBlockReader(SArray *pLDataIterArray, int64_t *blocks, double *el
SArray
*
pList
=
taosArrayGetP
(
pLDataIterArray
,
i
);
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pList
);
++
j
)
{
SLDataIter
*
pIter
=
taosArrayGetP
(
pList
,
j
);
*
el
+=
pIter
->
pBlockLoadInfo
->
elapsedTime
;
*
blocks
+=
pIter
->
pBlockLoadInfo
->
loadBlocks
;
if
(
pLoadCost
!=
NULL
)
{
pLoadCost
->
loadBlocks
+=
pIter
->
pBlockLoadInfo
->
cost
.
loadBlocks
;
pLoadCost
->
loadStatisBlocks
+=
pIter
->
pBlockLoadInfo
->
cost
.
loadStatisBlocks
;
pLoadCost
->
blockElapsedTime
+=
pIter
->
pBlockLoadInfo
->
cost
.
blockElapsedTime
;
pLoadCost
->
statisElapsedTime
+=
pIter
->
pBlockLoadInfo
->
cost
.
statisElapsedTime
;
}
destroyLDataIter
(
pIter
);
}
taosArrayDestroy
(
pList
);
...
...
@@ -195,12 +201,12 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
}
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pInfo
->
e
lapsedTime
+=
el
;
pInfo
->
loadBlocks
+=
1
;
pInfo
->
cost
.
blockE
lapsedTime
+=
el
;
pInfo
->
cost
.
loadBlocks
+=
1
;
tsdbDebug
(
"read last block, total load:%
d
, trigger by uid:%"
PRIu64
tsdbDebug
(
"read last block, total load:%
"
PRId64
"
, trigger by uid:%"
PRIu64
", last file index:%d, last block index:%d, entry:%d, rows:%d, %p, elapsed time:%.2f ms, %s"
,
pInfo
->
loadBlocks
,
pIter
->
uid
,
pIter
->
iStt
,
pIter
->
iSttBlk
,
pInfo
->
currentLoadBlockIndex
,
pBlock
->
nRow
,
pInfo
->
cost
.
loadBlocks
,
pIter
->
uid
,
pIter
->
iStt
,
pIter
->
iSttBlk
,
pInfo
->
currentLoadBlockIndex
,
pBlock
->
nRow
,
pBlock
,
el
,
idStr
);
pInfo
->
blockIndex
[
pInfo
->
currentLoadBlockIndex
]
=
pIter
->
iSttBlk
;
...
...
@@ -363,8 +369,9 @@ static int32_t suidComparFn(const void *target, const void *p2) {
}
}
static
bool
existsFromSttBlkStatis
(
const
TStatisBlkArray
*
pStatisBlkArray
,
uint64_t
suid
,
uint64_t
uid
,
static
bool
existsFromSttBlkStatis
(
SSttBlockLoadInfo
*
pBlockLoadInfo
,
uint64_t
suid
,
uint64_t
uid
,
SSttFileReader
*
pReader
)
{
const
TStatisBlkArray
*
pStatisBlkArray
=
pBlockLoadInfo
->
pSttStatisBlkArray
;
if
(
TARRAY2_SIZE
(
pStatisBlkArray
)
<=
0
)
{
return
true
;
}
...
...
@@ -387,23 +394,30 @@ static bool existsFromSttBlkStatis(const TStatisBlkArray *pStatisBlkArray, uint6
return
false
;
}
STbStatisBlock
block
=
{
0
};
tsdbSttFileReadStatisBlock
(
pReader
,
p
,
&
block
);
if
(
pBlockLoadInfo
->
statisBlock
==
NULL
)
{
pBlockLoadInfo
->
statisBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
STbStatisBlock
));
tsdbSttFileReadStatisBlock
(
pReader
,
p
,
pBlockLoadInfo
->
statisBlock
);
pBlockLoadInfo
->
statisBlockIndex
=
i
;
pBlockLoadInfo
->
cost
.
loadStatisBlocks
+=
1
;
}
else
if
(
pBlockLoadInfo
->
statisBlockIndex
!=
i
)
{
tStatisBlockDestroy
(
pBlockLoadInfo
->
statisBlock
);
tsdbSttFileReadStatisBlock
(
pReader
,
p
,
pBlockLoadInfo
->
statisBlock
);
pBlockLoadInfo
->
statisBlockIndex
=
i
;
pBlockLoadInfo
->
cost
.
loadStatisBlocks
+=
1
;
}
int32_t
index
=
tarray2SearchIdx
(
block
.
suid
,
&
suid
,
sizeof
(
int64_t
),
suidComparFn
,
TD_EQ
);
STbStatisBlock
*
pBlock
=
pBlockLoadInfo
->
statisBlock
;
int32_t
index
=
tarray2SearchIdx
(
pBlock
->
suid
,
&
suid
,
sizeof
(
int64_t
),
suidComparFn
,
TD_EQ
);
if
(
index
==
-
1
)
{
tStatisBlockDestroy
(
&
block
);
return
false
;
}
int32_t
j
=
index
;
if
(
block
.
uid
->
data
[
j
]
==
uid
)
{
tStatisBlockDestroy
(
&
block
);
if
(
pBlock
->
uid
->
data
[
j
]
==
uid
)
{
return
true
;
}
else
if
(
block
.
uid
->
data
[
j
]
>
uid
)
{
while
(
j
>=
0
&&
block
.
suid
->
data
[
j
]
==
suid
)
{
if
(
block
.
uid
->
data
[
j
]
==
uid
)
{
tStatisBlockDestroy
(
&
block
);
}
else
if
(
pBlock
->
uid
->
data
[
j
]
>
uid
)
{
while
(
j
>=
0
&&
pBlock
->
suid
->
data
[
j
]
==
suid
)
{
if
(
pBlock
->
uid
->
data
[
j
]
==
uid
)
{
return
true
;
}
else
{
j
-=
1
;
...
...
@@ -411,9 +425,8 @@ static bool existsFromSttBlkStatis(const TStatisBlkArray *pStatisBlkArray, uint6
}
}
else
{
j
=
index
+
1
;
while
(
j
<
block
.
suid
->
size
&&
block
.
suid
->
data
[
j
]
==
suid
)
{
if
(
block
.
uid
->
data
[
j
]
==
uid
)
{
tStatisBlockDestroy
(
&
block
);
while
(
j
<
pBlock
->
suid
->
size
&&
pBlock
->
suid
->
data
[
j
]
==
suid
)
{
if
(
pBlock
->
uid
->
data
[
j
]
==
uid
)
{
return
true
;
}
else
{
j
+=
1
;
...
...
@@ -421,14 +434,47 @@ static bool existsFromSttBlkStatis(const TStatisBlkArray *pStatisBlkArray, uint6
}
}
tStatisBlockDestroy
(
&
block
);
i
+=
1
;
}
return
false
;
}
int32_t
tLDataIterOpen2
(
struct
SLDataIter
*
pIter
,
SSttFileReader
*
pSttFileReader
,
int32_t
iStt
,
int8_t
backward
,
static
int32_t
doLoadSttFilesBlk
(
SSttBlockLoadInfo
*
pBlockLoadInfo
,
SLDataIter
*
pIter
,
int64_t
suid
,
_load_tomb_fn
loadTombFn
,
void
*
pReader1
,
const
char
*
idStr
)
{
int64_t
st
=
taosGetTimestampUs
();
const
TSttBlkArray
*
pSttBlkArray
=
NULL
;
pBlockLoadInfo
->
sttBlockLoaded
=
true
;
// load the stt block info for each stt-block
int32_t
code
=
tsdbSttFileReadSttBlk
(
pIter
->
pReader
,
&
pSttBlkArray
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"load stt blk failed, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
code
=
extractSttBlockInfo
(
pIter
,
pSttBlkArray
,
pBlockLoadInfo
,
suid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"load stt block info failed, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
// load stt blocks statis for all stt-blocks, to decide if the data of queried table exists in current stt file
code
=
tsdbSttFileReadStatisBlk
(
pIter
->
pReader
,
(
const
TStatisBlkArray
**
)
&
pBlockLoadInfo
->
pSttStatisBlkArray
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"failed to load stt block statistics, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
code
=
loadTombFn
(
pReader1
,
pIter
->
pReader
,
pIter
->
pBlockLoadInfo
);
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
tsdbDebug
(
"load the stt file info completed, elapsed time:%.2fms, %s"
,
el
,
idStr
);
return
code
;
}
int32_t
tLDataIterOpen2
(
SLDataIter
*
pIter
,
SSttFileReader
*
pSttFileReader
,
int32_t
iStt
,
int8_t
backward
,
uint64_t
suid
,
uint64_t
uid
,
STimeWindow
*
pTimeWindow
,
SVersionRange
*
pRange
,
SSttBlockLoadInfo
*
pBlockLoadInfo
,
const
char
*
idStr
,
bool
strictTimeRange
,
_load_tomb_fn
loadTombFn
,
void
*
pReader1
)
{
...
...
@@ -444,6 +490,7 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
pIter
->
pReader
=
pSttFileReader
;
pIter
->
pBlockLoadInfo
=
pBlockLoadInfo
;
// open stt file failed, ignore and continue
if
(
pIter
->
pReader
==
NULL
)
{
tsdbError
(
"stt file reader is null, %s"
,
idStr
);
pIter
->
pSttBlk
=
NULL
;
...
...
@@ -452,43 +499,18 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
}
if
(
!
pBlockLoadInfo
->
sttBlockLoaded
)
{
int64_t
st
=
taosGetTimestampUs
();
const
TSttBlkArray
*
pSttBlkArray
=
NULL
;
pBlockLoadInfo
->
sttBlockLoaded
=
true
;
// load the stt block info for each stt-block
code
=
tsdbSttFileReadSttBlk
(
pIter
->
pReader
,
&
pSttBlkArray
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"load stt blk failed, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
code
=
extractSttBlockInfo
(
pIter
,
pSttBlkArray
,
pBlockLoadInfo
,
suid
);
code
=
doLoadSttFilesBlk
(
pBlockLoadInfo
,
pIter
,
suid
,
loadTombFn
,
pReader1
,
idStr
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"load stt block info failed, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
// load stt blocks statis for all stt-blocks, to decide if the data of queried table exists in current stt file
code
=
tsdbSttFileReadStatisBlk
(
pIter
->
pReader
,
(
const
TStatisBlkArray
**
)
&
pBlockLoadInfo
->
pSttStatisBlkArray
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"failed to load stt block statistics, code:%s, %s"
,
tstrerror
(
code
),
idStr
);
return
code
;
}
code
=
loadTombFn
(
pReader1
,
pIter
->
pReader
,
pIter
->
pBlockLoadInfo
);
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
tsdbDebug
(
"load the stt file info completed, elapsed time:%.2fms, %s"
,
el
,
idStr
);
}
// bool exists = existsFromSttBlkStatis(pBlockLoadInfo->pSttStatisBlkArray
, suid, uid, pIter->pReader);
//
if (!exists) {
//
pIter->iSttBlk = -1;
//
pIter->pSttBlk = NULL;
//
return TSDB_CODE_SUCCESS;
//
}
bool
exists
=
existsFromSttBlkStatis
(
pBlockLoadInfo
,
suid
,
uid
,
pIter
->
pReader
);
if
(
!
exists
)
{
pIter
->
iSttBlk
=
-
1
;
pIter
->
pSttBlk
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
// find the start block, actually we could load the position to avoid repeatly searching for the start position when
// the skey is updated.
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
6609882f
...
...
@@ -87,13 +87,13 @@ typedef struct SIOCostSummary {
double
headFileLoadTime
;
int64_t
smaDataLoad
;
double
smaLoadTime
;
int64_t
lastBlockLoad
;
double
lastBlockLoadTime
;
int64_t
sttStatisBlockLoad
;
int64_t
sttBlockLoad
;
double
sttBlockLoadTime
;
int64_t
composedBlocks
;
double
buildComposedBlockTime
;
double
createScanInfoList
;
// double getTbFromMemTime;
// double getTbFromIMemTime;
SSttBlockLoadCostInfo
sttCost
;
double
initDelSkylineIterTime
;
}
SIOCostSummary
;
...
...
@@ -586,8 +586,8 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
return
TSDB_CODE_SUCCESS
;
}
SIOCostSummary
*
p
Sum
=
&
pReader
->
cost
;
get
LastBlockLoadInfo
(
pIter
->
pLastBlockReader
->
pInfo
,
&
pSum
->
lastBlockLoad
,
&
pReader
->
cost
.
lastBlockLoadTime
);
SIOCostSummary
*
p
Cost
=
&
pReader
->
cost
;
get
SttBlockLoadInfo
(
pIter
->
pLastBlockReader
->
pInfo
,
&
pCost
->
sttCost
);
pIter
->
pLastBlockReader
->
uid
=
0
;
tMergeTreeClose
(
&
pIter
->
pLastBlockReader
->
mergeTree
);
...
...
@@ -4697,7 +4697,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
SLastBlockReader
*
pLReader
=
pFilesetIter
->
pLastBlockReader
;
tMergeTreeClose
(
&
pLReader
->
mergeTree
);
get
LastBlockLoadInfo
(
pLReader
->
pInfo
,
&
pCost
->
lastBlockLoad
,
&
pCost
->
lastBlockLoadTime
);
get
SttBlockLoadInfo
(
pLReader
->
pInfo
,
&
pCost
->
sttCost
);
pLReader
->
pInfo
=
destroyLastBlockLoadInfo
(
pLReader
->
pInfo
);
taosMemoryFree
(
pLReader
);
...
...
@@ -4711,7 +4711,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,initDelSkylineIterTime:%.2f "
"ms, %s"
,
pReader
,
pCost
->
headFileLoad
,
pCost
->
headFileLoadTime
,
pCost
->
smaDataLoad
,
pCost
->
smaLoadTime
,
pCost
->
numOfBlocks
,
pCost
->
blockLoadTime
,
pCost
->
buildmemBlock
,
pCost
->
lastBlockLoad
,
pCost
->
las
tBlockLoadTime
,
pCost
->
composedBlocks
,
pCost
->
blockLoadTime
,
pCost
->
buildmemBlock
,
pCost
->
sttBlockLoad
,
pCost
->
st
tBlockLoadTime
,
pCost
->
composedBlocks
,
pCost
->
buildComposedBlockTime
,
numOfTables
*
sizeof
(
STableBlockScanInfo
)
/
1000
.
0
,
pCost
->
createScanInfoList
,
pCost
->
initDelSkylineIterTime
,
pReader
->
idStr
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
6609882f
...
...
@@ -168,13 +168,11 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
return
TSDB_CODE_SUCCESS
;
}
SCostSummary
*
p
Sum
=
&
pReader
->
cost
;
SCostSummary
*
p
Cost
=
&
pReader
->
cost
;
pIter
->
pLastBlockReader
->
uid
=
0
;
tMergeTreeClose
(
&
pIter
->
pLastBlockReader
->
mergeTree
);
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pSum
->
lastBlockLoad
,
&
pSum
->
lastBlockLoadTime
);
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pCost
->
sttCost
);
pReader
->
status
.
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
// check file the time range of coverage
...
...
@@ -4067,18 +4065,20 @@ void tsdbReaderClose2(STsdbReader* pReader) {
taosMemoryFree
(
pLReader
);
}
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pCost
->
lastBlockLoad
,
&
pCost
->
lastBlockLoadTime
);
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pCost
->
sttCost
);
taosMemoryFreeClear
(
pReader
->
status
.
uidList
.
tableUidList
);
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, "
"build in-memory-block-time:%.2f ms, lastBlocks:%"
PRId64
", lastBlocks-time:%.2f ms, composed-blocks:%"
PRId64
"build in-memory-block-time:%.2f ms, sttBlocks:%"
PRId64
", sttStatisBlock:%"
PRId64
", sttBlocks-time:%.2f ms, stt-statis-Block-time:%.2f ms, composed-blocks:%"
PRId64
", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,createSkylineIterTime:%.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
->
blockLoadTime
,
pCost
->
buildmemBlock
,
pCost
->
sttCost
.
loadBlocks
,
pCost
->
sttCost
.
loadStatisBlocks
,
pCost
->
sttCost
.
blockElapsedTime
,
pCost
->
sttCost
.
statisElapsedTime
,
pCost
->
composedBlocks
,
pCost
->
buildComposedBlockTime
,
numOfTables
*
sizeof
(
STableBlockScanInfo
)
/
1000
.
0
,
pCost
->
createScanInfoList
,
pCost
->
createSkylineIterTime
,
pCost
->
initLastBlockReader
,
pReader
->
idStr
);
...
...
@@ -4092,9 +4092,8 @@ void tsdbReaderClose2(STsdbReader* pReader) {
}
int32_t
tsdbReaderSuspend2
(
STsdbReader
*
pReader
)
{
int32_t
code
=
0
;
// save reader's base state & reset top state to be reconstructed from base state
int32_t
code
=
0
;
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
STableBlockScanInfo
*
pBlockScanInfo
=
NULL
;
...
...
@@ -4110,9 +4109,9 @@ int32_t tsdbReaderSuspend2(STsdbReader* pReader) {
}
tsdbDataFileReaderClose
(
&
pReader
->
pFileReader
);
int64_t
loadBlocks
=
0
;
double
elapse
=
0
;
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
loadBlocks
,
&
elapse
);
SCostSummary
*
pCost
=
&
pReader
->
cost
;
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pCost
->
sttCost
);
pReader
->
status
.
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
// resetDataBlockScanInfo excluding lastKey
STableBlockScanInfo
**
p
=
NULL
;
...
...
@@ -4209,7 +4208,6 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) {
}
tsdbReaderSuspend2
(
pReader
);
tsdbReleaseReader
(
pReader
);
return
code
;
...
...
@@ -4222,8 +4220,7 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) {
}
int32_t
tsdbReaderResume2
(
STsdbReader
*
pReader
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
STableBlockScanInfo
**
pBlockScanInfo
=
pReader
->
status
.
pTableIter
;
// restore reader's state
...
...
@@ -4290,7 +4287,6 @@ static bool tsdbReadRowsCountOnly(STsdbReader* pReader) {
pBlock
->
info
.
rows
=
pReader
->
rowsNum
;
pBlock
->
info
.
id
.
uid
=
0
;
pBlock
->
info
.
dataLoad
=
0
;
pReader
->
rowsNum
=
0
;
return
pBlock
->
info
.
rows
>
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
浏览文件 @
6609882f
...
...
@@ -88,8 +88,7 @@ typedef struct SCostSummary {
double
headFileLoadTime
;
int64_t
smaDataLoad
;
double
smaLoadTime
;
int64_t
lastBlockLoad
;
double
lastBlockLoadTime
;
SSttBlockLoadCostInfo
sttCost
;
int64_t
composedBlocks
;
double
buildComposedBlockTime
;
double
createScanInfoList
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录