Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4fd3064f
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看板
提交
4fd3064f
编写于
3月 28, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
c36c5253
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
119 addition
and
97 deletion
+119
-97
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+1
-14
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+13
-6
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+104
-76
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
4fd3064f
...
@@ -193,7 +193,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode);
...
@@ -193,7 +193,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode);
void
tqClose
(
STQ
*
);
void
tqClose
(
STQ
*
);
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
);
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
);
int
tqRegisterPushEntry
(
STQ
*
pTq
,
void
*
pHandle
,
const
SMqPollReq
*
pRequest
,
SRpcMsg
*
pRpcMsg
,
SMqDataRsp
*
pDataRsp
,
int32_t
type
);
int
tqRegisterPushEntry
(
STQ
*
pTq
,
void
*
pHandle
,
const
SMqPollReq
*
pRequest
,
SRpcMsg
*
pRpcMsg
,
SMqDataRsp
*
pDataRsp
,
int32_t
type
);
int
tq
Remove
PushEntry
(
STQ
*
pTq
,
const
char
*
pKey
,
int32_t
keyLen
,
uint64_t
consumerId
,
bool
rspConsumer
);
int
tq
Unregister
PushEntry
(
STQ
*
pTq
,
const
char
*
pKey
,
int32_t
keyLen
,
uint64_t
consumerId
,
bool
rspConsumer
);
int
tqCommit
(
STQ
*
);
int
tqCommit
(
STQ
*
);
int32_t
tqUpdateTbUidList
(
STQ
*
pTq
,
const
SArray
*
tbUidList
,
bool
isAdd
);
int32_t
tqUpdateTbUidList
(
STQ
*
pTq
,
const
SArray
*
tbUidList
,
bool
isAdd
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
4fd3064f
...
@@ -223,19 +223,6 @@ static int32_t doSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const SMqData
...
@@ -223,19 +223,6 @@ static int32_t doSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const SMqData
int32_t
tqPushDataRsp
(
STQ
*
pTq
,
STqPushEntry
*
pPushEntry
)
{
int32_t
tqPushDataRsp
(
STQ
*
pTq
,
STqPushEntry
*
pPushEntry
)
{
SMqDataRsp
*
pRsp
=
pPushEntry
->
pDataRsp
;
SMqDataRsp
*
pRsp
=
pPushEntry
->
pDataRsp
;
#if 0
A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
A(!pRsp->withSchema);
A(taosArrayGetSize(pRsp->blockSchema) == 0);
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
A(pRsp->rspOffset.version > pRsp->reqOffset.version);
}
#endif
SMqRspHead
*
pHeader
=
&
pPushEntry
->
pDataRsp
->
head
;
SMqRspHead
*
pHeader
=
&
pPushEntry
->
pDataRsp
->
head
;
doSendDataRsp
(
&
pPushEntry
->
info
,
pRsp
,
pHeader
->
epoch
,
pHeader
->
consumerId
,
pHeader
->
mqMsgType
);
doSendDataRsp
(
&
pPushEntry
->
info
,
pRsp
,
pHeader
->
epoch
,
pHeader
->
consumerId
,
pHeader
->
mqMsgType
);
...
@@ -895,7 +882,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
...
@@ -895,7 +882,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
atomic_store_32
(
&
pHandle
->
epoch
,
-
1
);
atomic_store_32
(
&
pHandle
->
epoch
,
-
1
);
// remove if it has been register in the push manager, and return one empty block to consumer
// remove if it has been register in the push manager, and return one empty block to consumer
tq
Remove
PushEntry
(
pTq
,
req
.
subKey
,
(
int32_t
)
strlen
(
req
.
subKey
),
pHandle
->
consumerId
,
true
);
tq
Unregister
PushEntry
(
pTq
,
req
.
subKey
,
(
int32_t
)
strlen
(
req
.
subKey
),
pHandle
->
consumerId
,
true
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
4fd3064f
...
@@ -62,6 +62,8 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, STaosxRsp* pRsp, in
...
@@ -62,6 +62,8 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, STaosxRsp* pRsp, in
}
}
int32_t
tqScanData
(
STQ
*
pTq
,
const
STqHandle
*
pHandle
,
SMqDataRsp
*
pRsp
,
STqOffsetVal
*
pOffset
)
{
int32_t
tqScanData
(
STQ
*
pTq
,
const
STqHandle
*
pHandle
,
SMqDataRsp
*
pRsp
,
STqOffsetVal
*
pOffset
)
{
const
int32_t
MAX_ROWS_TO_RETURN
=
4096
;
const
STqExecHandle
*
pExec
=
&
pHandle
->
execHandle
;
const
STqExecHandle
*
pExec
=
&
pHandle
->
execHandle
;
qTaskInfo_t
task
=
pExec
->
task
;
qTaskInfo_t
task
=
pExec
->
task
;
...
@@ -82,7 +84,8 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
...
@@ -82,7 +84,8 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
}
}
}
}
int32_t
rowCnt
=
0
;
int32_t
totalRows
=
0
;
while
(
1
)
{
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
uint64_t
ts
=
0
;
...
@@ -94,9 +97,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
...
@@ -94,9 +97,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
return
-
1
;
return
-
1
;
}
}
tqDebug
(
"consumer:0x%"
PRIx64
" vgId:%d, tmq task executed, get %p"
,
pHandle
->
consumerId
,
vgId
,
pDataBlock
);
// current scan should be stopped ASAP, since the re-balance occurs.
// current scan should be stopped asap, since the rebalance occurs.
if
(
pDataBlock
==
NULL
)
{
if
(
pDataBlock
==
NULL
)
{
break
;
break
;
}
}
...
@@ -104,9 +105,12 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
...
@@ -104,9 +105,12 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
tqDebug
(
"vgId:%d, consumer:0x%"
PRIx64
" tmq task executed, rows:%d, total blocks:%d"
,
vgId
,
pHandle
->
consumerId
,
pDataBlock
->
info
.
rows
,
pRsp
->
blockNum
);
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
rowCnt
+=
pDataBlock
->
info
.
rows
;
totalRows
+=
pDataBlock
->
info
.
rows
;
if
(
rowCnt
>=
4096
)
{
if
(
totalRows
>=
MAX_ROWS_TO_RETURN
)
{
break
;
break
;
}
}
}
}
...
@@ -127,6 +131,9 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
...
@@ -127,6 +131,9 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
return
-
1
;
return
-
1
;
}
}
tqDebug
(
"vgId:%d, consumer:0x%"
PRIx64
" tmq task executed, rows:%d, total blocks:%d, rows:%d"
,
vgId
,
pHandle
->
consumerId
,
pRsp
->
blockNum
,
totalRows
);
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
4fd3064f
...
@@ -206,6 +206,87 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
...
@@ -206,6 +206,87 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
}
}
#endif
#endif
typedef
struct
{
void
*
pKey
;
int64_t
keyLen
;
}
SItem
;
static
void
recordPushedEntry
(
SArray
*
cachedKey
,
void
*
pIter
);
static
void
freeItem
(
void
*
param
)
{
SItem
*
p
=
(
SItem
*
)
param
;
taosMemoryFree
(
p
->
pKey
);
}
static
void
doRemovePushedEntry
(
SArray
*
pCachedKeys
,
STQ
*
pTq
)
{
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
size_t
numOfKeys
=
taosArrayGetSize
(
pCachedKeys
);
for
(
int32_t
i
=
0
;
i
<
numOfKeys
;
i
++
)
{
SItem
*
pItem
=
taosArrayGet
(
pCachedKeys
,
i
);
if
(
taosHashRemove
(
pTq
->
pPushMgr
,
pItem
->
pKey
,
pItem
->
keyLen
)
!=
0
)
{
tqError
(
"vgId:%d, tq push hash remove key error, key: %s"
,
vgId
,
(
char
*
)
pItem
->
pKey
);
}
}
if
(
numOfKeys
>
0
)
{
tqDebug
(
"vgId:%d, pushed %d items and remain:%d"
,
vgId
,
numOfKeys
,
(
int32_t
)
taosHashGetSize
(
pTq
->
pPushMgr
));
}
}
static
void
doPushDataForEntry
(
void
*
pIter
,
STqExecHandle
*
pExec
,
STQ
*
pTq
,
int64_t
ver
,
int32_t
vgId
,
char
*
pData
,
int32_t
dataLen
,
SArray
*
pCachedKey
)
{
STqPushEntry
*
pPushEntry
=
*
(
STqPushEntry
**
)
pIter
;
SMqDataRsp
*
pRsp
=
pPushEntry
->
pDataRsp
;
if
(
pRsp
->
reqOffset
.
version
>=
ver
)
{
tqDebug
(
"vgId:%d, push entry req version %"
PRId64
", while push version %"
PRId64
", skip"
,
vgId
,
pRsp
->
reqOffset
.
version
,
ver
);
return
;
}
qTaskInfo_t
pTaskInfo
=
pExec
->
task
;
// prepare scan mem data
SPackedData
submit
=
{
.
msgStr
=
pData
,
.
msgLen
=
dataLen
,
.
ver
=
ver
,
};
if
(
qStreamSetScanMemData
(
pTaskInfo
,
submit
)
!=
0
){
return
;
}
// here start to scan submit block to extract the subscribed data
int32_t
totalRows
=
0
;
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
if
(
qExecTask
(
pTaskInfo
,
&
pDataBlock
,
&
ts
)
<
0
)
{
tqDebug
(
"vgId:%d, tq exec error since %s"
,
vgId
,
terrstr
());
}
if
(
pDataBlock
==
NULL
)
{
break
;
}
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
totalRows
+=
pDataBlock
->
info
.
rows
;
}
tqDebug
(
"vgId:%d, tq handle push, subkey:%s, block num:%d, rows:%d"
,
vgId
,
pPushEntry
->
subKey
,
pRsp
->
blockNum
,
totalRows
);
if
(
pRsp
->
blockNum
>
0
)
{
tqOffsetResetToLog
(
&
pRsp
->
rspOffset
,
ver
);
tqPushDataRsp
(
pTq
,
pPushEntry
);
recordPushedEntry
(
pCachedKey
,
pIter
);
}
}
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
)
{
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
)
{
void
*
pReq
=
POINTER_SHIFT
(
msg
,
sizeof
(
SSubmitReq2Msg
));
void
*
pReq
=
POINTER_SHIFT
(
msg
,
sizeof
(
SSubmitReq2Msg
));
int32_t
len
=
msgLen
-
sizeof
(
SSubmitReq2Msg
);
int32_t
len
=
msgLen
-
sizeof
(
SSubmitReq2Msg
);
...
@@ -220,24 +301,19 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
...
@@ -220,24 +301,19 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
tqDebug
(
"vgId:%d tq push msg version:%"
PRId64
" type:%s, head:%p, body:%p len:%d, numOfPushed consumers:%d"
,
tqDebug
(
"vgId:%d tq push msg version:%"
PRId64
" type:%s, head:%p, body:%p len:%d, numOfPushed consumers:%d"
,
vgId
,
ver
,
TMSG_INFO
(
msgType
),
msg
,
pReq
,
len
,
numOfRegisteredPush
);
vgId
,
ver
,
TMSG_INFO
(
msgType
),
msg
,
pReq
,
len
,
numOfRegisteredPush
);
SArray
*
cachedKeys
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
void
*
data
=
taosMemoryMalloc
(
len
);
SArray
*
cachedKeyLens
=
taosArrayInit
(
0
,
sizeof
(
size_t
));
void
*
data
=
taosMemoryMalloc
(
len
);
if
(
data
==
NULL
)
{
if
(
data
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tqError
(
"failed to copy data for stream since out of memory"
);
tqError
(
"failed to copy data for stream since out of memory, vgId:%d, consumer:0x%"
PRIx64
,
vgId
);
taosArrayDestroyP
(
cachedKeys
,
(
FDelete
)
taosMemoryFree
);
taosArrayDestroy
(
cachedKeyLens
);
// unlock
taosWUnLockLatch
(
&
pTq
->
lock
);
taosWUnLockLatch
(
&
pTq
->
lock
);
return
-
1
;
return
-
1
;
}
}
memcpy
(
data
,
pReq
,
len
);
memcpy
(
data
,
pReq
,
len
);
void
*
pIter
=
NULL
;
SArray
*
cachedKey
=
taosArrayInit
(
0
,
sizeof
(
SItem
));
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
pIter
);
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
pIter
);
if
(
pIter
==
NULL
)
{
if
(
pIter
==
NULL
)
{
...
@@ -248,83 +324,28 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
...
@@ -248,83 +324,28 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
STqHandle
*
pHandle
=
taosHashGet
(
pTq
->
pHandle
,
pPushEntry
->
subKey
,
strlen
(
pPushEntry
->
subKey
));
STqHandle
*
pHandle
=
taosHashGet
(
pTq
->
pHandle
,
pPushEntry
->
subKey
,
strlen
(
pPushEntry
->
subKey
));
if
(
pHandle
==
NULL
)
{
if
(
pHandle
==
NULL
)
{
tqDebug
(
"vgId:%d, cannot find handle %s"
,
pTq
->
pVnode
->
config
.
vgId
,
pPushEntry
->
subKey
);
tqDebug
(
"vgId:%d, failed to find handle %s in pushing data to consumer, ignore"
,
pTq
->
pVnode
->
config
.
vgId
,
pPushEntry
->
subKey
);
continue
;
}
SMqDataRsp
*
pRsp
=
pPushEntry
->
pDataRsp
;
if
(
pRsp
->
reqOffset
.
version
>=
ver
)
{
tqDebug
(
"vgId:%d, push entry req version %"
PRId64
", while push version %"
PRId64
", skip"
,
vgId
,
pRsp
->
reqOffset
.
version
,
ver
);
continue
;
continue
;
}
}
STqExecHandle
*
pExec
=
&
pHandle
->
execHandle
;
STqExecHandle
*
pExec
=
&
pHandle
->
execHandle
;
qTaskInfo_t
task
=
pExec
->
task
;
doPushDataForEntry
(
pIter
,
pExec
,
pTq
,
ver
,
vgId
,
data
,
len
,
cachedKey
);
// prepare scan mem data
SPackedData
submit
=
{
.
msgStr
=
data
,
.
msgLen
=
len
,
.
ver
=
ver
,
};
if
(
qStreamSetScanMemData
(
task
,
submit
)
!=
0
){
continue
;
}
// here start to scan submit block to extract the subscribed data
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
if
(
qExecTask
(
task
,
&
pDataBlock
,
&
ts
)
<
0
)
{
tqDebug
(
"vgId:%d, tq exec error since %s"
,
vgId
,
terrstr
());
}
if
(
pDataBlock
==
NULL
)
{
break
;
}
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
}
tqDebug
(
"vgId:%d, tq handle push, subkey:%s, block num:%d"
,
vgId
,
pPushEntry
->
subKey
,
pRsp
->
blockNum
);
if
(
pRsp
->
blockNum
>
0
)
{
// set offset
tqOffsetResetToLog
(
&
pRsp
->
rspOffset
,
ver
);
// remove from hash
size_t
kLen
;
void
*
key
=
taosHashGetKey
(
pIter
,
&
kLen
);
void
*
keyCopy
=
taosMemoryCalloc
(
1
,
kLen
+
1
);
memcpy
(
keyCopy
,
key
,
kLen
);
taosArrayPush
(
cachedKeys
,
&
keyCopy
);
taosArrayPush
(
cachedKeyLens
,
&
kLen
);
tqPushDataRsp
(
pTq
,
pPushEntry
);
}
}
// delete entry
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
cachedKeys
);
i
++
)
{
void
*
key
=
taosArrayGetP
(
cachedKeys
,
i
);
size_t
kLen
=
*
(
size_t
*
)
taosArrayGet
(
cachedKeyLens
,
i
);
if
(
taosHashRemove
(
pTq
->
pPushMgr
,
key
,
kLen
)
!=
0
)
{
tqError
(
"vgId:%d, tq push hash remove key error, key: %s"
,
pTq
->
pVnode
->
config
.
vgId
,
(
char
*
)
key
);
}
}
}
taosArrayDestroyP
(
cachedKeys
,
(
FDelete
)
taosMemoryFree
);
doRemovePushedEntry
(
cachedKey
,
pTq
);
taosArrayDestroy
(
cachedKeyLens
);
taosArrayDestroy
Ex
(
cachedKey
,
freeItem
);
taosMemoryFree
(
data
);
taosMemoryFree
(
data
);
}
}
// unlock
// unlock
taosWUnLockLatch
(
&
pTq
->
lock
);
taosWUnLockLatch
(
&
pTq
->
lock
);
}
}
if
(
!
tsDisableStream
&&
vnodeIsRoleLeader
(
pTq
->
pVnode
))
{
if
(
!
tsDisableStream
&&
vnodeIsRoleLeader
(
pTq
->
pVnode
))
{
if
(
taosHashGetSize
(
pTq
->
pStreamMeta
->
pTasks
)
==
0
)
return
0
;
if
(
taosHashGetSize
(
pTq
->
pStreamMeta
->
pTasks
)
==
0
)
{
return
0
;
}
if
(
msgType
==
TDMT_VND_SUBMIT
)
{
if
(
msgType
==
TDMT_VND_SUBMIT
)
{
void
*
data
=
taosMemoryMalloc
(
len
);
void
*
data
=
taosMemoryMalloc
(
len
);
if
(
data
==
NULL
)
{
if
(
data
==
NULL
)
{
...
@@ -351,6 +372,13 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
...
@@ -351,6 +372,13 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
return
0
;
return
0
;
}
}
void
recordPushedEntry
(
SArray
*
cachedKey
,
void
*
pIter
)
{
size_t
kLen
=
0
;
void
*
key
=
taosHashGetKey
(
pIter
,
&
kLen
);
SItem
item
=
{.
pKey
=
strndup
(
key
,
kLen
),
.
keyLen
=
kLen
};
taosArrayPush
(
cachedKey
,
&
item
);
}
int32_t
tqRegisterPushEntry
(
STQ
*
pTq
,
void
*
pHandle
,
const
SMqPollReq
*
pRequest
,
SRpcMsg
*
pRpcMsg
,
int32_t
tqRegisterPushEntry
(
STQ
*
pTq
,
void
*
pHandle
,
const
SMqPollReq
*
pRequest
,
SRpcMsg
*
pRpcMsg
,
SMqDataRsp
*
pDataRsp
,
int32_t
type
)
{
SMqDataRsp
*
pDataRsp
,
int32_t
type
)
{
uint64_t
consumerId
=
pRequest
->
consumerId
;
uint64_t
consumerId
=
pRequest
->
consumerId
;
...
@@ -388,8 +416,8 @@ int32_t tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest,
...
@@ -388,8 +416,8 @@ int32_t tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest,
return
0
;
return
0
;
}
}
int32_t
tq
Remove
PushEntry
(
STQ
*
pTq
,
const
char
*
pKey
,
int32_t
keyLen
,
uint64_t
consumerId
,
bool
rspConsumer
)
{
int32_t
tq
Unregister
PushEntry
(
STQ
*
pTq
,
const
char
*
pKey
,
int32_t
keyLen
,
uint64_t
consumerId
,
bool
rspConsumer
)
{
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
STqPushEntry
**
pEntry
=
taosHashGet
(
pTq
->
pPushMgr
,
pKey
,
keyLen
);
STqPushEntry
**
pEntry
=
taosHashGet
(
pTq
->
pPushMgr
,
pKey
,
keyLen
);
if
(
pEntry
!=
NULL
)
{
if
(
pEntry
!=
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录