Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8a328b66
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22019
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看板
提交
8a328b66
编写于
5月 18, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix error in stream read.
上级
5d5b2bb1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
127 deletion
+33
-127
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+32
-127
source/libs/stream/src/streamQueue.c
source/libs/stream/src/streamQueue.c
+1
-0
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
8a328b66
...
...
@@ -2080,17 +2080,35 @@ FETCH_NEXT_BLOCK:
int32_t
totalBlocks
=
taosArrayGetSize
(
pInfo
->
pBlockLists
);
NEXT_SUBMIT_BLK:
while
(
1
)
{
bool
hasResult
=
tqNextBlockInWal
(
pInfo
->
tqReader
,
id
);
SSDataBlock
*
pRes
=
pInfo
->
tqReader
->
pResBlock
;
if
(
pInfo
->
tqReader
->
msg
.
msgStr
==
NULL
)
{
if
(
pInfo
->
validBlockIndex
>=
totalBlocks
)
{
updateInfoDestoryColseWinSBF
(
pInfo
->
pUpdateInfo
);
doClearBufferedBlocks
(
pInfo
);
qDebug
(
"stream scan return empty, all %d submit blocks consumed, %s"
,
totalBlocks
,
id
);
return
NULL
;
}
int32_t
current
=
pInfo
->
validBlockIndex
++
;
SPackedData
*
pSubmit
=
taosArrayGet
(
pInfo
->
pBlockLists
,
current
);
qDebug
(
"set %d/%d as the input submit block, %s"
,
current
,
totalBlocks
,
id
);
if
(
tqReaderSetSubmitMsg
(
pInfo
->
tqReader
,
pSubmit
->
msgStr
,
pSubmit
->
msgLen
,
pSubmit
->
ver
)
<
0
)
{
qError
(
"submit msg messed up when initializing stream submit block %p, current %d/%d, %s"
,
pSubmit
,
current
,
totalBlocks
,
id
);
continue
;
}
}
blockDataCleanup
(
pBlock
);
if
(
hasResult
)
{
qDebug
(
"stream scan get data from log %"
PRId64
" rows, version:%"
PRId64
,
pRes
->
info
.
rows
,
pTaskInfo
->
streamInfo
.
currentOffset
.
version
);
setBlockIntoRes
(
pInfo
,
pRes
,
true
);
while
(
tqNextBlockImpl
(
pInfo
->
tqReader
,
id
))
{
int32_t
code
=
tqRetrieveDataBlock
(
pInfo
->
tqReader
,
id
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
pInfo
->
tqReader
->
pResBlock
->
info
.
rows
==
0
)
{
continue
;
}
setBlockIntoRes
(
pInfo
,
pInfo
->
tqReader
->
pResBlock
,
false
);
if
(
pInfo
->
pCreateTbRes
->
info
.
rows
>
0
)
{
pInfo
->
scanMode
=
STREAM_SCAN_FROM_RES
;
...
...
@@ -2101,16 +2119,16 @@ FETCH_NEXT_BLOCK:
doFilter
(
pBlock
,
pOperator
->
exprSupp
.
pFilterInfo
,
NULL
);
pBlock
->
info
.
dataLoad
=
1
;
blockDataUpdateTsWindow
(
pBlock
,
pInfo
->
primaryTsIndex
);
}
else
{
updateInfoDestoryColseWinSBF
(
pInfo
->
pUpdateInfo
);
doClearBufferedBlocks
(
pInfo
);
qDebug
(
"stream scan return empty, all %d submit blocks consumed, %s"
,
totalBlocks
,
id
);
return
NULL
;
if
(
pBlockInfo
->
rows
>
0
||
pInfo
->
pUpdateDataRes
->
info
.
rows
>
0
)
{
break
;
}
}
if
(
pBlockInfo
->
rows
>
0
||
pInfo
->
pUpdateDataRes
->
info
.
rows
>
0
)
{
break
;
}
else
{
continue
;
}
}
...
...
@@ -2118,7 +2136,7 @@ FETCH_NEXT_BLOCK:
pInfo
->
numOfExec
++
;
pOperator
->
resultInfo
.
totalRows
+=
pBlockInfo
->
rows
;
qDebug
(
"stream scan get source rows:%"
PRId64
", %s"
,
pBlockInfo
->
rows
,
id
);
qDebug
(
"stream scan get source rows:%"
PRId64
", %s"
,
pBlockInfo
->
rows
,
id
);
if
(
pBlockInfo
->
rows
>
0
)
{
return
pBlock
;
}
...
...
@@ -2128,83 +2146,8 @@ FETCH_NEXT_BLOCK:
}
goto
NEXT_SUBMIT_BLK
;
// } else {
// qDebug("stream scan get none from log, return, version:%" PRId64,
// pTaskInfo->streamInfo.currentOffset.version); return NULL;
// }
// while (1) {
// if (pInfo->tqReader->msg.msgStr == NULL) {
// if (pInfo->validBlockIndex >= totalBlocks) {
// updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo);
// doClearBufferedBlocks(pInfo);
//
// qDebug("stream scan return empty, all %d submit blocks consumed, %s", totalBlocks, id);
// return NULL;
// }
//
// int32_t current = pInfo->validBlockIndex++;
// SPackedData* pSubmit = taosArrayGet(pInfo->pBlockLists, current);
//
// qDebug("set %d/%d as the input submit block, %s", current, totalBlocks, id);
// if (tqReaderSetSubmitMsg(pInfo->tqReader, pSubmit->msgStr, pSubmit->msgLen, pSubmit->ver) < 0) {
// qError("submit msg messed up when initializing stream submit block %p, current %d/%d, %s", pSubmit,
// current, totalBlocks, id); continue;
// }
// }
//
// blockDataCleanup(pInfo->pRes);
//
// while (tqNextBlockImpl(pInfo->tqReader, id)) {
// int32_t code = tqRetrieveDataBlock(pInfo->tqReader, id);
// if (code != TSDB_CODE_SUCCESS || pInfo->tqReader->pResBlock->info.rows == 0) {
// continue;
// }
//
// setBlockIntoRes(pInfo, pInfo->tqReader->pResBlock, false);
//
// if (pInfo->pCreateTbRes->info.rows > 0) {
// pInfo->scanMode = STREAM_SCAN_FROM_RES;
// return pInfo->pCreateTbRes;
// }
//
// doCheckUpdate(pInfo, pBlockInfo->window.ekey, pInfo->pRes);
// doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
// pInfo->pRes->info.dataLoad = 1;
// blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
//
// if (pBlockInfo->rows > 0 || pInfo->pUpdateDataRes->info.rows > 0) {
// break;
// }
// }
//
// if (pBlockInfo->rows > 0 || pInfo->pUpdateDataRes->info.rows > 0) {
// break;
// } else {
// continue;
// }
// }
//
// // record the scan action.
// pInfo->numOfExec++;
// pOperator->resultInfo.totalRows += pBlockInfo->rows;
//
// qDebug("stream scan get source rows:%" PRId64", %s", pBlockInfo->rows, id);
// if (pBlockInfo->rows > 0) {
// return pInfo->pRes;
// }
//
// if (pInfo->pUpdateDataRes->info.rows > 0) {
// goto FETCH_NEXT_BLOCK;
// }
//
// goto NEXT_SUBMIT_BLK;
// } else {
// ASSERT(0);
// return NULL;
// }
}
return
NULL
;
}
...
...
@@ -2293,44 +2236,6 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
return
NULL
;
}
// else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__LOG) {
// int64_t fetchVer = pTaskInfo->streamInfo.prepareStatus.version + 1;
//
// while(1){
// if (tqFetchLog(pInfo->tqReader->pWalReader, pInfo->sContext->withMeta, &fetchVer, &pInfo->pCkHead) < 0) {
// qDebug("tmqsnap tmq poll: consumer log end. offset %" PRId64, fetchVer);
// pTaskInfo->streamInfo.lastStatus.version = fetchVer;
// pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__LOG;
// return NULL;
// }
// SWalCont* pHead = &pInfo->pCkHead->head;
// qDebug("tmqsnap tmq poll: consumer log offset %" PRId64 " msgType %d", fetchVer, pHead->msgType);
//
// if (pHead->msgType == TDMT_VND_SUBMIT) {
// SSubmitReq* pCont = (SSubmitReq*)&pHead->body;
// tqReaderSetDataMsg(pInfo->tqReader, pCont, 0);
// SSDataBlock* block = tqLogScanExec(pInfo->sContext->subType, pInfo->tqReader, pInfo->pFilterOutTbUid,
// &pInfo->pRes); if(block){
// pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__LOG;
// pTaskInfo->streamInfo.lastStatus.version = fetchVer;
// qDebug("tmqsnap fetch data msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType);
// return block;
// }else{
// fetchVer++;
// }
// } else{
// ASSERT(pInfo->sContext->withMeta);
// ASSERT(IS_META_MSG(pHead->msgType));
// qDebug("tmqsnap fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType);
// pTaskInfo->streamInfo.metaRsp.rspOffset.version = fetchVer;
// pTaskInfo->streamInfo.metaRsp.rspOffset.type = TMQ_OFFSET__LOG;
// pTaskInfo->streamInfo.metaRsp.resMsgType = pHead->msgType;
// pTaskInfo->streamInfo.metaRsp.metaRspLen = pHead->bodyLen;
// pTaskInfo->streamInfo.metaRsp.metaRsp = taosMemoryMalloc(pHead->bodyLen);
// memcpy(pTaskInfo->streamInfo.metaRsp.metaRsp, pHead->body, pHead->bodyLen);
// return NULL;
// }
// }
return
NULL
;
}
...
...
source/libs/stream/src/streamQueue.c
浏览文件 @
8a328b66
...
...
@@ -27,6 +27,7 @@ SStreamQueue* streamQueueOpen(int64_t cap) {
taosSetQueueCapacity
(
pQueue
->
queue
,
cap
);
taosSetQueueMemoryCapacity
(
pQueue
->
queue
,
cap
*
1024
);
return
pQueue
;
FAIL:
if
(
pQueue
->
queue
)
taosCloseQueue
(
pQueue
->
queue
);
if
(
pQueue
->
qall
)
taosFreeQall
(
pQueue
->
qall
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录