Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3aca8851
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看板
提交
3aca8851
编写于
1月 25, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix invalid wirte
上级
7f50ad02
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
40 deletion
+38
-40
include/common/tmsg.h
include/common/tmsg.h
+20
-17
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+17
-5
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+0
-17
未找到文件。
include/common/tmsg.h
浏览文件 @
3aca8851
...
...
@@ -1596,35 +1596,38 @@ typedef struct SMqColData {
int16_t
colId
;
int16_t
type
;
int16_t
bytes
;
char
data
[];
}
SMqColData
;
}
SMqColMeta
;
typedef
struct
SMqTbData
{
int64_t
uid
;
int32_t
numOfCols
;
int32_t
numOfRows
;
SMqColData
colData
[];
char
colData
[];
}
SMqTbData
;
typedef
struct
SMqTopicBlk
{
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
int64_t
committedOffset
;
int64_t
reqOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
int32_t
bodyLen
;
int32_t
numOfTb
;
SMqTbData
tbData
[]
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
int64_t
committedOffset
;
int64_t
reqOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
int32_t
bodyLen
;
int32_t
numOfTb
;
SMqTbData
*
tbData
;
}
SMqTopicData
;
typedef
struct
SMqConsumeRsp
{
int64_t
req
Id
;
int
64_t
consumerId
;
int32_t
bodyLen
;
int32_t
numOfTopics
;
SMqTopicData
data
[]
;
int64_t
consumer
Id
;
int
32_t
numOfCols
;
SMqColMeta
*
meta
;
int32_t
numOfTopics
;
SMqTopicData
*
data
;
}
SMqConsumeRsp
;
static
FORCE_INLINE
int32_t
tEncodeSMqConsumeRsp
(
void
**
buf
,
const
SMqConsumeRsp
*
pRsp
)
{
int32_t
tlen
=
0
;
return
tlen
;
}
// one req for one vg+topic
typedef
struct
SMqConsumeReq
{
//0: commit only, current offset
...
...
source/client/src/clientImpl.c
浏览文件 @
3aca8851
...
...
@@ -328,6 +328,7 @@ struct tmq_t {
char
clientId
[
256
];
int64_t
consumerId
;
int64_t
status
;
tsem_t
rspSem
;
STscObj
*
pTscObj
;
tmq_commit_cb
*
commit_cb
;
int32_t
nextTopicIdx
;
...
...
@@ -344,6 +345,7 @@ tmq_t* taos_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t err
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
pTmq
->
commit_cb
=
conf
->
commit_cb
;
tsem_init
(
&
pTmq
->
rspSem
,
0
,
0
);
pTmq
->
consumerId
=
generateRequestId
()
&
((
uint64_t
)
-
1
>>
1
);
pTmq
->
clientTopics
=
taosArrayInit
(
0
,
sizeof
(
SMqClientTopic
));
return
pTmq
;
...
...
@@ -372,6 +374,14 @@ int32_t tmq_list_append(tmq_list_t* ptr, char* src) {
}
int32_t
tmq_null_cb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
if
(
code
==
0
)
{
//
}
//
return
0
;
}
TAOS_RES
*
tmq_subscribe
(
tmq_t
*
tmq
,
tmq_list_t
*
topic_list
)
{
SRequestObj
*
pRequest
=
NULL
;
int32_t
sz
=
topic_list
->
cnt
;
...
...
@@ -433,6 +443,7 @@ TAOS_RES* tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
buf
,
.
len
=
tlen
};
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
/*sendInfo->fp*/
SEpSet
epSet
=
getEpSet_s
(
&
tmq
->
pTscObj
->
pAppInfo
->
mgmtEp
);
int64_t
transporterId
=
0
;
...
...
@@ -641,6 +652,7 @@ int32_t tmq_ask_ep_cb(void* param, const SDataBuf* pMsg, int32_t code) {
}
if
(
set
)
tmq
->
status
=
1
;
// unlock
tsem_post
(
&
tmq
->
rspSem
);
return
0
;
}
...
...
@@ -679,7 +691,7 @@ tmq_message_t* tmq_consume_poll(tmq_t* tmq, int64_t blocking_time) {
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
tsem_wait
(
&
tmq
->
rspSem
);
}
if
(
taosArrayGetSize
(
tmq
->
clientTopics
)
==
0
)
{
...
...
@@ -695,13 +707,13 @@ tmq_message_t* tmq_consume_poll(tmq_t* tmq, int64_t blocking_time) {
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
nextVgIdx
);
req
.
offset
=
pVg
->
currentOffset
;
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
&
req
,
.
len
=
sizeof
(
SMqConsumeReq
)
};
pRequest
->
type
=
TDMT_VND_CONSUME
;
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
&
tmq_message
;
sendInfo
->
fp
=
tmq_poll_cb_inner
;
/*sendInfo->requestObjRefId = 0;*/
/*sendInfo->param = &tmq_message;*/
/*sendInfo->fp = tmq_poll_cb_inner;*/
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
...
...
source/client/test/clientTests.cpp
浏览文件 @
3aca8851
...
...
@@ -591,7 +591,7 @@ TEST(testCase, tmq_subscribe_Test) {
while
(
1
)
{
tmq_message_t
*
msg
=
tmq_consume_poll
(
tmq
,
0
);
printf
(
"get msg
\n
"
);
if
(
msg
==
NULL
)
break
;
//
if (msg == NULL) break;
}
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
3aca8851
...
...
@@ -735,23 +735,6 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg** ppRsp) {
break
;
}
if
(
pDataBlock
!=
NULL
)
{
SMqTbData
tbData
=
{
.
uid
=
pDataBlock
->
info
.
uid
,
.
numOfCols
=
pDataBlock
->
info
.
numOfCols
,
.
numOfRows
=
pDataBlock
->
info
.
rows
,
};
for
(
int
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
i
++
)
{
SColumnInfoData
*
pColData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
int32_t
sz
=
pColData
->
info
.
bytes
*
pDataBlock
->
info
.
rows
;
SMqColData
colData
=
{
.
bytes
=
pColData
->
info
.
bytes
,
.
colId
=
pColData
->
info
.
colId
,
.
type
=
pColData
->
info
.
type
,
};
memcpy
(
colData
.
data
,
pColData
->
pData
,
colData
.
bytes
*
pDataBlock
->
info
.
rows
);
memcpy
(
&
tbData
.
colData
[
i
],
&
colData
,
sz
);
}
/*pDataBlock->info.*/
taosArrayPush
(
pRes
,
pDataBlock
);
}
else
{
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录