Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94f07836
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看板
提交
94f07836
编写于
6月 30, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tmq): set scan rsp offset correctly
上级
ca1c961f
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
44 addition
and
52 deletion
+44
-52
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+0
-1
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+6
-5
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-6
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+7
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+27
-9
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+0
-29
tests/script/tsim/tmq/snapshot1.sim
tests/script/tsim/tmq/snapshot1.sim
+2
-0
未找到文件。
include/libs/executor/executor.h
浏览文件 @
94f07836
...
...
@@ -172,7 +172,7 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le
*/
int32_t
qGetStreamScanStatus
(
qTaskInfo_t
tinfo
,
uint64_t
*
uid
,
int64_t
*
ts
);
int32_t
qPrepareScan
(
qTaskInfo_t
tinfo
,
uint64_t
uid
,
int64_t
ts
);
int32_t
q
Stream
PrepareScan
(
qTaskInfo_t
tinfo
,
uint64_t
uid
,
int64_t
ts
);
#ifdef __cplusplus
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
94f07836
...
...
@@ -389,7 +389,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
// 4. send rsp
if
(
dataRsp
.
blockNum
!=
0
)
{
tqOffsetResetToData
(
&
dataRsp
.
rspOffset
,
0
,
0
);
if
(
tqSendDataRsp
(
pTq
,
pMsg
,
pReq
,
&
dataRsp
)
<
0
)
{
code
=
-
1
;
}
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
94f07836
...
...
@@ -63,10 +63,11 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S
ASSERT
(
pExec
->
subType
==
TOPIC_SUB_TYPE__COLUMN
);
qTaskInfo_t
task
=
pExec
->
execCol
.
task
[
workerId
];
if
(
qStreamScanSnapshot
(
task
)
<
0
)
{
ASSERT
(
0
);
}
if
(
qPrepareScan
(
task
,
offset
.
uid
,
offset
.
ts
)
<
0
)
{
/*if (qStreamScanSnapshot(task) < 0) {*/
/*ASSERT(0);*/
/*}*/
if
(
qStreamPrepareScan
(
task
,
offset
.
uid
,
offset
.
ts
)
<
0
)
{
ASSERT
(
0
);
}
...
...
@@ -86,7 +87,7 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S
if
(
pRsp
->
withTbName
)
{
pRsp
->
withTbName
=
0
;
#if
1
#if
0
int64_t uid;
int64_t ts;
if (qGetStreamScanStatus(task, &uid, &ts) < 0) {
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
94f07836
...
...
@@ -250,7 +250,7 @@ typedef struct SSampleExecInfo {
enum
{
TABLE_SCAN__TABLE_ORDER
=
1
,
TABLE_SCAN__BLOCK_ORDER
=
1
,
TABLE_SCAN__BLOCK_ORDER
=
2
,
};
typedef
struct
STableScanInfo
{
...
...
@@ -286,11 +286,6 @@ typedef struct STableScanInfo {
int64_t
ts
;
}
lastStatus
;
struct
{
uint64_t
uid
;
int64_t
ts
;
}
expStatus
;
int8_t
scanMode
;
}
STableScanInfo
;
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
94f07836
...
...
@@ -231,9 +231,15 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le
return
decodeOperator
(
pTaskInfo
->
pRoot
,
pInput
,
len
);
}
int32_t
qPrepareScan
(
qTaskInfo_t
tinfo
,
uint64_t
uid
,
int64_t
ts
)
{
int32_t
q
Stream
PrepareScan
(
qTaskInfo_t
tinfo
,
uint64_t
uid
,
int64_t
ts
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
if
(
uid
==
0
)
{
STableKeyInfo
*
pTableInfo
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
0
);
uid
=
pTableInfo
->
uid
;
ts
=
INT64_MIN
;
}
return
doPrepareScan
(
pTaskInfo
->
pRoot
,
uid
,
ts
);
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
94f07836
...
...
@@ -2825,18 +2825,36 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) {
int32_t
type
=
pOperator
->
operatorType
;
if
(
type
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
SStreamBlockScanInfo
*
pScanInfo
=
pOperator
->
info
;
STableScanInfo
*
pSnapShotScanInfo
=
pScanInfo
->
pSnapshotReadOp
->
info
;
/**uid = pSnapShotScanInfo->scanStatus.uid;*/
/**ts = pSnapShotScanInfo->scanStatus.t;*/
if
(
pSnapShotScanInfo
->
lastStatus
.
uid
!=
uid
||
pSnapShotScanInfo
->
lastStatus
.
ts
!=
ts
)
{
// rebuild scan
//
pScanInfo
->
blockType
=
STREAM_INPUT__DATA_SCAN
;
STableScanInfo
*
pInfo
=
pScanInfo
->
pSnapshotReadOp
->
info
;
/*if (pSnapShotScanInfo->dataReader == NULL) {*/
/*pSnapShotScanInfo->dataReader = tsdbReaderOpen(pHandle->vnode, &pSTInfo->cond, tableList, 0, 0);*/
/*pSnapShotScanInfo->scanMode = TABLE_SCAN__TABLE_ORDER;*/
/*}*/
if
(
pInfo
->
lastStatus
.
uid
!=
uid
||
pInfo
->
lastStatus
.
ts
!=
ts
)
{
tsdbSetTableId
(
pInfo
->
dataReader
,
uid
);
SQueryTableDataCond
tmpCond
=
pInfo
->
cond
;
tmpCond
.
twindows
[
0
]
=
(
STimeWindow
){
.
skey
=
ts
,
.
ekey
=
INT64_MAX
,
};
tsdbResetReadHandle
(
pInfo
->
dataReader
,
&
tmpCond
,
0
);
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
}
}
else
{
if
(
pOperator
->
pDownstream
[
0
]
==
NULL
)
{
return
TSDB_CODE_INVALID_PARA
;
if
(
pOperator
->
numOfDownstream
==
1
)
{
return
doPrepareScan
(
pOperator
->
pDownstream
[
0
],
uid
,
ts
);
}
else
if
(
pOperator
->
numOfDownstream
==
0
)
{
qError
(
"failed to find stream scan operator to set the input data block"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
else
{
doPrepareScan
(
pOperator
->
pDownstream
[
0
],
uid
,
ts
);
qError
(
"join not supported for stream block scan"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
94f07836
...
...
@@ -519,35 +519,6 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
// if scan table by table
if
(
pInfo
->
scanMode
==
TABLE_SCAN__TABLE_ORDER
)
{
// check status
if
(
pInfo
->
lastStatus
.
uid
==
pInfo
->
expStatus
.
uid
&&
pInfo
->
lastStatus
.
ts
==
pInfo
->
expStatus
.
ts
)
{
while
(
1
)
{
SSDataBlock
*
result
=
doTableScanGroup
(
pOperator
);
if
(
result
)
{
return
result
;
}
// if no data, switch to next table and continue scan
pInfo
->
currentTable
++
;
if
(
pInfo
->
currentTable
>=
taosArrayGetSize
(
pTaskInfo
->
tableqinfoList
.
pTableList
))
{
return
NULL
;
}
STableKeyInfo
*
pTableInfo
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
pInfo
->
currentTable
);
/*pTableInfo->uid */
tsdbSetTableId
(
pInfo
->
dataReader
,
pTableInfo
->
uid
);
tsdbResetReadHandle
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
}
}
// reset to exp table and window start from ts
tsdbSetTableId
(
pInfo
->
dataReader
,
pInfo
->
expStatus
.
uid
);
SQueryTableDataCond
tmpCond
=
pInfo
->
cond
;
tmpCond
.
twindows
[
0
]
=
(
STimeWindow
){
.
skey
=
pInfo
->
expStatus
.
ts
,
.
ekey
=
INT64_MAX
,
};
tsdbResetReadHandle
(
pInfo
->
dataReader
,
&
tmpCond
,
0
);
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
while
(
1
)
{
SSDataBlock
*
result
=
doTableScanGroup
(
pOperator
);
if
(
result
)
{
...
...
tests/script/tsim/tmq/snapshot1.sim
浏览文件 @
94f07836
...
...
@@ -133,6 +133,8 @@ endi
$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
$sumOfRows = $data[0][3] + $data[1][3]
if $sumOfRows != $totalMsgCons then
print actual: $sumOfRows
print expect: $totalMsgCons
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录