Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0c111cd2
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看板
提交
0c111cd2
编写于
7月 29, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: update schema to newest version to parsing rows
上级
06c05a8e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
63 addition
and
59 deletion
+63
-59
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+63
-59
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
0c111cd2
...
...
@@ -211,8 +211,8 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
pTsdbReader
->
idStr
);
}
tsdbDebug
(
"%p create %d tables scan-info, size:%.2f Kb, %s"
,
pTsdbReader
,
numOfTables
,
(
sizeof
(
STableBlockScanInfo
)
*
numOfTables
)
/
1024
.
0
,
pTsdbReader
->
idStr
);
tsdbDebug
(
"%p create %d tables scan-info, size:%.2f Kb, %s"
,
pTsdbReader
,
numOfTables
,
(
sizeof
(
STableBlockScanInfo
)
*
numOfTables
)
/
1024
.
0
,
pTsdbReader
->
idStr
);
return
pTableMap
;
}
...
...
@@ -396,7 +396,8 @@ static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity)
return
pResBlock
;
}
static
int32_t
tsdbReaderCreate
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STsdbReader
**
ppReader
,
int32_t
capacity
,
const
char
*
idstr
)
{
static
int32_t
tsdbReaderCreate
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STsdbReader
**
ppReader
,
int32_t
capacity
,
const
char
*
idstr
)
{
int32_t
code
=
0
;
int8_t
level
=
0
;
STsdbReader
*
pReader
=
(
STsdbReader
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pReader
));
...
...
@@ -576,7 +577,7 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader,
int64_t
et2
=
taosGetTimestampUs
();
tsdbDebug
(
"load block index for %d tables completed, elapsed time:%.2f ms, set blockIdx:%.2f ms, size:%.2f Kb %s"
,
(
int32_t
)
num
,
(
et1
-
st
)
/
1000
.
0
,
(
et2
-
et1
)
/
1000
.
0
,
num
*
sizeof
(
SBlockIdx
)
/
1024
.
0
,
pReader
->
idStr
);
(
int32_t
)
num
,
(
et1
-
st
)
/
1000
.
0
,
(
et2
-
et1
)
/
1000
.
0
,
num
*
sizeof
(
SBlockIdx
)
/
1024
.
0
,
pReader
->
idStr
);
pReader
->
cost
.
headFileLoadTime
+=
(
et1
-
st
)
/
1000
.
0
;
...
...
@@ -641,9 +642,9 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
}
}
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
tsdbDebug
(
"load block of %d tables completed, blocks:%d in %d tables, size:%.2f Kb, elapsed time:%.2f ms %s"
,
numOfTables
,
*
numOfBlocks
,
*
numOfValidTables
,
size
/
1000
.
0
,
el
,
pReader
->
idStr
);
numOfTables
,
*
numOfBlocks
,
*
numOfValidTables
,
size
/
1000
.
0
,
el
,
pReader
->
idStr
);
pReader
->
cost
.
numOfBlocks
+=
(
*
numOfBlocks
);
pReader
->
cost
.
headFileLoadTime
+=
el
;
...
...
@@ -679,9 +680,7 @@ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) {
return
pFBlockInfo
;
}
static
SBlock
*
getCurrentBlock
(
SDataBlockIter
*
pBlockIter
)
{
return
&
pBlockIter
->
block
;
}
static
SBlock
*
getCurrentBlock
(
SDataBlockIter
*
pBlockIter
)
{
return
&
pBlockIter
->
block
;
}
static
int32_t
copyBlockDataToSDataBlock
(
STsdbReader
*
pReader
,
STableBlockScanInfo
*
pBlockScanInfo
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
...
...
@@ -781,8 +780,8 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBlockIdx
blockIdx
=
{.
suid
=
pReader
->
suid
,
.
uid
=
pBlockScanInfo
->
uid
};
int32_t
code
=
tsdbReadColData
(
pReader
->
pFileReader
,
&
blockIdx
,
pBlock
,
pSupInfo
->
colIds
,
numOfCols
,
pBlockData
,
NULL
,
NULL
);
int32_t
code
=
tsdbReadColData
(
pReader
->
pFileReader
,
&
blockIdx
,
pBlock
,
pSupInfo
->
colIds
,
numOfCols
,
pBlockData
,
NULL
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -937,8 +936,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
}
int64_t
et
=
taosGetTimestampUs
();
tsdbDebug
(
"%p create blocks info struct completed for one table, %d blocks not sorted, elapsed time:%.2f ms %s"
,
pReader
,
cnt
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
tsdbDebug
(
"%p create blocks info struct completed for one table, %d blocks not sorted, elapsed time:%.2f ms %s"
,
pReader
,
cnt
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
pBlockIter
->
index
=
asc
?
0
:
(
numOfBlocks
-
1
);
cleanupBlockOrderSupporter
(
&
sup
);
...
...
@@ -976,7 +975,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
}
int64_t
et
=
taosGetTimestampUs
();
tsdbDebug
(
"%p %d data blocks access order completed, elapsed time:%.2f ms %s"
,
pReader
,
cnt
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
tsdbDebug
(
"%p %d data blocks access order completed, elapsed time:%.2f ms %s"
,
pReader
,
cnt
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
cleanupBlockOrderSupporter
(
&
sup
);
taosMemoryFree
(
pTree
);
...
...
@@ -1024,7 +1024,7 @@ static SBlock* getNeighborBlockOfSameTable(SFileDataBlockInfo* pFBlockInfo, STab
int32_t
step
=
asc
?
1
:
-
1
;
*
nextIndex
=
pFBlockInfo
->
tbBlockIdx
+
step
;
SBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SBlock
));
SBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SBlock
));
int32_t
*
indexInMapdata
=
taosArrayGet
(
pTableBlockScanInfo
->
pBlockList
,
*
nextIndex
);
tMapDataGetItemByIdx
(
&
pTableBlockScanInfo
->
mapData
,
*
indexInMapdata
,
pBlock
,
tGetBlock
);
...
...
@@ -1196,10 +1196,10 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
setComposedBlockFlag
(
pReader
,
true
);
double
elapsedTime
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange: %"
PRId64
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange: %"
PRId64
" - %"
PRId64
" %s"
,
pReader
,
elapsedTime
,
pBlock
->
info
.
rows
,
pBlock
->
info
.
window
.
skey
,
pBlock
->
info
.
window
.
ekey
,
pReader
->
idStr
);
pReader
,
elapsedTime
,
pBlock
->
info
.
rows
,
pBlock
->
info
.
window
.
skey
,
pBlock
->
info
.
window
.
ekey
,
pReader
->
idStr
);
pReader
->
cost
.
buildmemBlock
+=
elapsedTime
;
return
code
;
...
...
@@ -1499,9 +1499,10 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader, STableBlockScanInfo*
setComposedBlockFlag
(
pReader
,
true
);
int64_t
et
=
taosGetTimestampUs
();
tsdbDebug
(
"%p uid:%"
PRIu64
", composed data block created, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d, elapsed time:%.2f ms %s"
,
pReader
,
pBlockScanInfo
->
uid
,
pResBlock
->
info
.
window
.
skey
,
pResBlock
->
info
.
window
.
ekey
,
pResBlock
->
info
.
rows
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
tsdbDebug
(
"%p uid:%"
PRIu64
", composed data block created, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d, elapsed time:%.2f ms %s"
,
pReader
,
pBlockScanInfo
->
uid
,
pResBlock
->
info
.
window
.
skey
,
pResBlock
->
info
.
window
.
ekey
,
pResBlock
->
info
.
rows
,
(
et
-
st
)
/
1000
.
0
,
pReader
->
idStr
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2228,7 +2229,7 @@ void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader) {
if
(
pReader
->
pSchema
==
NULL
)
{
metaGetTbTSchemaEx
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pReader
->
suid
,
uid
,
sversion
,
&
pReader
->
pSchema
);
}
else
if
(
pReader
->
pSchema
->
version
!=
sversion
)
{
}
else
if
(
pReader
->
pSchema
->
version
<
sversion
)
{
taosMemoryFreeClear
(
pReader
->
pSchema
);
metaGetTbTSchemaEx
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pReader
->
suid
,
uid
,
sversion
,
&
pReader
->
pSchema
);
}
...
...
@@ -2536,7 +2537,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
STsdbReader
*
pPrevReader
=
pReader
->
innerReader
[
0
];
SDataBlockIter
*
pBlockIter
=
&
pPrevReader
->
status
.
blockIter
;
initFilesetIterator
(
&
pPrevReader
->
status
.
fileIter
,
pPrevReader
->
pReadSnap
->
fs
.
aDFileSet
,
pPrevReader
->
order
,
pPrevReader
->
idStr
);
initFilesetIterator
(
&
pPrevReader
->
status
.
fileIter
,
pPrevReader
->
pReadSnap
->
fs
.
aDFileSet
,
pPrevReader
->
order
,
pPrevReader
->
idStr
);
resetDataBlockIterator
(
&
pPrevReader
->
status
.
blockIter
,
pPrevReader
->
order
,
pReader
->
status
.
pTableMap
);
// no data in files, let's try buffer in memory
...
...
@@ -2591,12 +2593,14 @@ void tsdbReaderClose(STsdbReader* pReader) {
SIOCostSummary
*
pCost
=
&
pReader
->
cost
;
tsdbDebug
(
"%p :io-cost summary: head-file:%"
PRIu64
", head-file time:%.2f ms, SMA:%"
PRId64
" SMA-time:%.2f ms, "
"fileBlocks:%"
PRId64
", fileBlocks-time:%.2f ms, build in-memory-block-time:%.2f ms, STableBlockScanInfo "
tsdbDebug
(
"%p :io-cost summary: head-file:%"
PRIu64
", head-file time:%.2f ms, SMA:%"
PRId64
" SMA-time:%.2f ms, "
"fileBlocks:%"
PRId64
", fileBlocks-time:%.2f ms, build in-memory-block-time:%.2f ms, STableBlockScanInfo "
"size:%.2f Kb %s"
,
pReader
,
pCost
->
headFileLoad
,
pCost
->
headFileLoadTime
,
pCost
->
smaData
,
pCost
->
smaLoadTime
,
pCost
->
numOfBlocks
,
pCost
->
blockLoadTime
,
pCost
->
buildmemBlock
,
numOfTables
*
sizeof
(
STableBlockScanInfo
)
/
1000
.
0
,
pReader
->
idStr
);
numOfTables
*
sizeof
(
STableBlockScanInfo
)
/
1000
.
0
,
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
pSchema
);
...
...
@@ -2691,7 +2695,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
int32_t
code
=
0
;
*
allHave
=
false
;
if
(
pReader
->
type
==
TIMEWINDOW_RANGE_EXTERNAL
)
{
if
(
pReader
->
type
==
TIMEWINDOW_RANGE_EXTERNAL
)
{
*
pBlockStatis
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2835,8 +2839,8 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
}
else
{
code
=
initForFirstBlockInFile
(
pReader
,
pBlockIter
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p reset reader failed, numOfTables:%d, query range:%"
PRId64
" - %"
PRId64
" in query %s"
,
pReader
,
numOfTables
,
pReader
->
window
.
skey
,
pReader
->
window
.
ekey
,
pReader
->
idStr
);
tsdbError
(
"%p reset reader failed, numOfTables:%d, query range:%"
PRId64
" - %"
PRId64
" in query %s"
,
pReader
,
numOfTables
,
pReader
->
window
.
skey
,
pReader
->
window
.
ekey
,
pReader
->
idStr
);
return
code
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录