Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c6230453
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c6230453
编写于
1月 26, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix query error
上级
9d575222
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
39 addition
and
18 deletion
+39
-18
include/common/tmsg.h
include/common/tmsg.h
+2
-1
include/libs/wal/wal.h
include/libs/wal/wal.h
+2
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+23
-13
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+1
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+8
-1
source/libs/wal/CMakeLists.txt
source/libs/wal/CMakeLists.txt
+1
-0
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
c6230453
...
...
@@ -1630,6 +1630,7 @@ static FORCE_INLINE int32_t tEncodeSMqConsumeRsp(void** buf, const SMqConsumeRsp
// one req for one vg+topic
typedef
struct
SMqConsumeReq
{
SMsgHead
head
;
//0: commit only, current offset
//1: consume only, poll next offset
//2: commit current and consume next offset
...
...
@@ -1662,7 +1663,7 @@ typedef struct SMqCMGetSubEpRsp {
static
FORCE_INLINE
int32_t
tEncodeSMqSubVgEp
(
void
**
buf
,
const
SMqSubVgEp
*
pVgEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI
16
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeFixedI
32
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
tlen
;
}
...
...
include/libs/wal/wal.h
浏览文件 @
c6230453
...
...
@@ -19,6 +19,7 @@
#include "tarray.h"
#include "tdef.h"
#include "tlog.h"
#include "tmsg.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -159,7 +160,7 @@ int32_t walAlter(SWal *, SWalCfg *pCfg);
void
walClose
(
SWal
*
);
// write
int64_t
walWrite
(
SWal
*
,
int64_t
index
,
uint8
_t
msgType
,
const
void
*
body
,
int32_t
bodyLen
);
int64_t
walWrite
(
SWal
*
,
int64_t
index
,
tmsg
_t
msgType
,
const
void
*
body
,
int32_t
bodyLen
);
void
walFsync
(
SWal
*
,
bool
force
);
// apis for lifecycle management
...
...
source/client/src/clientImpl.c
浏览文件 @
c6230453
...
...
@@ -625,9 +625,13 @@ int32_t tmq_poll_cb_inner(void* param, const SDataBuf* pMsg, int32_t code) {
}
int32_t
tmq_ask_ep_cb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
tmq_t
*
tmq
=
(
tmq_t
*
)
param
;
if
(
code
!=
0
)
{
tsem_post
(
&
tmq
->
rspSem
);
return
0
;
}
tscDebug
(
"tmq ask ep cb called"
);
bool
set
=
false
;
tmq_t
*
tmq
=
(
tmq_t
*
)
param
;
SMqCMGetSubEpRsp
rsp
;
tDecodeSMqCMGetSubEpRsp
(
pMsg
->
pData
,
&
rsp
);
int32_t
sz
=
taosArrayGetSize
(
rsp
.
topics
);
...
...
@@ -642,6 +646,9 @@ int32_t tmq_ask_ep_cb(void* param, const SDataBuf* pMsg, int32_t code) {
for
(
int32_t
j
=
0
;
j
<
vgSz
;
j
++
)
{
SMqSubVgEp
*
pVgEp
=
taosArrayGet
(
pTopicEp
->
vgs
,
j
);
SMqClientVg
clientVg
=
{
.
pollCnt
=
0
,
.
committedOffset
=
-
1
,
.
currentOffset
=
-
1
,
.
vgId
=
pVgEp
->
vgId
,
.
epSet
=
pVgEp
->
epSet
};
...
...
@@ -657,13 +664,6 @@ int32_t tmq_ask_ep_cb(void* param, const SDataBuf* pMsg, int32_t code) {
}
tmq_message_t
*
tmq_consume_poll
(
tmq_t
*
tmq
,
int64_t
blocking_time
)
{
SRequestObj
*
pRequest
=
NULL
;
SMqConsumeReq
req
=
{
0
};
req
.
reqType
=
1
;
req
.
blockingTime
=
blocking_time
;
req
.
consumerId
=
tmq
->
consumerId
;
tmq_message_t
*
tmq_message
=
NULL
;
strcpy
(
req
.
cgroup
,
tmq
->
groupId
);
if
(
taosArrayGetSize
(
tmq
->
clientTopics
)
==
0
||
tmq
->
status
==
0
)
{
int32_t
tlen
=
sizeof
(
SMqCMGetSubEpReq
);
...
...
@@ -674,7 +674,7 @@ tmq_message_t* tmq_consume_poll(tmq_t* tmq, int64_t blocking_time) {
buf
->
consumerId
=
htobe64
(
tmq
->
consumerId
);
strcpy
(
buf
->
cgroup
,
tmq
->
groupId
);
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_MND_GET_SUB_EP
);
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_MND_GET_SUB_EP
);
if
(
pRequest
==
NULL
)
{
tscError
(
"failed to malloc subscribe ep request"
);
}
...
...
@@ -699,16 +699,26 @@ tmq_message_t* tmq_consume_poll(tmq_t* tmq, int64_t blocking_time) {
return
NULL
;
}
SMqConsumeReq
*
pReq
=
malloc
(
sizeof
(
SMqConsumeReq
));
pReq
->
reqType
=
1
;
pReq
->
blockingTime
=
blocking_time
;
pReq
->
consumerId
=
tmq
->
consumerId
;
tmq_message_t
*
tmq_message
=
NULL
;
strcpy
(
pReq
->
cgroup
,
tmq
->
groupId
);
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
tmq
->
nextTopicIdx
);
tmq
->
nextTopicIdx
=
(
tmq
->
nextTopicIdx
+
1
)
%
taosArrayGetSize
(
tmq
->
clientTopics
);
strcpy
(
req
.
topic
,
pTopic
->
topicName
);
strcpy
(
pReq
->
topic
,
pTopic
->
topicName
);
int32_t
nextVgIdx
=
pTopic
->
nextVgIdx
;
pTopic
->
nextVgIdx
=
(
nextVgIdx
+
1
)
%
taosArrayGetSize
(
pTopic
->
vgs
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
nextVgIdx
);
req
.
offset
=
pVg
->
currentOffset
;
pReq
->
offset
=
pVg
->
currentOffset
;
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqConsumeReq
));
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
&
r
eq
,
.
len
=
sizeof
(
SMqConsumeReq
)
};
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
pR
eq
,
.
len
=
sizeof
(
SMqConsumeReq
)
};
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
/*sendInfo->requestObjRefId = 0;*/
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
c6230453
...
...
@@ -148,6 +148,7 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_SHOW_TABLES_FETCH
)]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_MQ_SET_CONN
)]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_MQ_SET_CUR
)]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_CONSUME
)]
=
dndProcessVnodeFetchMsg
;
}
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
pRsp
,
SEpSet
*
pEpSet
)
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
c6230453
...
...
@@ -424,7 +424,7 @@ static FORCE_INLINE SMqSubscribeObj* tNewSubscribeObj() {
return
NULL
;
}
pSub
->
lostConsumer
=
taosArrayInit
(
0
,
sizeof
(
SMqConsumerEp
));
if
(
pSub
->
idle
Consumer
==
NULL
)
{
if
(
pSub
->
lost
Consumer
==
NULL
)
{
taosArrayDestroy
(
pSub
->
availConsumer
);
taosArrayDestroy
(
pSub
->
assigned
);
free
(
pSub
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
c6230453
...
...
@@ -679,6 +679,7 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg** ppRsp) {
int
rspLen
=
0
;
STqConsumerHandle
*
pConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
consumerId
);
ASSERT
(
pConsumer
);
int
sz
=
taosArrayGetSize
(
pConsumer
->
topics
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
...
...
@@ -775,6 +776,8 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg, SRpcMsg** ppRsp) {
}
strcpy
(
pConsumer
->
cgroup
,
req
.
cgroup
);
pConsumer
->
topics
=
taosArrayInit
(
0
,
sizeof
(
STqTopicHandle
));
pConsumer
->
consumerId
=
req
.
newConsumerId
;
pConsumer
->
epoch
=
0
;
STqTopicHandle
*
pTopic
=
calloc
(
sizeof
(
STqTopicHandle
),
1
);
if
(
pTopic
==
NULL
)
{
...
...
@@ -785,6 +788,8 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg, SRpcMsg** ppRsp) {
pTopic
->
sql
=
strdup
(
req
.
sql
);
pTopic
->
logicalPlan
=
strdup
(
req
.
logicalPlan
);
pTopic
->
physicalPlan
=
strdup
(
req
.
physicalPlan
);
pTopic
->
committedOffset
=
-
1
;
pTopic
->
currentOffset
=
-
1
;
pTopic
->
buffer
.
firstOffset
=
-
1
;
pTopic
->
buffer
.
lastOffset
=
-
1
;
...
...
@@ -797,6 +802,8 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg, SRpcMsg** ppRsp) {
pTopic
->
buffer
.
output
[
i
].
task
=
qCreateStreamExecTaskInfo
(
req
.
qmsg
,
pReadHandle
);
}
taosArrayPush
(
pConsumer
->
topics
,
pTopic
);
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
newConsumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
terrno
=
TSDB_CODE_SUCCESS
;
return
0
;
}
...
...
@@ -821,7 +828,7 @@ void tqReadHandleSetMsg(STqReadHandle* pReadHandle, SSubmitMsg* pMsg, int64_t ve
}
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
)
{
while
(
tGetSubmitMsgNext
(
&
pHandle
->
msgIter
,
&
pHandle
->
pBlock
)
>=
0
)
{
while
(
tGetSubmitMsgNext
(
&
pHandle
->
msgIter
,
&
pHandle
->
pBlock
))
{
if
(
pHandle
->
tbUid
==
pHandle
->
pBlock
->
uid
)
return
true
;
}
return
false
;
...
...
source/libs/wal/CMakeLists.txt
浏览文件 @
c6230453
...
...
@@ -11,6 +11,7 @@ target_link_libraries(
PUBLIC cjson
PUBLIC os
PUBLIC util
PUBLIC common
)
if
(
${
BUILD_TEST
}
)
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
c6230453
...
...
@@ -257,7 +257,7 @@ static int walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
return
0
;
}
int64_t
walWrite
(
SWal
*
pWal
,
int64_t
index
,
uint8
_t
msgType
,
const
void
*
body
,
int32_t
bodyLen
)
{
int64_t
walWrite
(
SWal
*
pWal
,
int64_t
index
,
tmsg
_t
msgType
,
const
void
*
body
,
int32_t
bodyLen
)
{
if
(
pWal
==
NULL
)
return
-
1
;
int
code
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录