Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
05a0774b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05a0774b
编写于
5月 27, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(tmq): add sub type
上级
d6094a43
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
30 deletion
+37
-30
include/common/tmsg.h
include/common/tmsg.h
+15
-10
source/common/src/tmsg.c
source/common/src/tmsg.c
+14
-8
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
+0
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+4
-4
未找到文件。
include/common/tmsg.h
浏览文件 @
05a0774b
...
...
@@ -1473,15 +1473,25 @@ typedef struct {
int64_t
streamId
;
}
SMVCreateStreamRsp
,
SMSCreateStreamRsp
;
enum
{
TOPIC_SUB_TYPE__DB
=
1
,
TOPIC_SUB_TYPE__TABLE
,
TOPIC_SUB_TYPE__COLUMN
,
};
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
// accout.topic
int8_t
igExists
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
// int8_t withTbName;
// int8_t withSchema;
// int8_t withTag;
int8_t
subType
;
char
*
sql
;
char
*
ast
;
char
subscribeDbName
[
TSDB_DB_NAME_LEN
];
union
{
char
*
ast
;
char
subDbName
[
TSDB_DB_NAME_LEN
];
char
subStbName
[
TSDB_TABLE_FNAME_LEN
];
};
}
SCMCreateTopicReq
;
int32_t
tSerializeSCMCreateTopicReq
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicReq
*
pReq
);
...
...
@@ -2145,11 +2155,6 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
return
buf
;
}
enum
{
TOPIC_SUB_TYPE__DB
=
1
,
TOPIC_SUB_TYPE__TABLE
,
};
typedef
struct
{
SMsgHead
head
;
int64_t
leftForVer
;
...
...
source/common/src/tmsg.c
浏览文件 @
05a0774b
...
...
@@ -2677,10 +2677,12 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withTbName
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withSchema
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withTag
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
subscribeDbName
)
<
0
)
return
-
1
;
/*if (tEncodeI8(&encoder, pReq->withTbName) < 0) return -1;*/
/*if (tEncodeI8(&encoder, pReq->withSchema) < 0) return -1;*/
/*if (tEncodeI8(&encoder, pReq->withTag) < 0) return -1;*/
if
(
tEncodeI8
(
&
encoder
,
pReq
->
subType
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
subDbName
)
<
0
)
return
-
1
;
/*if (tEncodeCStr(&encoder, pReq->subStbName) < 0) return -1;*/
if
(
tEncodeI32
(
&
encoder
,
sqlLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
astLen
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
...
...
@@ -2703,10 +2705,14 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withTbName
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withSchema
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withTag
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
subscribeDbName
)
<
0
)
return
-
1
;
/*if (tDecodeI8(&decoder, &pReq->withTbName) < 0) return -1;*/
/*if (tDecodeI8(&decoder, &pReq->withSchema) < 0) return -1;*/
/*if (tDecodeI8(&decoder, &pReq->withTag) < 0) return -1;*/
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
subType
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
subDbName
)
<
0
)
return
-
1
;
/*if (pReq->subType == TOPIC_SUB_TYPE__TABLE) {*/
/*if (tDecodeCStrTo(&decoder, pReq->subStbName) < 0) return -1;*/
/*}*/
if
(
tDecodeI32
(
&
decoder
,
&
sqlLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
astLen
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
05a0774b
...
...
@@ -307,7 +307,7 @@ static SDDropTopicReq *mndBuildDropTopicMsg(SMnode *pMnode, SVgObj *pVgroup, SMq
}
static
int32_t
mndCheckCreateTopicReq
(
SCMCreateTopicReq
*
pCreate
)
{
if
(
pCreate
->
name
[
0
]
==
0
||
pCreate
->
sql
==
NULL
||
pCreate
->
sql
[
0
]
==
0
||
pCreate
->
sub
scribe
DbName
[
0
]
==
0
)
{
if
(
pCreate
->
name
[
0
]
==
0
||
pCreate
->
sql
==
NULL
||
pCreate
->
sql
[
0
]
==
0
||
pCreate
->
subDbName
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_TOPIC
;
return
-
1
;
}
...
...
@@ -333,8 +333,8 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
topicObj
.
ast
=
strdup
(
pCreate
->
ast
);
topicObj
.
astLen
=
strlen
(
pCreate
->
ast
)
+
1
;
topicObj
.
subType
=
TOPIC_SUB_TYPE__TABLE
;
topicObj
.
withTbName
=
pCreate
->
withTbName
;
topicObj
.
withSchema
=
pCreate
->
withSchema
;
/*topicObj.withTbName = pCreate->withTbName;*/
/*topicObj.withSchema = pCreate->withSchema;*/
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pCreate
->
ast
,
&
pAst
)
!=
0
)
{
...
...
@@ -441,7 +441,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
goto
CREATE_TOPIC_OVER
;
}
pDb
=
mndAcquireDb
(
pMnode
,
createTopicReq
.
sub
scribe
DbName
);
pDb
=
mndAcquireDb
(
pMnode
,
createTopicReq
.
subDbName
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
CREATE_TOPIC_OVER
;
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
05a0774b
...
...
@@ -122,10 +122,6 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal) {
ASSERT
(
0
);
}
/*if (tdbBegin(pTq->pMetaStore, &txn) < 0) {*/
/*ASSERT(0);*/
/*}*/
TBC
*
pCur
;
if
(
tdbTbcOpen
(
pTq
->
pExecStore
,
&
pCur
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
05a0774b
...
...
@@ -3239,9 +3239,9 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
topicName
,
strlen
(
pStmt
->
topicName
));
tNameGetFullDbName
(
&
name
,
pReq
->
name
);
pReq
->
igExists
=
pStmt
->
ignoreExists
;
pReq
->
withTbName
=
pStmt
->
pOptions
->
withTable
;
pReq
->
withSchema
=
pStmt
->
pOptions
->
withSchema
;
pReq
->
withTag
=
pStmt
->
pOptions
->
withTag
;
/*pReq->withTbName = pStmt->pOptions->withTable;*/
/*pReq->withSchema = pStmt->pOptions->withSchema;*/
/*pReq->withTag = pStmt->pOptions->withTag;*/
pReq
->
sql
=
strdup
(
pCxt
->
pParseCxt
->
pSql
);
if
(
NULL
==
pReq
->
sql
)
{
...
...
@@ -3262,7 +3262,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
dbName
=
pStmt
->
subscribeDbName
;
}
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
dbName
,
strlen
(
dbName
));
tNameGetFullDbName
(
&
name
,
pReq
->
sub
scribe
DbName
);
tNameGetFullDbName
(
&
name
,
pReq
->
subDbName
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录