Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
abd6b98b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
abd6b98b
编写于
2月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
serialize create topic req
上级
51f46e40
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
49 deletion
+25
-49
include/common/tmsg.h
include/common/tmsg.h
+3
-3
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-1
source/client/src/tmq.c
source/client/src/tmq.c
+3
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-1
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+16
-41
未找到文件。
include/common/tmsg.h
浏览文件 @
abd6b98b
...
...
@@ -1116,9 +1116,9 @@ typedef struct {
char
*
sql
;
char
*
physicalPlan
;
char
*
logicalPlan
;
}
S
C
MCreateTopicReq
;
}
SMCreateTopicReq
;
static
FORCE_INLINE
int
tSerializeS
CMCreateTopicReq
(
void
**
buf
,
const
SC
MCreateTopicReq
*
pReq
)
{
static
FORCE_INLINE
int
tSerializeS
MCreateTopicReq
(
void
**
buf
,
const
S
MCreateTopicReq
*
pReq
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
igExists
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
...
...
@@ -1128,7 +1128,7 @@ static FORCE_INLINE int tSerializeSCMCreateTopicReq(void** buf, const SCMCreateT
return
tlen
;
}
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicReq
(
void
*
buf
,
S
C
MCreateTopicReq
*
pReq
)
{
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicReq
(
void
*
buf
,
SMCreateTopicReq
*
pReq
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
igExists
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
sql
));
...
...
include/common/tmsgdef.h
浏览文件 @
abd6b98b
...
...
@@ -137,7 +137,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS
,
"mnode-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"mnode-grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"mnode-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
S
C
MCreateTopicReq
,
SCMCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
SMCreateTopicReq
,
SCMCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"mnode-alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"mnode-drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
...
...
source/client/src/tmq.c
浏览文件 @
abd6b98b
...
...
@@ -360,7 +360,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
char
topicFname
[
TSDB_TOPIC_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
name
,
topicFname
);
S
C
MCreateTopicReq
req
=
{
SMCreateTopicReq
req
=
{
.
name
=
(
char
*
)
topicFname
,
.
igExists
=
1
,
.
physicalPlan
=
(
char
*
)
pStr
,
...
...
@@ -368,14 +368,14 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
};
int
tlen
=
tSerializeS
C
MCreateTopicReq
(
NULL
,
&
req
);
int
tlen
=
tSerializeSMCreateTopicReq
(
NULL
,
&
req
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
goto
_return
;
}
void
*
abuf
=
buf
;
tSerializeS
C
MCreateTopicReq
(
&
abuf
,
&
req
);
tSerializeSMCreateTopicReq
(
&
abuf
,
&
req
);
/*printf("formatted: %s\n", dagStr);*/
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
buf
,
.
len
=
tlen
};
...
...
source/common/src/tmsg.c
浏览文件 @
abd6b98b
...
...
@@ -1815,3 +1815,4 @@ int32_t tDeserializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pR
tCoderClear
(
&
decoder
);
return
0
;
}
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
abd6b98b
...
...
@@ -1497,7 +1497,7 @@ static int32_t mndRetrieveStb(SMnodeMsg *pReq, SShowObj *pShow, char *data, int3
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pStb
->
dbUid
!=
pDb
->
uid
)
{
if
(
strncmp
(
pStb
->
db
,
pDb
->
name
,
tListLen
(
pStb
->
db
)
)
==
0
)
{
if
(
strncmp
(
pStb
->
db
,
pDb
->
name
,
prefixLen
)
==
0
)
{
mError
(
"Inconsistent table data, name:%s, db:%s, dbUid:%"
PRIu64
,
pStb
->
name
,
pDb
->
name
,
pDb
->
uid
);
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
abd6b98b
...
...
@@ -34,7 +34,7 @@ static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pTopic, SMqTopicObj
static
int32_t
mndProcessCreateTopicReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropTopicReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropTopicInRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessTopicMeta
Msg
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessTopicMeta
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetTopicMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveTopic
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextTopic
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -225,12 +225,12 @@ static SDDropTopicReq *mndBuildDropTopicMsg(SMnode *pMnode, SVgObj *pVgroup, SMq
return
pDrop
;
}
static
int32_t
mndCheckCreateTopicMsg
(
S
C
MCreateTopicReq
*
creattopReq
)
{
static
int32_t
mndCheckCreateTopicMsg
(
SMCreateTopicReq
*
creattopReq
)
{
// deserialize and other stuff
return
0
;
}
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
S
C
MCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"topic:%s to create"
,
pCreate
->
name
);
SMqTopicObj
topicObj
=
{
0
};
tstrncpy
(
topicObj
.
name
,
pCreate
->
name
,
TSDB_TOPIC_FNAME_LEN
);
...
...
@@ -264,7 +264,7 @@ static int32_t mndProcessCreateTopicReq(SMnodeMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
pMnode
;
char
*
msgStr
=
pReq
->
rpcMsg
.
pCont
;
S
C
MCreateTopicReq
createTopicReq
=
{
0
};
SMCreateTopicReq
createTopicReq
=
{
0
};
tDeserializeSCMCreateTopicReq
(
msgStr
,
&
createTopicReq
);
mDebug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
...
...
@@ -348,7 +348,7 @@ static int32_t mndProcessDropTopicInRsp(SMnodeMsg *pRsp) {
return
0
;
}
static
int32_t
mndProcessTopicMeta
Msg
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessTopicMeta
Req
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
STableInfoReq
infoReq
=
{
0
};
...
...
@@ -466,18 +466,6 @@ static int32_t mndGetTopicMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"columns"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"tags"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
...
...
@@ -493,19 +481,6 @@ static int32_t mndGetTopicMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
return
0
;
}
static
void
mndExtractTableName
(
char
*
tableId
,
char
*
name
)
{
int32_t
pos
=
-
1
;
int32_t
num
=
0
;
for
(
pos
=
0
;
tableId
[
pos
]
!=
0
;
++
pos
)
{
if
(
tableId
[
pos
]
==
'.'
)
num
++
;
if
(
num
==
2
)
break
;
}
if
(
num
==
2
)
{
strcpy
(
name
,
tableId
+
pos
+
1
);
}
}
static
int32_t
mndRetrieveTopic
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
@@ -513,9 +488,12 @@ static int32_t mndRetrieveTopic(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
SMqTopicObj
*
pTopic
=
NULL
;
int32_t
cols
=
0
;
char
*
pWrite
;
char
prefix
[
64
]
=
{
0
};
char
prefix
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
tstrncpy
(
prefix
,
pShow
->
db
,
64
);
tstrncpy
(
prefix
,
pShow
->
db
,
TSDB_DB_FNAME_LEN
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
int32_t
prefixLen
=
(
int32_t
)
strlen
(
prefix
);
...
...
@@ -523,7 +501,11 @@ static int32_t mndRetrieveTopic(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pShow
->
pIter
,
(
void
**
)
&
pTopic
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
strncmp
(
pTopic
->
name
,
prefix
,
prefixLen
)
!=
0
)
{
if
(
pTopic
->
dbUid
!=
pDb
->
uid
)
{
if
(
strncmp
(
pTopic
->
name
,
prefix
,
prefixLen
)
!=
0
)
{
mError
(
"Inconsistent table data, name:%s, db:%s, dbUid:%"
PRIu64
,
pTopic
->
name
,
pDb
->
name
,
pDb
->
uid
);
}
sdbRelease
(
pSdb
,
pTopic
);
continue
;
}
...
...
@@ -540,18 +522,11 @@ static int32_t mndRetrieveTopic(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
*
(
int64_t
*
)
pWrite
=
pTopic
->
createTime
;
cols
++
;
/*pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;*/
/**(int32_t *)pWrite = pTopic->numOfColumns;*/
/*cols++;*/
/*pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;*/
/**(int32_t *)pWrite = pTopic->numOfTags;*/
/*cols++;*/
numOfRows
++
;
sdbRelease
(
pSdb
,
pTopic
);
}
mndReleaseDb
(
pMnode
,
pDb
);
pShow
->
numOfReads
+=
numOfRows
;
mndVacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
return
numOfRows
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录