Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9e98c64b
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看板
提交
9e98c64b
编写于
6月 30, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tsdb): set correct stt load info. update the test case.
上级
450a9f3c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
44 deletion
+34
-44
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+13
-8
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+19
-34
tests/system-test/2-query/smaBasic.py
tests/system-test/2-query/smaBasic.py
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
9e98c64b
...
...
@@ -816,7 +816,7 @@ SSttBlockLoadInfo *tCreateOneLastBlockLoadInfo(STSchema *pSchema, int16_t *colLi
void
resetLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
);
void
getLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
,
int64_t
*
blocks
,
double
*
el
);
void
*
destroyLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
);
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
);
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
int64_t
*
blocks
,
double
*
el
);
// tsdbCache ==============================================================================================
typedef
struct
SCacheRowsReader
{
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
9e98c64b
...
...
@@ -134,14 +134,13 @@ void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
return
NULL
;
}
static
void
destroyLDataIterFn
(
void
*
param
)
{
SLDataIter
**
pIter
=
(
SLDataIter
**
)
param
;
tLDataIterClose2
(
*
pIter
);
destroyLastBlockLoadInfo
((
*
pIter
)
->
pBlockLoadInfo
);
taosMemoryFree
(
*
pIter
);
static
void
destroyLDataIter
(
SLDataIter
*
pIter
)
{
tLDataIterClose2
(
pIter
);
destroyLastBlockLoadInfo
(
pIter
->
pBlockLoadInfo
);
taosMemoryFree
(
pIter
);
}
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
)
{
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
int64_t
*
blocks
,
double
*
el
)
{
if
(
pLDataIterArray
==
NULL
)
{
return
NULL
;
}
...
...
@@ -149,7 +148,13 @@ void* destroySttBlockReader(SArray* pLDataIterArray) {
int32_t
numOfLevel
=
taosArrayGetSize
(
pLDataIterArray
);
for
(
int32_t
i
=
0
;
i
<
numOfLevel
;
++
i
)
{
SArray
*
pList
=
taosArrayGetP
(
pLDataIterArray
,
i
);
taosArrayDestroyEx
(
pList
,
destroyLDataIterFn
);
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pList
);
++
j
)
{
SLDataIter
*
pIter
=
taosArrayGetP
(
pList
,
j
);
*
el
+=
pIter
->
pBlockLoadInfo
->
elapsedTime
;
*
blocks
+=
pIter
->
pBlockLoadInfo
->
loadBlocks
;
destroyLDataIter
(
pIter
);
}
taosArrayDestroy
(
pList
);
}
taosArrayDestroy
(
pLDataIterArray
);
...
...
@@ -499,7 +504,7 @@ void tLDataIterNextBlock(SLDataIter *pIter, const char *idStr) {
if
(
index
!=
-
1
)
{
pIter
->
iSttBlk
=
index
;
pIter
->
pSttBlk
=
(
SSttBlk
*
)
taosArrayGet
(
pIter
->
pBlockLoadInfo
->
aSttBlk
,
pIter
->
iSttBlk
);
tsdbDebug
(
"try next last file block:%d from %d, trigger by uid:%"
PRIu64
", file index:%d, %s"
,
pIter
->
iSttBlk
,
tsdbDebug
(
"try next last file block:%d from
stt fileIdx:
%d, trigger by uid:%"
PRIu64
", file index:%d, %s"
,
pIter
->
iSttBlk
,
oldIndex
,
pIter
->
uid
,
pIter
->
iStt
,
idStr
);
}
else
{
tsdbDebug
(
"no more last block qualified, uid:%"
PRIu64
", file index:%d, %s"
,
pIter
->
uid
,
oldIndex
,
idStr
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
9e98c64b
...
...
@@ -564,17 +564,17 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA
pLReader
->
uid
=
0
;
tMergeTreeClose
(
&
pLReader
->
mergeTree
);
if
(
pLReader
->
pInfo
==
NULL
)
{
// here we ignore the first column, which is always be the primary timestamp column
SBlockLoadSuppInfo
*
pInfo
=
&
pReader
->
suppInfo
;
// todo dynamic number of stt
int32_t
numOfStt
=
pReader
->
pTsdb
->
pVnode
->
config
.
sttTrigger
;
pLReader
->
pInfo
=
tCreateLastBlockLoadInfo
(
pReader
->
pSchema
,
&
pInfo
->
colId
[
1
],
pInfo
->
numOfCols
-
1
,
numOfStt
);
if
(
pLReader
->
pInfo
==
NULL
)
{
tsdbDebug
(
"init fileset iterator failed, code:%s %s"
,
tstrerror
(
terrno
),
pReader
->
idStr
);
return
terrno
;
}
}
//
if (pLReader->pInfo == NULL) {
//
// here we ignore the first column, which is always be the primary timestamp column
//
SBlockLoadSuppInfo* pInfo = &pReader->suppInfo;
//
// todo dynamic number of stt
//
int32_t numOfStt = pReader->pTsdb->pVnode->config.sttTrigger;
//
pLReader->pInfo = tCreateLastBlockLoadInfo(pReader->pSchema, &pInfo->colId[1], pInfo->numOfCols - 1, numOfStt);
//
if (pLReader->pInfo == NULL) {
//
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr);
//
return terrno;
//
}
//
}
tsdbDebug
(
"init fileset iterator, total files:%d %s"
,
pIter
->
numOfFiles
,
pReader
->
idStr
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -592,16 +592,13 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
}
SIOCostSummary
*
pSum
=
&
pReader
->
cost
;
getLastBlockLoadInfo
(
pIter
->
pLastBlockReader
->
pInfo
,
&
pSum
->
lastBlockLoad
,
&
pReader
->
cost
.
lastBlockLoadTime
);
pIter
->
pLastBlockReader
->
uid
=
0
;
tMergeTreeClose
(
&
pIter
->
pLastBlockReader
->
mergeTree
);
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
);
pReader
->
status
.
pLDataIterArray
=
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pSum
->
lastBlockLoad
,
&
pSum
->
lastBlockLoadTime
);
pReader
->
status
.
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
resetLastBlockLoadInfo
(
pIter
->
pLastBlockReader
->
pInfo
);
// check file the time range of coverage
STimeWindow
win
=
{
0
};
...
...
@@ -1580,17 +1577,11 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
}
SBlockLoadSuppInfo
*
pSup
=
&
pReader
->
suppInfo
;
TABLEID
tid
=
{.
suid
=
pReader
->
suid
,
.
uid
=
uid
};
code
=
tBlockDataInit
(
pBlockData
,
&
tid
,
pSchema
,
&
pSup
->
colId
[
1
],
pSup
->
numOfCols
-
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
pBlockIter
);
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBrinRecord
*
pRecord
=
&
pBlockInfo
->
record
;
code
=
tsdbDataFileReadBlockDataByColumn
(
pReader
->
pFileReader
,
pRecord
,
pBlockData
,
p
Reader
->
p
Schema
,
&
pSup
->
colId
[
1
],
code
=
tsdbDataFileReadBlockDataByColumn
(
pReader
->
pFileReader
,
pRecord
,
pBlockData
,
pSchema
,
&
pSup
->
colId
[
1
],
pSup
->
numOfCols
-
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p error occurs in loading file block, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
...
...
@@ -2010,8 +2001,8 @@ static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo*
// 4. output buffer should be large enough to hold all rows in current block
// 5. delete info should not overlap with current block data
// 6. current block should not contain the duplicated ts
static
bool
fileBlockShouldLoad
(
STsdbReader
*
pReader
,
SFileDataBlockInfo
*
pBlockInfo
,
STableBlockScanInfo
*
pScanInfo
,
TSDBKEY
keyInBuf
,
SLastBlockReader
*
pLastBlockReader
)
{
static
bool
fileBlockShouldLoad
(
STsdbReader
*
pReader
,
SFileDataBlockInfo
*
pBlockInfo
,
STableBlockScanInfo
*
pScanInfo
,
TSDBKEY
keyInBuf
,
SLastBlockReader
*
pLastBlockReader
)
{
SDataBlockToLoadInfo
info
=
{
0
};
getBlockToLoadInfo
(
&
info
,
pBlockInfo
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
,
pReader
);
...
...
@@ -2022,8 +2013,8 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pBlock
// log the reason why load the datablock for profile
if
(
loadDataBlock
)
{
tsdbDebug
(
"%p uid:%"
PRIu64
" need to load the datablock, overlapneighbor:%d, hasDup:%d, partiallyRequired:%d, "
"overlapWithKey:%d, greaterThanBuf:%d, overlapWithDel:%d, overlapWithlastBlock:%d, %s"
,
" need to load the datablock, overlapneighbor:%d, hasDup:%d, partiallyRequired:%d, "
"overlapWithKey:%d, greaterThanBuf:%d, overlapWithDel:%d, overlapWithlastBlock:%d, %s"
,
pReader
,
pBlockInfo
->
uid
,
info
.
overlapWithNeighborBlock
,
info
.
hasDupTs
,
info
.
partiallyRequired
,
info
.
overlapWithKeyInBuf
,
info
.
moreThanCapcity
,
info
.
overlapWithDelInfo
,
info
.
overlapWithLastBlock
,
pReader
->
idStr
);
...
...
@@ -3566,8 +3557,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
// update the last key for the corresponding table
pScanInfo
->
lastKey
=
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
pInfo
->
window
.
ekey
:
pInfo
->
window
.
skey
;
tsdbDebug
(
"%p uid:%"
PRIu64
" clean file block retrieved from file, global index:%d, "
tsdbDebug
(
"%p uid:%"
PRIu64
" clean file block retrieved from file, global index:%d, "
"table index:%d, rows:%d, brange:%"
PRId64
"-%"
PRId64
", %s"
,
pReader
,
pScanInfo
->
uid
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pBlockInfo
->
record
.
numRow
,
pBlockInfo
->
record
.
firstKey
,
pBlockInfo
->
record
.
lastKey
,
pReader
->
idStr
);
...
...
@@ -3893,8 +3883,6 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
initBlockDumpInfo
(
pReader
,
pBlockIter
);
}
else
{
// all data blocks in files are checked, let's check the data in last files.
// ASSERT(pReader->status.pCurrentFileset->nSttF > 0);
// data blocks in current file are exhausted, let's try the next file now
SBlockData
*
pBlockData
=
&
pReader
->
status
.
fileBlockData
;
if
(
pBlockData
->
uid
!=
0
)
{
...
...
@@ -4913,13 +4901,10 @@ void tsdbReaderClose2(STsdbReader* pReader) {
if
(
pFilesetIter
->
pLastBlockReader
!=
NULL
)
{
SLastBlockReader
*
pLReader
=
pFilesetIter
->
pLastBlockReader
;
tMergeTreeClose
(
&
pLReader
->
mergeTree
);
getLastBlockLoadInfo
(
pLReader
->
pInfo
,
&
pCost
->
lastBlockLoad
,
&
pCost
->
lastBlockLoadTime
);
pLReader
->
pInfo
=
destroyLastBlockLoadInfo
(
pLReader
->
pInfo
);
taosMemoryFree
(
pLReader
);
}
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
);
destroySttBlockReader
(
pReader
->
status
.
pLDataIterArray
,
&
pCost
->
lastBlockLoad
,
&
pCost
->
lastBlockLoadTime
);
taosMemoryFreeClear
(
pReader
->
status
.
uidList
.
tableUidList
);
tsdbDebug
(
...
...
tests/system-test/2-query/smaBasic.py
浏览文件 @
9e98c64b
...
...
@@ -127,7 +127,7 @@ class TDTestCase:
self
.
c2Sum
=
None
# create database db
sql
=
f
"create database db vgroups 5 replica 3"
sql
=
f
"create database db vgroups 5 replica 3
stt_trigger 1
"
tdLog
.
info
(
sql
)
tdSql
.
execute
(
sql
)
sql
=
f
"use db"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录