Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b147ba28
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
b147ba28
编写于
2月 14, 2023
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: handle insufficient resource
上级
9fb5c8f3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
18 deletion
+18
-18
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-8
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+16
-10
未找到文件。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
b147ba28
...
...
@@ -816,7 +816,6 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
// TODO version should be assigned and refed during preprocess
SWalRef
*
pRef
=
walRefCommittedVer
(
pTq
->
pVnode
->
pWal
);
if
(
pRef
==
NULL
)
{
ASSERT
(
0
);
return
-
1
;
}
int64_t
ver
=
pRef
->
refVer
;
...
...
@@ -837,12 +836,9 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
pHandle
->
execHandle
.
task
=
qCreateQueueExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
,
&
pHandle
->
execHandle
.
numOfCols
,
NULL
);
ASSERT
(
pHandle
->
execHandle
.
task
);
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
pHandle
->
execHandle
.
task
,
&
scanner
);
ASSERT
(
scanner
);
pHandle
->
execHandle
.
pExecReader
=
qExtractReaderFromStreamScanner
(
scanner
);
ASSERT
(
pHandle
->
execHandle
.
pExecReader
);
}
else
if
(
pHandle
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__DB
)
{
pHandle
->
pWalReader
=
walOpenReader
(
pTq
->
pVnode
->
pWal
,
NULL
);
pHandle
->
execHandle
.
pExecReader
=
tqOpenReader
(
pTq
->
pVnode
);
...
...
@@ -875,8 +871,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
taosHashPut
(
pTq
->
pHandle
,
req
.
subKey
,
strlen
(
req
.
subKey
),
pHandle
,
sizeof
(
STqHandle
));
tqDebug
(
"try to persist handle %s consumer %"
PRId64
,
req
.
subKey
,
pHandle
->
consumerId
);
if
(
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
}
else
{
/*ASSERT(pExec->consumerId == req.oldConsumerId);*/
...
...
@@ -886,8 +881,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
taosMemoryFree
(
req
.
qmsg
);
if
(
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
// close handle
}
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
b147ba28
...
...
@@ -71,17 +71,14 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
int32_t
tqMetaOpen
(
STQ
*
pTq
)
{
if
(
tdbOpen
(
pTq
->
path
,
16
*
1024
,
1
,
&
pTq
->
pMetaDB
,
0
)
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
if
(
tdbTbOpen
(
"tq.db"
,
-
1
,
-
1
,
NULL
,
pTq
->
pMetaDB
,
&
pTq
->
pExecStore
,
0
)
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
if
(
tdbTbOpen
(
"tq.check.db"
,
-
1
,
-
1
,
NULL
,
pTq
->
pMetaDB
,
&
pTq
->
pCheckStore
,
0
)
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
...
...
@@ -197,40 +194,49 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
int32_t
code
;
int32_t
vlen
;
tEncodeSize
(
tEncodeSTqHandle
,
pHandle
,
vlen
,
code
);
ASSERT
(
code
==
0
);
tqDebug
(
"tq save %s(%d) consumer %"
PRId64
" vgId:%d"
,
pHandle
->
subKey
,
(
int32_t
)
strlen
(
pHandle
->
subKey
),
pHandle
->
consumerId
,
TD_VID
(
pTq
->
pVnode
));
void
*
buf
=
taosMemoryCalloc
(
1
,
vlen
);
if
(
buf
==
NULL
)
{
ASSERT
(
0
)
;
return
-
1
;
}
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
buf
,
vlen
);
if
(
tEncodeSTqHandle
(
&
encoder
,
pHandle
)
<
0
)
{
ASSERT
(
0
);
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
-
1
;
}
TXN
*
txn
;
if
(
tdbBegin
(
pTq
->
pMetaDB
,
&
txn
,
tdbDefaultMalloc
,
tdbDefaultFree
,
NULL
,
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
)
<
0
)
{
ASSERT
(
0
);
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
-
1
;
}
if
(
tdbTbUpsert
(
pTq
->
pExecStore
,
key
,
(
int
)
strlen
(
key
),
buf
,
vlen
,
txn
)
<
0
)
{
ASSERT
(
0
);
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
-
1
;
}
if
(
tdbCommit
(
pTq
->
pMetaDB
,
txn
)
<
0
)
{
ASSERT
(
0
);
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
-
1
;
}
if
(
tdbPostCommit
(
pTq
->
pMetaDB
,
txn
)
<
0
)
{
ASSERT
(
0
);
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
-
1
;
}
tEncoderClear
(
&
encoder
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录