Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bc469f7f
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看板
提交
bc469f7f
编写于
11月 08, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): delete tb should be checked in write thread
上级
91e2a6b9
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
129 addition
and
167 deletion
+129
-167
include/common/tmsg.h
include/common/tmsg.h
+2
-1
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+2
-0
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+2
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-2
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+14
-2
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+7
-7
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+16
-4
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+6
-7
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+17
-18
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+3
-3
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+23
-25
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+0
-2
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+0
-37
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+28
-52
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+2
-1
source/util/src/tqueue.c
source/util/src/tqueue.c
+5
-4
未找到文件。
include/common/tmsg.h
浏览文件 @
bc469f7f
...
@@ -3133,7 +3133,8 @@ int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes);
...
@@ -3133,7 +3133,8 @@ int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes);
int32_t
tDecodeDeleteRes
(
SDecoder
*
pCoder
,
SDeleteRes
*
pRes
);
int32_t
tDecodeDeleteRes
(
SDecoder
*
pCoder
,
SDeleteRes
*
pRes
);
typedef
struct
{
typedef
struct
{
int64_t
uid
;
// int64_t uid;
char
tbname
[
TSDB_TABLE_NAME_LEN
];
int64_t
ts
;
int64_t
ts
;
}
SSingleDeleteReq
;
}
SSingleDeleteReq
;
...
...
include/libs/stream/tstream.h
浏览文件 @
bc469f7f
...
@@ -317,6 +317,8 @@ typedef struct SStreamTask {
...
@@ -317,6 +317,8 @@ typedef struct SStreamTask {
int8_t
inputStatus
;
int8_t
inputStatus
;
int8_t
outputStatus
;
int8_t
outputStatus
;
// STaosQueue* inputQueue1;
// STaosQall* inputQall;
SStreamQueue
*
inputQueue
;
SStreamQueue
*
inputQueue
;
SStreamQueue
*
outputQueue
;
SStreamQueue
*
outputQueue
;
...
...
source/client/src/clientTmq.c
浏览文件 @
bc469f7f
...
@@ -1649,7 +1649,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
...
@@ -1649,7 +1649,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
return
pRsp
;
return
pRsp
;
}
else
{
}
else
{
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d
\n
"
,
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d"
,
pollRspWrapper
->
dataRsp
.
head
.
epoch
,
consumerEpoch
);
pollRspWrapper
->
dataRsp
.
head
.
epoch
,
consumerEpoch
);
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
}
}
...
@@ -1667,7 +1667,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
...
@@ -1667,7 +1667,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
return
pRsp
;
return
pRsp
;
}
else
{
}
else
{
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d
\n
"
,
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d"
,
pollRspWrapper
->
metaRsp
.
head
.
epoch
,
consumerEpoch
);
pollRspWrapper
->
metaRsp
.
head
.
epoch
,
consumerEpoch
);
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
bc469f7f
...
@@ -6129,13 +6129,13 @@ void tDeleteSTaosxRsp(STaosxRsp *pRsp) {
...
@@ -6129,13 +6129,13 @@ void tDeleteSTaosxRsp(STaosxRsp *pRsp) {
}
}
int32_t
tEncodeSSingleDeleteReq
(
SEncoder
*
pEncoder
,
const
SSingleDeleteReq
*
pReq
)
{
int32_t
tEncodeSSingleDeleteReq
(
SEncoder
*
pEncoder
,
const
SSingleDeleteReq
*
pReq
)
{
if
(
tEncode
I64
(
pEncoder
,
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tEncode
CStr
(
pEncoder
,
pReq
->
tbname
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
ts
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
ts
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
int32_t
tDecodeSSingleDeleteReq
(
SDecoder
*
pDecoder
,
SSingleDeleteReq
*
pReq
)
{
int32_t
tDecodeSSingleDeleteReq
(
SDecoder
*
pDecoder
,
SSingleDeleteReq
*
pReq
)
{
if
(
tDecode
I64
(
pDecoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tDecode
CStrTo
(
pDecoder
,
pReq
->
tbname
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
ts
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
ts
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
bc469f7f
...
@@ -25,6 +25,8 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
...
@@ -25,6 +25,8 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
SColumnInfoData
*
pGidCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pGidCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
tqDebug
(
"stream delete msg: row %d"
,
totRow
);
for
(
int32_t
row
=
0
;
row
<
totRow
;
row
++
)
{
for
(
int32_t
row
=
0
;
row
<
totRow
;
row
++
)
{
int64_t
ts
=
*
(
int64_t
*
)
colDataGetData
(
pTsCol
,
row
);
int64_t
ts
=
*
(
int64_t
*
)
colDataGetData
(
pTsCol
,
row
);
int64_t
groupId
=
*
(
int64_t
*
)
colDataGetData
(
pGidCol
,
row
);
int64_t
groupId
=
*
(
int64_t
*
)
colDataGetData
(
pGidCol
,
row
);
...
@@ -36,11 +38,14 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
...
@@ -36,11 +38,14 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
}
else
{
}
else
{
name
=
buildCtbNameByGroupId
(
stbFullName
,
groupId
);
name
=
buildCtbNameByGroupId
(
stbFullName
,
groupId
);
}
}
tqDebug
(
"stream delete msg: groupId :%"
PRId64
", name: %s"
,
groupId
,
name
);
tqDebug
(
"stream delete msg: vgId:%d, groupId :%"
PRId64
", name: %s, ts:%"
PRId64
,
pVnode
->
config
.
vgId
,
groupId
,
name
,
ts
);
#if 0
SMetaReader mr = {0};
SMetaReader mr = {0};
metaReaderInit(&mr, pVnode->pMeta, 0);
metaReaderInit(&mr, pVnode->pMeta, 0);
if (metaGetTableEntryByName(&mr, name) < 0) {
if (metaGetTableEntryByName(&mr, name) < 0) {
metaReaderClear(&mr);
metaReaderClear(&mr);
tqDebug("stream delete msg, skip vgId:%d since no table: %s", pVnode->config.vgId, name);
taosMemoryFree(name);
taosMemoryFree(name);
continue;
continue;
}
}
...
@@ -48,10 +53,13 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
...
@@ -48,10 +53,13 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
int64_t uid = mr.me.uid;
int64_t uid = mr.me.uid;
metaReaderClear(&mr);
metaReaderClear(&mr);
taosMemoryFree(name);
taosMemoryFree(name);
#endif
SSingleDeleteReq
req
=
{
SSingleDeleteReq
req
=
{
.
ts
=
ts
,
.
ts
=
ts
,
.
uid
=
uid
,
};
};
strncpy
(
req
.
tbname
,
name
,
TSDB_TABLE_NAME_LEN
);
taosMemoryFree
(
name
);
/*tqDebug("stream delete msg, active: vgId:%d, ts:%" PRId64 " name:%s", pVnode->config.vgId, ts, name);*/
taosArrayPush
(
deleteReq
->
deleteReqs
,
&
req
);
taosArrayPush
(
deleteReq
->
deleteReqs
,
&
req
);
}
}
return
0
;
return
0
;
...
@@ -309,6 +317,10 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
...
@@ -309,6 +317,10 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
deleteReq
.
suid
=
suid
;
deleteReq
.
suid
=
suid
;
tqBuildDeleteReq
(
pVnode
,
stbFullName
,
pDataBlock
,
&
deleteReq
);
tqBuildDeleteReq
(
pVnode
,
stbFullName
,
pDataBlock
,
&
deleteReq
);
if
(
taosArrayGetSize
(
deleteReq
.
deleteReqs
)
==
0
)
{
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
continue
;
}
int32_t
len
;
int32_t
len
;
int32_t
code
;
int32_t
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
bc469f7f
...
@@ -117,12 +117,12 @@ int32_t tsdbInsertTableData(STsdb *pTsdb, int64_t version, SSubmitMsgIter *pMsgI
...
@@ -117,12 +117,12 @@ int32_t tsdbInsertTableData(STsdb *pTsdb, int64_t version, SSubmitMsgIter *pMsgI
metaGetInfo
(
pTsdb
->
pVnode
->
pMeta
,
info
.
suid
,
&
info
);
metaGetInfo
(
pTsdb
->
pVnode
->
pMeta
,
info
.
suid
,
&
info
);
}
}
if
(
pMsgIter
->
sversion
!=
info
.
skmVer
)
{
if
(
pMsgIter
->
sversion
!=
info
.
skmVer
)
{
tsdbError
(
"vgId:%d, req sver:%d, skmVer:%d suid:%"
PRId64
" uid:%"
PRId64
,
tsdbError
(
"vgId:%d, req sver:%d, skmVer:%d suid:%"
PRId64
" uid:%"
PRId64
,
TD_VID
(
pTsdb
->
pVnode
),
TD_VID
(
pTsdb
->
pVnode
),
pMsgIter
->
sversion
,
info
.
skmVer
,
suid
,
uid
);
pMsgIter
->
sversion
,
info
.
skmVer
,
suid
,
uid
);
code
=
TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER
;
code
=
TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER
;
goto
_err
;
goto
_err
;
}
}
pRsp
->
sver
=
info
.
skmVer
;
pRsp
->
sver
=
info
.
skmVer
;
// create/get STbData to op
// create/get STbData to op
...
@@ -198,14 +198,14 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
...
@@ -198,14 +198,14 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
}
}
tsdbInfo
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
tsdbInfo
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
" since %s"
,
"
at version %"
PRId64
"
since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
version
,
tstrerror
(
code
));
return
code
;
return
code
;
_err:
_err:
tsdbError
(
"vgId:%d, failed to delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
tsdbError
(
"vgId:%d, failed to delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
" since %s"
,
"
at version %"
PRId64
"
since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
version
,
tstrerror
(
code
));
return
code
;
return
code
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
bc469f7f
...
@@ -945,7 +945,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
...
@@ -945,7 +945,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
sprintf
(
submitBlkRsp
.
tblFName
,
"%s.%s"
,
pVnode
->
config
.
dbname
,
createTbReq
.
name
);
sprintf
(
submitBlkRsp
.
tblFName
,
"%s.%s"
,
pVnode
->
config
.
dbname
,
createTbReq
.
name
);
tbCreated
=
true
;
tbCreated
=
true
;
}
}
msgIter
.
uid
=
createTbReq
.
uid
;
msgIter
.
uid
=
createTbReq
.
uid
;
if
(
createTbReq
.
type
==
TSDB_CHILD_TABLE
)
{
if
(
createTbReq
.
type
==
TSDB_CHILD_TABLE
)
{
msgIter
.
suid
=
createTbReq
.
ctb
.
suid
;
msgIter
.
suid
=
createTbReq
.
ctb
.
suid
;
...
@@ -958,7 +958,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
...
@@ -958,7 +958,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
#endif
#endif
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
taosArrayDestroy
(
createTbReq
.
ctb
.
tagName
);
taosArrayDestroy
(
createTbReq
.
ctb
.
tagName
);
}
}
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
version
,
&
msgIter
,
pBlock
,
&
submitBlkRsp
)
<
0
)
{
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
version
,
&
msgIter
,
pBlock
,
&
submitBlkRsp
)
<
0
)
{
submitBlkRsp
.
code
=
terrno
;
submitBlkRsp
.
code
=
terrno
;
...
@@ -1169,16 +1169,28 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void
...
@@ -1169,16 +1169,28 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void
tDecoderInit
(
&
decoder
,
pReq
,
len
);
tDecoderInit
(
&
decoder
,
pReq
,
len
);
tDecodeSBatchDeleteReq
(
&
decoder
,
&
deleteReq
);
tDecodeSBatchDeleteReq
(
&
decoder
,
&
deleteReq
);
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pVnode
->
pMeta
,
0
);
int32_t
sz
=
taosArrayGetSize
(
deleteReq
.
deleteReqs
);
int32_t
sz
=
taosArrayGetSize
(
deleteReq
.
deleteReqs
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSingleDeleteReq
*
pOneReq
=
taosArrayGet
(
deleteReq
.
deleteReqs
,
i
);
SSingleDeleteReq
*
pOneReq
=
taosArrayGet
(
deleteReq
.
deleteReqs
,
i
);
int32_t
code
=
tsdbDeleteTableData
(
pVnode
->
pTsdb
,
version
,
deleteReq
.
suid
,
pOneReq
->
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
char
*
name
=
pOneReq
->
tbname
;
if
(
metaGetTableEntryByName
(
&
mr
,
name
)
<
0
)
{
vDebug
(
"stream delete msg, skip vgId:%d since no table: %s"
,
pVnode
->
config
.
vgId
,
name
);
continue
;
}
int64_t
uid
=
mr
.
me
.
uid
;
int32_t
code
=
tsdbDeleteTableData
(
pVnode
->
pTsdb
,
version
,
deleteReq
.
suid
,
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
if
(
code
<
0
)
{
if
(
code
<
0
)
{
terrno
=
code
;
terrno
=
code
;
vError
(
"vgId:%d, delete error since %s, suid:%"
PRId64
", uid:%"
PRId64
", start ts:%"
PRId64
", end ts:%"
PRId64
,
vError
(
"vgId:%d, delete error since %s, suid:%"
PRId64
", uid:%"
PRId64
", start ts:%"
PRId64
", end ts:%"
PRId64
,
TD_VID
(
pVnode
),
terrstr
(),
deleteReq
.
suid
,
pOneReq
->
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
TD_VID
(
pVnode
),
terrstr
(),
deleteReq
.
suid
,
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
}
}
}
}
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
return
0
;
return
0
;
}
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
bc469f7f
...
@@ -87,11 +87,11 @@ typedef struct SLimit {
...
@@ -87,11 +87,11 @@ typedef struct SLimit {
typedef
struct
STableScanAnalyzeInfo
SFileBlockLoadRecorder
;
typedef
struct
STableScanAnalyzeInfo
SFileBlockLoadRecorder
;
typedef
struct
STaskCostInfo
{
typedef
struct
STaskCostInfo
{
int64_t
created
;
int64_t
created
;
int64_t
start
;
int64_t
start
;
uint64_t
elapsedTime
;
uint64_t
elapsedTime
;
double
extractListTime
;
double
extractListTime
;
double
groupIdMapTime
;
double
groupIdMapTime
;
SFileBlockLoadRecorder
*
pRecoder
;
SFileBlockLoadRecorder
*
pRecoder
;
}
STaskCostInfo
;
}
STaskCostInfo
;
...
@@ -184,8 +184,7 @@ enum {
...
@@ -184,8 +184,7 @@ enum {
typedef
struct
SOperatorFpSet
{
typedef
struct
SOperatorFpSet
{
__optr_open_fn_t
_openFn
;
// DO NOT invoke this function directly
__optr_open_fn_t
_openFn
;
// DO NOT invoke this function directly
__optr_fn_t
getNextFn
;
__optr_fn_t
getNextFn
;
__optr_fn_t
getStreamResFn
;
// execute the aggregate in the stream model, todo remove it
__optr_fn_t
cleanupFn
;
// call this function to release the allocated resources ASAP
__optr_fn_t
cleanupFn
;
// call this function to release the allocated resources ASAP
__optr_close_fn_t
closeFn
;
__optr_close_fn_t
closeFn
;
__optr_encode_fn_t
encodeResultRow
;
__optr_encode_fn_t
encodeResultRow
;
__optr_decode_fn_t
decodeResultRow
;
__optr_decode_fn_t
decodeResultRow
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
bc469f7f
...
@@ -114,7 +114,6 @@ SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn,
...
@@ -114,7 +114,6 @@ SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn,
SOperatorFpSet
fpSet
=
{
SOperatorFpSet
fpSet
=
{
.
_openFn
=
openFn
,
.
_openFn
=
openFn
,
.
getNextFn
=
nextFn
,
.
getNextFn
=
nextFn
,
.
getStreamResFn
=
streamFn
,
.
cleanupFn
=
cleanup
,
.
cleanupFn
=
cleanup
,
.
closeFn
=
closeFn
,
.
closeFn
=
closeFn
,
.
getExplainFn
=
explain
,
.
getExplainFn
=
explain
,
...
@@ -819,7 +818,7 @@ bool isTaskKilled(SExecTaskInfo* pTaskInfo) {
...
@@ -819,7 +818,7 @@ bool isTaskKilled(SExecTaskInfo* pTaskInfo) {
// abort current query execution.
// abort current query execution.
if
(
pTaskInfo
->
owner
!=
0
&&
if
(
pTaskInfo
->
owner
!=
0
&&
((
taosGetTimestampSec
()
-
pTaskInfo
->
cost
.
start
/
1000
)
>
10
*
getMaximumIdleDurationSec
())
((
taosGetTimestampSec
()
-
pTaskInfo
->
cost
.
start
/
1000
)
>
10
*
getMaximumIdleDurationSec
())
/*(!needBuildResAfterQueryComplete(pTaskInfo))*/
)
{
/*(!needBuildResAfterQueryComplete(pTaskInfo))*/
)
{
assert
(
pTaskInfo
->
cost
.
start
!=
0
);
assert
(
pTaskInfo
->
cost
.
start
!=
0
);
// qDebug("QInfo:%" PRIu64 " retrieve not arrive beyond %d ms, abort current query execution, start:%" PRId64
// qDebug("QInfo:%" PRIu64 " retrieve not arrive beyond %d ms, abort current query execution, start:%" PRId64
// ", current:%d", pQInfo->qId, 1, pQInfo->startExecTs, taosGetTimestampSec());
// ", current:%d", pQInfo->qId, 1, pQInfo->startExecTs, taosGetTimestampSec());
...
@@ -1899,7 +1898,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
...
@@ -1899,7 +1898,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
// printf("%d completed, try next\n", i);
// printf("%d completed, try next\n", i);
qDebug
(
"%s vgId:%d, taskId:0x%"
PRIx64
" execId:%d index:%d completed, rowsOfSource:%"
PRIu64
qDebug
(
"%s vgId:%d, taskId:0x%"
PRIx64
" execId:%d index:%d completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", completed:%d try next %d/%"
PRIzu
,
", totalRows:%"
PRIu64
", completed:%d try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
i
,
pDataInfo
->
totalRows
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
i
,
pDataInfo
->
totalRows
,
pExchangeInfo
->
loadInfo
.
totalRows
,
completed
,
i
+
1
,
totalSources
);
pExchangeInfo
->
loadInfo
.
totalRows
,
completed
,
i
+
1
,
totalSources
);
taosMemoryFreeClear
(
pDataInfo
->
pRsp
);
taosMemoryFreeClear
(
pDataInfo
->
pRsp
);
...
@@ -1984,7 +1983,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
...
@@ -1984,7 +1983,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
}
}
}
}
_error:
_error:
pTaskInfo
->
code
=
code
;
pTaskInfo
->
code
=
code
;
}
}
...
@@ -2046,7 +2045,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
...
@@ -2046,7 +2045,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
if
(
pRsp
->
numOfRows
==
0
)
{
if
(
pRsp
->
numOfRows
==
0
)
{
qDebug
(
"%s vgId:%d, taskID:0x%"
PRIx64
" execId:%d %d of total completed, rowsOfSource:%"
PRIu64
qDebug
(
"%s vgId:%d, taskID:0x%"
PRIx64
" execId:%d %d of total completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
" try next"
,
", totalRows:%"
PRIu64
" try next"
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pExchangeInfo
->
current
+
1
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pExchangeInfo
->
current
+
1
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
);
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
);
...
@@ -2063,7 +2062,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
...
@@ -2063,7 +2062,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
if
(
pRsp
->
completed
==
1
)
{
if
(
pRsp
->
completed
==
1
)
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, rowsOfSource:%"
PRIu64
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
,
pExchangeInfo
->
current
+
1
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
,
pExchangeInfo
->
current
+
1
,
totalSources
);
totalSources
);
...
@@ -2072,7 +2071,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
...
@@ -2072,7 +2071,7 @@ static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
pExchangeInfo
->
current
+=
1
;
pExchangeInfo
->
current
+=
1
;
}
else
{
}
else
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, totalRows:%"
PRIu64
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
,
", totalBytes:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
);
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
);
}
}
...
@@ -2260,7 +2259,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
...
@@ -2260,7 +2259,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
);
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
);
return
pOperator
;
return
pOperator
;
_error:
_error:
if
(
pInfo
!=
NULL
)
{
if
(
pInfo
!=
NULL
)
{
doDestroyExchangeOperatorInfo
(
pInfo
);
doDestroyExchangeOperatorInfo
(
pInfo
);
}
}
...
@@ -3173,8 +3172,8 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3173,8 +3172,8 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SInterval
*
pInterval
=
SInterval
*
pInterval
=
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
?
&
((
SMergeAlignedIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
intervalAggOperatorInfo
->
interval
?
&
((
SMergeAlignedIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
intervalAggOperatorInfo
->
interval
:
&
((
SIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
interval
;
:
&
((
SIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
interval
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
type
=
convertFillType
(
pPhyFillNode
->
mode
);
int32_t
type
=
convertFillType
(
pPhyFillNode
->
mode
);
...
@@ -3353,9 +3352,9 @@ bool groupbyTbname(SNodeList* pGroupList) {
...
@@ -3353,9 +3352,9 @@ bool groupbyTbname(SNodeList* pGroupList) {
SOperatorInfo
*
createOperatorTree
(
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
SReadHandle
*
pHandle
,
SNode
*
pTagCond
,
SOperatorInfo
*
createOperatorTree
(
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
SReadHandle
*
pHandle
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
const
char
*
pUser
)
{
SNode
*
pTagIndexCond
,
const
char
*
pUser
)
{
int32_t
type
=
nodeType
(
pPhyNode
);
int32_t
type
=
nodeType
(
pPhyNode
);
STableListInfo
*
pTableListInfo
=
pTaskInfo
->
pTableInfoList
;
STableListInfo
*
pTableListInfo
=
pTaskInfo
->
pTableInfoList
;
const
char
*
idstr
=
GET_TASKID
(
pTaskInfo
);
const
char
*
idstr
=
GET_TASKID
(
pTaskInfo
);
if
(
pPhyNode
->
pChildren
==
NULL
||
LIST_LENGTH
(
pPhyNode
->
pChildren
)
==
0
)
{
if
(
pPhyNode
->
pChildren
==
NULL
||
LIST_LENGTH
(
pPhyNode
->
pChildren
)
==
0
)
{
SOperatorInfo
*
pOperator
=
NULL
;
SOperatorInfo
*
pOperator
=
NULL
;
...
@@ -3428,7 +3427,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -3428,7 +3427,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
STableKeyInfo
*
pKeyInfo
=
tableListGetInfo
(
pTableListInfo
,
i
);
STableKeyInfo
*
pKeyInfo
=
tableListGetInfo
(
pTableListInfo
,
i
);
qDebug
(
"add table uid:%"
PRIu64
", gid:%"
PRIu64
,
pKeyInfo
->
uid
,
pKeyInfo
->
groupId
);
qDebug
(
"add table uid:%"
PRIu64
", gid:%"
PRIu64
,
pKeyInfo
->
uid
,
pKeyInfo
->
groupId
);
}
}
#endif
#endif
}
}
...
@@ -3461,7 +3460,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -3461,7 +3460,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
NULL
;
return
NULL
;
}
}
for
(
int32_t
i
=
0
;
i
<
tableListGetSize
(
pTableListInfo
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tableListGetSize
(
pTableListInfo
);
++
i
)
{
STableKeyInfo
*
p
=
taosArrayGet
(
pList
,
i
);
STableKeyInfo
*
p
=
taosArrayGet
(
pList
,
i
);
tableListAddTableInfo
(
pTableListInfo
,
p
->
uid
,
0
);
tableListAddTableInfo
(
pTableListInfo
,
p
->
uid
,
0
);
}
}
...
@@ -3501,7 +3500,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -3501,7 +3500,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
pOperator
;
return
pOperator
;
}
}
size_t
size
=
LIST_LENGTH
(
pPhyNode
->
pChildren
);
size_t
size
=
LIST_LENGTH
(
pPhyNode
->
pChildren
);
SOperatorInfo
**
ops
=
taosMemoryCalloc
(
size
,
POINTER_BYTES
);
SOperatorInfo
**
ops
=
taosMemoryCalloc
(
size
,
POINTER_BYTES
);
if
(
ops
==
NULL
)
{
if
(
ops
==
NULL
)
{
return
NULL
;
return
NULL
;
...
@@ -3712,7 +3711,7 @@ int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t* length, int32
...
@@ -3712,7 +3711,7 @@ int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t* length, int32
*
length
=
*
(
int32_t
*
)(
*
result
);
*
length
=
*
(
int32_t
*
)(
*
result
);
}
}
_downstream:
_downstream:
for
(
int32_t
i
=
0
;
i
<
ops
->
numOfDownstream
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
ops
->
numOfDownstream
;
++
i
)
{
code
=
encodeOperator
(
ops
->
pDownstream
[
i
],
result
,
length
,
nOptrWithVal
);
code
=
encodeOperator
(
ops
->
pDownstream
[
i
],
result
,
length
,
nOptrWithVal
);
if
(
code
!=
TDB_CODE_SUCCESS
)
{
if
(
code
!=
TDB_CODE_SUCCESS
)
{
...
@@ -3971,8 +3970,8 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
...
@@ -3971,8 +3970,8 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
int32_t
size
=
0
;
int32_t
size
=
0
;
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
SWinKey
key
=
{
SWinKey
key
=
{
.
ts
=
*
(
TSKEY
*
)
pPos
->
key
,
.
ts
=
*
(
TSKEY
*
)
pPos
->
key
,
.
groupId
=
pPos
->
groupId
,
.
groupId
=
pPos
->
groupId
,
};
};
int32_t
code
=
streamStateGet
(
pState
,
&
key
,
&
pVal
,
&
size
);
int32_t
code
=
streamStateGet
(
pState
,
&
key
,
&
pVal
,
&
size
);
ASSERT
(
code
==
0
);
ASSERT
(
code
==
0
);
...
...
source/libs/executor/src/tfill.c
浏览文件 @
bc469f7f
...
@@ -1691,14 +1691,14 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
...
@@ -1691,14 +1691,14 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
pInfo
->
srcRowIndex
=
0
;
pInfo
->
srcRowIndex
=
0
;
pOperator
->
name
=
"FillOperator"
;
pOperator
->
name
=
"
Stream
FillOperator"
;
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
NULL
,
destroyStreamFillOperatorInfo
,
pOperator
->
fpSet
=
NULL
);
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
bc469f7f
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU Affero General Public License
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "filter.h"
#include "executorimpl.h"
#include "executorimpl.h"
#include "filter.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "functionMgt.h"
#include "tcommon.h"
#include "tcommon.h"
...
@@ -986,7 +986,7 @@ void doCloseWindow(SResultRowInfo* pResultRowInfo, const SIntervalAggOperatorInf
...
@@ -986,7 +986,7 @@ void doCloseWindow(SResultRowInfo* pResultRowInfo, const SIntervalAggOperatorInf
// current result is done in computing final results.
// current result is done in computing final results.
if
(
pInfo
->
timeWindowInterpo
&&
isResultRowInterpolated
(
pResult
,
RESULT_ROW_END_INTERP
))
{
if
(
pInfo
->
timeWindowInterpo
&&
isResultRowInterpolated
(
pResult
,
RESULT_ROW_END_INTERP
))
{
closeResultRow
(
pResult
);
closeResultRow
(
pResult
);
SListNode
*
pNode
=
tdListPopHead
(
pResultRowInfo
->
openWindow
);
SListNode
*
pNode
=
tdListPopHead
(
pResultRowInfo
->
openWindow
);
taosMemoryFree
(
pNode
);
taosMemoryFree
(
pNode
);
}
}
}
}
...
@@ -1255,35 +1255,33 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) {
...
@@ -1255,35 +1255,33 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) {
SSDataBlock
*
pBlock
=
pInfo
->
binfo
.
pRes
;
SSDataBlock
*
pBlock
=
pInfo
->
binfo
.
pRes
;
if
(
pInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
)
{
ASSERT
(
pInfo
->
execModel
==
OPTR_EXEC_MODEL_BATCH
);
return
pOperator
->
fpSet
.
getStreamResFn
(
pOperator
);
}
else
{
pTaskInfo
->
code
=
pOperator
->
fpSet
.
_openFn
(
pOperator
);
if
(
pTaskInfo
->
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
blockDataEnsureCapacity
(
pBlock
,
pOperator
->
resultInfo
.
capacity
);
pTaskInfo
->
code
=
pOperator
->
fpSet
.
_openFn
(
pOperator
);
while
(
1
)
{
if
(
pTaskInfo
->
code
!=
TSDB_CODE_SUCCESS
)
{
doBuildResultDatablock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
)
;
return
NULL
;
doFilter
(
pBlock
,
pOperator
->
exprSupp
.
pFilterInfo
,
NULL
);
}
bool
hasRemain
=
hasRemainResults
(
&
pInfo
->
groupResInfo
);
blockDataEnsureCapacity
(
pBlock
,
pOperator
->
resultInfo
.
capacity
);
if
(
!
hasRemain
)
{
while
(
1
)
{
doSetOperatorCompleted
(
pOperator
);
doBuildResultDatablock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
);
break
;
doFilter
(
pBlock
,
pOperator
->
exprSupp
.
pFilterInfo
,
NULL
);
}
if
(
pBlock
->
info
.
rows
>
0
)
{
bool
hasRemain
=
hasRemainResults
(
&
pInfo
->
groupResInfo
);
break
;
if
(
!
hasRemain
)
{
}
doSetOperatorCompleted
(
pOperator
);
break
;
}
}
size_t
rows
=
pBlock
->
info
.
rows
;
if
(
pBlock
->
info
.
rows
>
0
)
{
pOperator
->
resultInfo
.
totalRows
+=
rows
;
break
;
}
return
(
rows
==
0
)
?
NULL
:
pBlock
;
}
}
size_t
rows
=
pBlock
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
rows
;
return
(
rows
==
0
)
?
NULL
:
pBlock
;
}
}
static
void
setInverFunction
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
EStreamType
type
)
{
static
void
setInverFunction
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
EStreamType
type
)
{
...
...
source/libs/stream/inc/streamInc.h
浏览文件 @
bc469f7f
...
@@ -32,8 +32,6 @@ typedef struct {
...
@@ -32,8 +32,6 @@ typedef struct {
static
SStreamGlobalEnv
streamEnv
;
static
SStreamGlobalEnv
streamEnv
;
// int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum, bool dispatch);
int32_t
streamDispatch
(
SStreamTask
*
pTask
);
int32_t
streamDispatch
(
SStreamTask
*
pTask
);
int32_t
streamDispatchReqToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
streamDispatchReqToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
streamRetrieveReqToData
(
const
SStreamRetrieveReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
streamRetrieveReqToData
(
const
SStreamRetrieveReq
*
pReq
,
SStreamDataBlock
*
pData
);
...
...
source/libs/stream/src/stream.c
浏览文件 @
bc469f7f
...
@@ -240,43 +240,6 @@ int32_t streamProcessRunReq(SStreamTask* pTask) {
...
@@ -240,43 +240,6 @@ int32_t streamProcessRunReq(SStreamTask* pTask) {
return
0
;
return
0
;
}
}
#if 0
int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pRsp) {
void* buf = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamTaskRecoverRsp));
((SMsgHead*)buf)->vgId = htonl(pReq->upstreamNodeId);
SStreamTaskRecoverRsp* pCont = POINTER_SHIFT(buf, sizeof(SMsgHead));
pCont->inputStatus = pTask->inputStatus;
pCont->streamId = pTask->streamId;
pCont->reqTaskId = pTask->taskId;
pCont->rspTaskId = pReq->upstreamTaskId;
pRsp->pCont = buf;
pRsp->contLen = sizeof(SMsgHead) + sizeof(SStreamTaskRecoverRsp);
tmsgSendRsp(pRsp);
return 0;
}
int32_t streamProcessRecoverRsp(SStreamMeta* pMeta, SStreamTask* pTask, SStreamRecoverDownstreamRsp* pRsp) {
streamProcessRunReq(pTask);
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
// scan data to recover
pTask->inputStatus = TASK_INPUT_STATUS__RECOVER;
pTask->taskStatus = TASK_STATUS__RECOVER_SELF;
qStreamPrepareRecover(pTask->exec.executor, pTask->startVer, pTask->recoverSnapVer);
if (streamPipelineExec(pTask, 100, true) < 0) {
return -1;
}
} else {
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->taskStatus = TASK_STATUS__NORMAL;
}
return 0;
}
#endif
int32_t
streamProcessRetrieveReq
(
SStreamTask
*
pTask
,
SStreamRetrieveReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
int32_t
streamProcessRetrieveReq
(
SStreamTask
*
pTask
,
SStreamRetrieveReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
qDebug
(
"task %d receive retrieve req from node %d task %d"
,
pTask
->
taskId
,
pReq
->
srcNodeId
,
pReq
->
srcTaskId
);
qDebug
(
"task %d receive retrieve req from node %d task %d"
,
pTask
->
taskId
,
pReq
->
srcNodeId
,
pReq
->
srcTaskId
);
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
bc469f7f
...
@@ -138,63 +138,39 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
...
@@ -138,63 +138,39 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
}
}
#if 0
#if 0
int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum, bool dispatch) {
int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) {
ASSERT(pTask->taskLevel != TASK_LEVEL__SINK);
// fetch all queue item, merge according to batchLimit
int32_t numOfItems = taosReadAllQitems(pTask->inputQueue1, pTask->inputQall);
void* exec = pTask->exec.executor;
if (numOfItems == 0) {
qDebug("task: %d, stream task exec over, queue empty", pTask->taskId);
while (1) {
return 0;
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
}
if (pRes == NULL) {
SStreamQueueItem* pMerged = NULL;
terrno = TSDB_CODE_OUT_OF_MEMORY;
SStreamQueueItem* pItem = NULL;
return -1;
taosGetQitem(pTask->inputQall, (void**)&pItem);
}
if (pItem == NULL) {
if (pMerged != NULL) {
int32_t batchCnt = 0;
// process merged item
while (1) {
} else {
SSDataBlock* output = NULL;
return 0;
uint64_t ts = 0;
if (qExecTask(exec, &output, &ts) < 0) {
ASSERT(0);
}
if (output == NULL) break;
SSDataBlock block = {0};
assignOneDataBlock(&block, output);
block.info.childId = pTask->selfChildId;
taosArrayPush(pRes, &block);
if (++batchCnt >= batchNum) break;
}
if (taosArrayGetSize(pRes) == 0) {
taosArrayDestroy(pRes);
break;
}
}
if (dispatch) {
}
SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM);
if (qRes == NULL) {
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
return -1;
}
qRes->type = STREAM_INPUT__DATA_BLOCK;
qRes->blocks = pRes;
qRes->childId = pTask->selfChildId;
if (streamTaskOutput(pTask, qRes) < 0) {
// if drop
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
if (pItem->type == STREAM_INPUT__DESTROY) {
taosFreeQitem(qRes);
// set status drop
return -1;
return -1;
}
}
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
if (pTask->taskLevel == TASK_LEVEL__SINK) {
streamDispatch(pTask);
ASSERT(((SStreamQueueItem*)pItem)->type == STREAM_INPUT__DATA_BLOCK);
}
streamTaskOutput(pTask, (SStreamDataBlock*)pItem);
} else {
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
}
}
}
// exec impl
// output
// try dispatch
return 0;
return 0;
}
}
#endif
#endif
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
bc469f7f
...
@@ -482,7 +482,8 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
...
@@ -482,7 +482,8 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
pWal
->
writeHead
.
cksumHead
=
walCalcHeadCksum
(
&
pWal
->
writeHead
);
pWal
->
writeHead
.
cksumHead
=
walCalcHeadCksum
(
&
pWal
->
writeHead
);
pWal
->
writeHead
.
cksumBody
=
walCalcBodyCksum
(
body
,
bodyLen
);
pWal
->
writeHead
.
cksumBody
=
walCalcBodyCksum
(
body
,
bodyLen
);
wDebug
(
"vgId:%d, wal write log %"
PRId64
", msgType: %s"
,
pWal
->
cfg
.
vgId
,
index
,
TMSG_INFO
(
msgType
));
wDebug
(
"vgId:%d, wal write log %"
PRId64
", msgType: %s, cksum head %u cksum body %u"
,
pWal
->
cfg
.
vgId
,
index
,
TMSG_INFO
(
msgType
),
pWal
->
writeHead
.
cksumHead
,
pWal
->
writeHead
.
cksumBody
);
code
=
walWriteIndex
(
pWal
,
index
,
offset
);
code
=
walWriteIndex
(
pWal
,
index
,
offset
);
if
(
code
<
0
)
{
if
(
code
<
0
)
{
...
...
source/util/src/tqueue.c
浏览文件 @
bc469f7f
...
@@ -208,7 +208,7 @@ STaosQall *taosAllocateQall() {
...
@@ -208,7 +208,7 @@ STaosQall *taosAllocateQall() {
void
taosFreeQall
(
STaosQall
*
qall
)
{
taosMemoryFree
(
qall
);
}
void
taosFreeQall
(
STaosQall
*
qall
)
{
taosMemoryFree
(
qall
);
}
int32_t
taosReadAllQitems
(
STaosQueue
*
queue
,
STaosQall
*
qall
)
{
int32_t
taosReadAllQitems
(
STaosQueue
*
queue
,
STaosQall
*
qall
)
{
int32_t
code
=
0
;
int32_t
numOfItems
=
0
;
bool
empty
;
bool
empty
;
taosThreadMutexLock
(
&
queue
->
mutex
);
taosThreadMutexLock
(
&
queue
->
mutex
);
...
@@ -219,13 +219,14 @@ int32_t taosReadAllQitems(STaosQueue *queue, STaosQall *qall) {
...
@@ -219,13 +219,14 @@ int32_t taosReadAllQitems(STaosQueue *queue, STaosQall *qall) {
qall
->
current
=
queue
->
head
;
qall
->
current
=
queue
->
head
;
qall
->
start
=
queue
->
head
;
qall
->
start
=
queue
->
head
;
qall
->
numOfItems
=
queue
->
numOfItems
;
qall
->
numOfItems
=
queue
->
numOfItems
;
code
=
qall
->
numOfItems
;
numOfItems
=
qall
->
numOfItems
;
queue
->
head
=
NULL
;
queue
->
head
=
NULL
;
queue
->
tail
=
NULL
;
queue
->
tail
=
NULL
;
queue
->
numOfItems
=
0
;
queue
->
numOfItems
=
0
;
queue
->
memOfItems
=
0
;
queue
->
memOfItems
=
0
;
uTrace
(
"read %d items from queue:%p, items:%d mem:%"
PRId64
,
code
,
queue
,
queue
->
numOfItems
,
queue
->
memOfItems
);
uTrace
(
"read %d items from queue:%p, items:%d mem:%"
PRId64
,
numOfItems
,
queue
,
queue
->
numOfItems
,
queue
->
memOfItems
);
if
(
queue
->
qset
)
atomic_sub_fetch_32
(
&
queue
->
qset
->
numOfItems
,
qall
->
numOfItems
);
if
(
queue
->
qset
)
atomic_sub_fetch_32
(
&
queue
->
qset
->
numOfItems
,
qall
->
numOfItems
);
}
}
...
@@ -237,7 +238,7 @@ int32_t taosReadAllQitems(STaosQueue *queue, STaosQall *qall) {
...
@@ -237,7 +238,7 @@ int32_t taosReadAllQitems(STaosQueue *queue, STaosQall *qall) {
qall
->
start
=
NULL
;
qall
->
start
=
NULL
;
qall
->
numOfItems
=
0
;
qall
->
numOfItems
=
0
;
}
}
return
code
;
return
numOfItems
;
}
}
int32_t
taosGetQitem
(
STaosQall
*
qall
,
void
**
ppItem
)
{
int32_t
taosGetQitem
(
STaosQall
*
qall
,
void
**
ppItem
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录