Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1dd89a44
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看板
提交
1dd89a44
编写于
7月 07, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/3_liaohj' of
https://github.com/taosdata/TDengine
into feature/3_liaohj
上级
dd4f67df
41be3e4d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
50 deletion
+52
-50
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+47
-45
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-2
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
1dd89a44
...
...
@@ -131,7 +131,7 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, SArray *pTabl
void
tsdbReaderClose
(
STsdbReader
*
pReader
);
bool
tsdbNextDataBlock
(
STsdbReader
*
pReader
);
void
tsdbRetrieveDataBlockInfo
(
STsdbReader
*
pReader
,
SDataBlockInfo
*
pDataBlockInfo
);
int32_t
tsdbRetrieveDatablockSMA
Info
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
int32_t
tsdbRetrieveDatablockSMA
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
SArray
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
int32_t
tsdbReaderReset
(
STsdbReader
*
pReader
,
SQueryTableDataCond
*
pCond
,
int32_t
tWinIdx
);
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
1dd89a44
...
...
@@ -55,6 +55,7 @@ typedef struct SIOCostSummary {
}
SIOCostSummary
;
typedef
struct
SBlockLoadSuppInfo
{
SArray
*
pColAgg
;
SColumnDataAgg
tsColAgg
;
SColumnDataAgg
**
plist
;
int16_t
*
colIds
;
// column ids for loading file block data
...
...
@@ -364,8 +365,9 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
// allocate buffer in order to load data blocks from file
SBlockLoadSuppInfo
*
pSup
=
&
pReader
->
suppInfo
;
pSup
->
pColAgg
=
taosArrayInit
(
4
,
sizeof
(
SColumnDataAgg
));
pSup
->
plist
=
taosMemoryCalloc
(
pCond
->
numOfCols
,
POINTER_BYTES
);
if
(
pSup
->
plist
==
NULL
)
{
if
(
pSup
->
p
ColAgg
==
NULL
||
pSup
->
p
list
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_end
;
}
...
...
@@ -2649,13 +2651,10 @@ void tsdbReaderClose(STsdbReader* pReader) {
blockDataDestroy
(
pReader
->
pResBlock
);
taosMemoryFreeClear
(
pReader
->
suppInfo
.
plist
);
taosArrayDestroy
(
pReader
->
suppInfo
.
pColAgg
);
taosMemoryFree
(
pReader
->
suppInfo
.
slotIds
);
if
(
!
isEmptyQueryTimeWindow
(
&
pReader
->
window
))
{
// tsdbMayUnTakeMemSnapshot(pTsdbReadHandle);
}
else
{
ASSERT
(
pReader
->
status
.
pTableMap
==
NULL
);
}
#if 0
// if (pReader->status.pTableScanInfo != NULL) {
// pReader->status.pTableScanInfo = destroyTableCheckInfo(pReader->status.pTableScanInfo);
...
...
@@ -2727,7 +2726,7 @@ void tsdbRetrieveDataBlockInfo(STsdbReader* pReader, SDataBlockInfo* pDataBlockI
pDataBlockInfo
->
window
=
pReader
->
pResBlock
->
info
.
window
;
}
int32_t
tsdbRetrieveDatablockSMA
Info
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
)
{
int32_t
tsdbRetrieveDatablockSMA
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
)
{
int32_t
code
=
0
;
*
allHave
=
false
;
...
...
@@ -2743,12 +2742,13 @@ int32_t tsdbRetrieveDatablockSMAInfo(STsdbReader* pReader, SColumnDataAgg*** pBl
int64_t
stime
=
taosGetTimestampUs
();
SArray
*
pColAgg
=
taosArrayInit
(
4
,
sizeof
(
SColumnDataAgg
));
SBlockLoadSuppInfo
*
pSup
=
&
pReader
->
suppInfo
;
if
(
tBlockHasSma
(
pBlock
))
{
code
=
tsdbReadBlockSma
(
pReader
->
pFileReader
,
pBlock
,
pColAgg
,
NULL
);
code
=
tsdbReadBlockSma
(
pReader
->
pFileReader
,
pBlock
,
p
Sup
->
p
ColAgg
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbDebug
(
"vgId:%d, failed to load block SMA for uid %"
PRIu64
", code:%s, %s"
,
0
,
pFBlock
->
uid
,
tstrerror
(
code
),
pReader
->
idStr
);
tsdbDebug
(
"vgId:%d, failed to load block SMA for uid %"
PRIu64
", code:%s, %s"
,
0
,
pFBlock
->
uid
,
tstrerror
(
code
)
,
pReader
->
idStr
);
return
code
;
}
}
else
{
...
...
@@ -2756,44 +2756,44 @@ int32_t tsdbRetrieveDatablockSMAInfo(STsdbReader* pReader, SColumnDataAgg*** pBl
return
TSDB_CODE_SUCCESS
;
}
*
allHave
=
true
;
*
allHave
=
true
;
// always load the first primary timestamp column data
SColumnDataAgg
*
pTsAgg
=
&
pReader
->
suppInfo
.
tsColAgg
;
// always load the first primary timestamp column data
SColumnDataAgg
*
pTsAgg
=
&
pSup
->
tsColAgg
;
pTsAgg
->
numOfNull
=
0
;
pTsAgg
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
pTsAgg
->
min
=
pReader
->
pResBlock
->
info
.
window
.
skey
;
pTsAgg
->
max
=
pReader
->
pResBlock
->
info
.
window
.
ekey
;
pReader
->
suppInfo
.
plist
[
0
]
=
pTsAgg
;
// update the number of NULL data rows
size_t
numOfCols
=
blockDataGetNumOfCols
(
pReader
->
pResBlock
);
int32_t
i
=
0
,
j
=
0
;
while
(
j
<
numOfCols
&&
i
<
taosArrayGetSize
(
pColAgg
))
{
SColumnDataAgg
*
pAgg
=
taosArrayGet
(
pColAgg
,
i
);
if
(
pAgg
->
colId
==
pReader
->
suppInfo
.
colIds
[
j
])
{
if
(
IS_BSMA_ON
(
&
(
pReader
->
pSchema
->
columns
[
i
])))
{
pReader
->
suppInfo
.
plist
[
j
]
=
pAgg
;
i
+=
1
;
j
+=
1
;
}
else
{
*
allHave
=
false
;
}
}
else
if
(
pAgg
->
colId
<
pReader
->
suppInfo
.
colIds
[
j
])
{
i
+=
1
;
}
else
if
(
pReader
->
suppInfo
.
colIds
[
j
]
<
pAgg
->
colId
)
{
j
+=
1
;
}
}
int64_t
elapsed
=
taosGetTimestampUs
()
-
stime
;
pReader
->
cost
.
smaLoadTime
+=
elapsed
;
*
pBlockStatis
=
pReader
->
suppInfo
.
plist
;
tsdbDebug
(
"vgId:%d, succeed to load block SMA for uid %"
PRIu64
", elapsed time:%"
PRId64
"us, %s"
,
0
,
pFBlock
->
uid
,
pTsAgg
->
min
=
pReader
->
pResBlock
->
info
.
window
.
skey
;
pTsAgg
->
max
=
pReader
->
pResBlock
->
info
.
window
.
ekey
;
pSup
->
plist
[
0
]
=
pTsAgg
;
// update the number of NULL data rows
size_t
numOfCols
=
blockDataGetNumOfCols
(
pReader
->
pResBlock
);
int32_t
i
=
0
,
j
=
0
;
while
(
j
<
numOfCols
&&
i
<
taosArrayGetSize
(
pSup
->
pColAgg
))
{
SColumnDataAgg
*
pAgg
=
taosArrayGet
(
pSup
->
pColAgg
,
i
);
if
(
pAgg
->
colId
==
pSup
->
colIds
[
j
])
{
if
(
IS_BSMA_ON
(
&
(
pReader
->
pSchema
->
columns
[
i
])))
{
pSup
->
plist
[
j
]
=
pAgg
;
i
+=
1
;
j
+=
1
;
}
else
{
*
allHave
=
false
;
}
}
else
if
(
pAgg
->
colId
<
pSup
->
colIds
[
j
])
{
i
+=
1
;
}
else
if
(
pSup
->
colIds
[
j
]
<
pAgg
->
colId
)
{
j
+=
1
;
}
}
int64_t
elapsed
=
taosGetTimestampUs
()
-
stime
;
pReader
->
cost
.
smaLoadTime
+=
elapsed
;
*
pBlockStatis
=
pSup
->
plist
;
tsdbDebug
(
"vgId:%d, succeed to load block SMA for uid %"
PRIu64
", elapsed time:%"
PRId64
"us, %s"
,
0
,
pFBlock
->
uid
,
elapsed
,
pReader
->
idStr
);
return
code
;
...
...
@@ -2841,6 +2841,8 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
memset
(
&
pReader
->
suppInfo
.
tsColAgg
,
0
,
sizeof
(
SColumnDataAgg
));
memset
(
pReader
->
suppInfo
.
plist
,
0
,
POINTER_BYTES
);
pReader
->
suppInfo
.
tsColAgg
.
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
// todo set the correct numOfTables
int32_t
numOfTables
=
1
;
SDataBlockIter
*
pBlockIter
=
&
pReader
->
status
.
blockIter
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
1dd89a44
...
...
@@ -1130,7 +1130,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
} else if ((*status) == BLK_DATA_SMA_LOAD) {
// this function never returns error?
pCost->loadBlockStatis += 1;
// tsdbRetrieveDatablockSMA
Info
(pTableScanInfo->pTsdbReadHandle, &pBlock->pBlockAgg);
// tsdbRetrieveDatablockSMA(pTableScanInfo->pTsdbReadHandle, &pBlock->pBlockAgg);
if (pBlock->pBlockAgg == NULL) { // data block statistics does not exist, load data block
// pBlock->pDataBlock = tsdbRetrieveDataBlock(pTableScanInfo->pTsdbReadHandle, NULL);
...
...
@@ -1141,7 +1141,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
// load the data block statistics to perform further filter
pCost->loadBlockStatis += 1;
// tsdbRetrieveDatablockSMA
Info
(pTableScanInfo->pTsdbReadHandle, &pBlock->pBlockAgg);
// tsdbRetrieveDatablockSMA(pTableScanInfo->pTsdbReadHandle, &pBlock->pBlockAgg);
if (pQueryAttr->topBotQuery && pBlock->pBlockAgg != NULL) {
{ // set previous window
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
1dd89a44
...
...
@@ -210,7 +210,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
bool
allColumnsHaveAgg
=
true
;
SColumnDataAgg
**
pColAgg
=
NULL
;
int32_t
code
=
tsdbRetrieveDatablockSMA
Info
(
pTableScanInfo
->
dataReader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
int32_t
code
=
tsdbRetrieveDatablockSMA
(
pTableScanInfo
->
dataReader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
longjmp
(
pTaskInfo
->
env
,
code
);
}
...
...
@@ -2230,7 +2230,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
bool
allColumnsHaveAgg
=
true
;
SColumnDataAgg
**
pColAgg
=
NULL
;
STsdbReader
*
reader
=
taosArrayGetP
(
pTableScanInfo
->
dataReaders
,
readerIdx
);
tsdbRetrieveDatablockSMA
Info
(
reader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
tsdbRetrieveDatablockSMA
(
reader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
if
(
allColumnsHaveAgg
==
true
)
{
int32_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录