Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b08c3120
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
b08c3120
编写于
3月 21, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory error
上级
8a20b2fe
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
236 addition
and
202 deletion
+236
-202
include/common/tcommon.h
include/common/tcommon.h
+19
-5
include/common/tmsg.h
include/common/tmsg.h
+5
-4
source/client/src/tmq.c
source/client/src/tmq.c
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+200
-181
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+5
-5
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+4
-4
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+1
-1
tests/test/c/tmqDemo.c
tests/test/c/tmqDemo.c
+1
-1
未找到文件。
include/common/tcommon.h
浏览文件 @
b08c3120
...
...
@@ -101,13 +101,27 @@ void* blockDataDestroy(SSDataBlock* pBlock);
int32_t
tEncodeDataBlock
(
void
**
buf
,
const
SSDataBlock
*
pBlock
);
void
*
tDecodeDataBlock
(
const
void
*
buf
,
SSDataBlock
*
pBlock
);
static
FORCE_INLINE
void
tDeleteSSDataBlock
(
SSDataBlock
*
pBlock
)
{
if
(
pBlock
==
NULL
)
{
return
;
static
FORCE_INLINE
void
blockDestroyInner
(
SSDataBlock
*
pBlock
)
{
// WARNING: do not use info.numOfCols,
// sometimes info.numOfCols != array size
int32_t
numOfOutput
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
tfree
(
pColInfoData
->
varmeta
.
offset
);
}
else
{
tfree
(
pColInfoData
->
nullbitmap
);
}
tfree
(
pColInfoData
->
pData
);
}
blockDataDestroy
(
pBlock
);
taosArrayDestroy
(
pBlock
->
pDataBlock
);
tfree
(
pBlock
->
pBlockAgg
);
}
static
FORCE_INLINE
void
tDeleteSSDataBlock
(
SSDataBlock
*
pBlock
)
{
blockDestroyInner
(
pBlock
);
}
static
FORCE_INLINE
int32_t
tEncodeSMqPollRsp
(
void
**
buf
,
const
SMqPollRsp
*
pRsp
)
{
int32_t
tlen
=
0
;
int32_t
sz
=
0
;
...
...
@@ -157,7 +171,7 @@ static FORCE_INLINE void tDeleteSMqConsumeRsp(SMqPollRsp* pRsp) {
}
free
(
pRsp
->
schema
);
}
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
blockDestroyInner
);
pRsp
->
pBlockData
=
NULL
;
}
...
...
include/common/tmsg.h
浏览文件 @
b08c3120
...
...
@@ -2145,11 +2145,12 @@ typedef struct {
typedef
struct
{
SMqRspHead
head
;
int64_t
reqOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
// TODO: replace with topic name
int32_t
numOfTopics
;
// TODO: remove from msg
int64_t
reqOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
int32_t
numOfTopics
;
SSchemaWrapper
*
schema
;
SArray
*
pBlockData
;
// SArray<SSDataBlock>
}
SMqPollRsp
;
...
...
source/client/src/tmq.c
浏览文件 @
b08c3120
...
...
@@ -735,7 +735,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
SMqClientVg
*
pVg
=
pParam
->
pVg
;
tmq_t
*
tmq
=
pParam
->
tmq
;
if
(
code
!=
0
)
{
printf
(
"msg discard
\n
"
);
printf
(
"msg discard
%x
\n
"
,
code
);
goto
WRITE_QUEUE_FAIL
;
}
...
...
source/common/src/tdatablock.c
浏览文件 @
b08c3120
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
b08c3120
...
...
@@ -337,9 +337,9 @@ static int32_t mndSplitSubscribeKey(const char *key, char *topic, char *cgroup)
while
(
key
[
i
]
!=
TMQ_SEPARATOR
)
{
i
++
;
}
memcpy
(
topic
,
key
,
i
-
1
);
topic
[
i
]
=
0
;
strcpy
(
cgroup
,
&
key
[
i
+
1
]);
memcpy
(
cgroup
,
key
,
i
);
cgroup
[
i
]
=
0
;
strcpy
(
topic
,
&
key
[
i
+
1
]);
return
0
;
}
...
...
@@ -539,8 +539,8 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) {
mndSplitSubscribeKey
(
pSub
->
key
,
topic
,
cgroup
);
SMqTopicObj
*
pTopic
=
mndAcquireTopic
(
pMnode
,
topic
);
mInfo
(
"mq set conn: assign vgroup %d of topic %s to consumer %"
PRId64
"
"
,
pConsumerEp
->
vgId
,
topic
,
pConsumerEp
->
consumerId
);
mInfo
(
"mq set conn: assign vgroup %d of topic %s to consumer %"
PRId64
"
cgroup: %s"
,
pConsumerEp
->
vgId
,
topic
,
pConsumerEp
->
consumerId
,
cgroup
);
mndPersistMqSetConnReq
(
pMnode
,
pTrans
,
pTopic
,
cgroup
,
pConsumerEp
);
mndReleaseTopic
(
pMnode
,
pTopic
);
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
b08c3120
...
...
@@ -241,12 +241,12 @@ static int32_t mndGetPlanString(SCMCreateTopicReq *pCreate, char **pStr) {
return
TSDB_CODE_SUCCESS
;
}
SNode
*
pAst
=
NULL
;
SNode
*
pAst
=
NULL
;
int32_t
code
=
nodesStringToNode
(
pCreate
->
ast
,
&
pAst
);
SQueryPlan
*
pPlan
=
NULL
;
SQueryPlan
*
pPlan
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SPlanContext
cxt
=
{
.
pAstRoot
=
pAst
,
.
topicQuery
=
true
};
SPlanContext
cxt
=
{
.
pAstRoot
=
pAst
,
.
topicQuery
=
true
};
code
=
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
);
}
...
...
@@ -274,7 +274,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
topicObj
.
logicalPlan
=
""
;
topicObj
.
sqlLen
=
strlen
(
pCreate
->
sql
);
char
*
pPlanStr
=
NULL
;
char
*
pPlanStr
=
NULL
;
if
(
TSDB_CODE_SUCCESS
!=
mndGetPlanString
(
pCreate
,
&
pPlanStr
))
{
mError
(
"topic:%s, failed to get plan since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
b08c3120
...
...
@@ -316,7 +316,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMqRspHead
));
tEncodeSMqPollRsp
(
&
abuf
,
&
rsp
);
taosArrayDestroyEx
(
rsp
.
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
/*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/
pMsg
->
pCont
=
buf
;
pMsg
->
contLen
=
tlen
;
pMsg
->
code
=
0
;
...
...
tests/test/c/tmqDemo.c
浏览文件 @
b08c3120
...
...
@@ -306,7 +306,7 @@ int32_t init_env() {
}
//const char* sql = "select * from tu1";
sprintf
(
sqlStr
,
"create topic test_stb_topic_1 as select * from %s
%d"
,
g_stConfInfo
.
stbName
,
0
);
sprintf
(
sqlStr
,
"create topic test_stb_topic_1 as select * from %s
"
,
g_stConfInfo
.
stbName
);
/*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sqlStr, strlen(sqlStr));*/
pRes
=
taos_query
(
pConn
,
sqlStr
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录