Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac1f6021
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ac1f6021
编写于
6月 07, 2022
作者:
L
Liu Jicong
提交者:
GitHub
6月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13542 from taosdata/feature/stream
fix(stream): msg deserialize
上级
d4a214eb
34a46348
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
11 deletion
+38
-11
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+4
-3
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+2
-0
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+8
-8
source/libs/stream/src/streamData.c
source/libs/stream/src/streamData.c
+23
-0
source/libs/stream/src/streamMsg.c
source/libs/stream/src/streamMsg.c
+1
-0
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
ac1f6021
...
@@ -1849,11 +1849,12 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1849,11 +1849,12 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
}
}
ret
->
length
=
htonl
(
ret
->
length
);
ret
->
length
=
htonl
(
ret
->
length
);
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
tagArray
);
return
ret
;
return
ret
;
}
}
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
)
{
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
)
{
int32_t
*
actualLen
=
(
int32_t
*
)
data
;
int32_t
*
actualLen
=
(
int32_t
*
)
data
;
data
+=
sizeof
(
int32_t
);
data
+=
sizeof
(
int32_t
);
...
@@ -1947,4 +1948,4 @@ const char* blockCompressDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t
...
@@ -1947,4 +1948,4 @@ const char* blockCompressDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t
ASSERT
(
pStart
-
pData
==
dataLen
);
ASSERT
(
pStart
-
pData
==
dataLen
);
return
pStart
;
return
pStart
;
}
}
\ No newline at end of file
source/libs/stream/inc/streamInc.h
浏览文件 @
ac1f6021
...
@@ -27,6 +27,8 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb);
...
@@ -27,6 +27,8 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb);
int32_t
streamSink1
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
);
int32_t
streamSink1
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
);
int32_t
streamDispatch
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
,
SStreamDataBlock
*
data
);
int32_t
streamDispatch
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
,
SStreamDataBlock
*
data
);
int32_t
streamDispatchReqToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/stream/src/stream.c
浏览文件 @
ac1f6021
...
@@ -35,18 +35,19 @@ int32_t streamTriggerByWrite(SStreamTask* pTask, int32_t vgId, SMsgCb* pMsgCb) {
...
@@ -35,18 +35,19 @@ int32_t streamTriggerByWrite(SStreamTask* pTask, int32_t vgId, SMsgCb* pMsgCb) {
return
0
;
return
0
;
}
}
#if 1
int32_t
streamTaskEnqueue
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
int32_t
streamTaskEnqueue
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
SStreamDataBlock
*
p
Block
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
);
SStreamDataBlock
*
p
Data
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
);
int8_t
status
;
int8_t
status
;
// enqueue
// enqueue
if
(
pBlock
!=
NULL
)
{
if
(
pData
!=
NULL
)
{
pBlock
->
type
=
STREAM_DATA_TYPE_SSDATA_BLOCK
;
pData
->
type
=
STREAM_DATA_TYPE_SSDATA_BLOCK
;
pBlock
->
sourceVg
=
pReq
->
sourceVg
;
pData
->
sourceVg
=
pReq
->
sourceVg
;
pBlock
->
blocks
=
pReq
->
data
;
// decode
/*pData->blocks = pReq->data;*/
/*pBlock->sourceVer = pReq->sourceVer;*/
/*pBlock->sourceVer = pReq->sourceVer;*/
if
(
streamTaskInput
(
pTask
,
(
SStreamQueueItem
*
)
pBlock
)
==
0
)
{
streamDispatchReqToData
(
pReq
,
pData
);
if
(
streamTaskInput
(
pTask
,
(
SStreamQueueItem
*
)
pData
)
==
0
)
{
status
=
TASK_INPUT_STATUS__NORMAL
;
status
=
TASK_INPUT_STATUS__NORMAL
;
}
else
{
}
else
{
status
=
TASK_INPUT_STATUS__FAILED
;
status
=
TASK_INPUT_STATUS__FAILED
;
...
@@ -68,7 +69,6 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg*
...
@@ -68,7 +69,6 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg*
tmsgSendRsp
(
pRsp
);
tmsgSendRsp
(
pRsp
);
return
status
==
TASK_INPUT_STATUS__NORMAL
?
0
:
-
1
;
return
status
==
TASK_INPUT_STATUS__NORMAL
?
0
:
-
1
;
}
}
#endif
int32_t
streamProcessDispatchReq
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
int32_t
streamProcessDispatchReq
(
SStreamTask
*
pTask
,
SMsgCb
*
pMsgCb
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
// 1. handle input
// 1. handle input
...
...
source/libs/stream/src/streamData.c
浏览文件 @
ac1f6021
...
@@ -36,6 +36,29 @@ void* streamDataBlockDecode(const void* buf, SStreamDataBlock* pInput) {
...
@@ -36,6 +36,29 @@ void* streamDataBlockDecode(const void* buf, SStreamDataBlock* pInput) {
}
}
#endif
#endif
int32_t
streamDispatchReqToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
)
{
int32_t
blockNum
=
pReq
->
blockNum
;
SArray
*
pArray
=
taosArrayInit
(
blockNum
,
sizeof
(
SSDataBlock
));
if
(
pArray
==
NULL
)
{
return
-
1
;
}
taosArraySetSize
(
pArray
,
blockNum
);
ASSERT
(
pReq
->
blockNum
==
taosArrayGetSize
(
pReq
->
data
));
ASSERT
(
pReq
->
blockNum
==
taosArrayGetSize
(
pReq
->
dataLen
));
for
(
int32_t
i
=
0
;
i
<
blockNum
;
i
++
)
{
int32_t
len
=
*
(
int32_t
*
)
taosArrayGet
(
pReq
->
dataLen
,
i
);
SRetrieveTableRsp
*
pRetrieve
=
taosArrayGetP
(
pReq
->
data
,
i
);
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pArray
,
i
);
blockCompressDecode
(
pDataBlock
,
htonl
(
pRetrieve
->
numOfCols
),
htonl
(
pRetrieve
->
numOfRows
),
pRetrieve
->
data
);
// TODO: refactor
pDataBlock
->
info
.
childId
=
pReq
->
sourceChildId
;
}
pData
->
blocks
=
pArray
;
return
0
;
}
SStreamDataSubmit
*
streamDataSubmitNew
(
SSubmitReq
*
pReq
)
{
SStreamDataSubmit
*
streamDataSubmitNew
(
SSubmitReq
*
pReq
)
{
SStreamDataSubmit
*
pDataSubmit
=
(
SStreamDataSubmit
*
)
taosAllocateQitem
(
sizeof
(
SStreamDataSubmit
),
DEF_QITEM
);
SStreamDataSubmit
*
pDataSubmit
=
(
SStreamDataSubmit
*
)
taosAllocateQitem
(
sizeof
(
SStreamDataSubmit
),
DEF_QITEM
);
if
(
pDataSubmit
==
NULL
)
return
NULL
;
if
(
pDataSubmit
==
NULL
)
return
NULL
;
...
...
source/libs/stream/src/streamMsg.c
浏览文件 @
ac1f6021
...
@@ -71,6 +71,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis
...
@@ -71,6 +71,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis
pRetrieve
->
compressed
=
0
;
pRetrieve
->
compressed
=
0
;
pRetrieve
->
completed
=
1
;
pRetrieve
->
completed
=
1
;
pRetrieve
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
pRetrieve
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
pRetrieve
->
numOfCols
=
htonl
(
pBlock
->
info
.
numOfCols
);
int32_t
actualLen
=
0
;
int32_t
actualLen
=
0
;
blockCompressEncode
(
pBlock
,
pRetrieve
->
data
,
&
actualLen
,
pBlock
->
info
.
numOfCols
,
false
);
blockCompressEncode
(
pBlock
,
pRetrieve
->
data
,
&
actualLen
,
pBlock
->
info
.
numOfCols
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录