Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
82b2ae41
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看板
提交
82b2ae41
编写于
5月 19, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(tmq): set and show client id
上级
7d261da4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
30 deletion
+32
-30
include/common/tmsg.h
include/common/tmsg.h
+3
-0
source/common/src/systable.c
source/common/src/systable.c
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+5
-4
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+12
-14
tests/script/tsim/tstream/basic1.sim
tests/script/tsim/tstream/basic1.sim
+10
-10
未找到文件。
include/common/tmsg.h
浏览文件 @
82b2ae41
...
...
@@ -1480,6 +1480,7 @@ typedef struct {
typedef
struct
{
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
char
clientId
[
256
];
SArray
*
topicNames
;
// SArray<char**>
}
SCMSubscribeReq
;
...
...
@@ -1487,6 +1488,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
cgroup
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
clientId
);
int32_t
topicNum
=
taosArrayGetSize
(
pReq
->
topicNames
);
tlen
+=
taosEncodeFixedI32
(
buf
,
topicNum
);
...
...
@@ -1500,6 +1502,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
static
FORCE_INLINE
void
*
tDeserializeSCMSubscribeReq
(
void
*
buf
,
SCMSubscribeReq
*
pReq
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
cgroup
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
clientId
);
int32_t
topicNum
;
buf
=
taosDecodeFixedI32
(
buf
,
&
topicNum
);
...
...
source/common/src/systable.c
浏览文件 @
82b2ae41
...
...
@@ -263,7 +263,7 @@ static const SSysDbTableSchema topicSchema[] = {
static
const
SSysDbTableSchema
consumerSchema
[]
=
{
{.
name
=
"consumer_id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"consumer_group"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"
app
_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"
client
_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"status"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"topics"
,
.
bytes
=
TSDB_TOPIC_FNAME_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
82b2ae41
...
...
@@ -463,7 +463,7 @@ typedef struct {
typedef
struct
{
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
char
appId
[
TSDB_CGROUP_LEN
];
char
clientId
[
256
];
int8_t
updateType
;
// used only for update
int32_t
epoch
;
int32_t
status
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
82b2ae41
...
...
@@ -427,6 +427,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
pConsumerOld
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
if
(
pConsumerOld
==
NULL
)
{
pConsumerNew
=
tNewSMqConsumerObj
(
consumerId
,
cgroup
);
tstrncpy
(
pConsumerNew
->
clientId
,
subscribe
.
clientId
,
256
);
pConsumerNew
->
updateType
=
CONSUMER_UPDATE__MODIFY
;
pConsumerNew
->
rebNewTopics
=
newSub
;
subscribe
.
topicNames
=
NULL
;
...
...
@@ -848,11 +849,11 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
cgroup
,
false
);
// app id
char
app
Id
[
TSDB_CGROUP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tstrncpy
(
varDataVal
(
appId
),
pConsumer
->
app
Id
,
TSDB_CGROUP_LEN
);
varDataSetLen
(
appId
,
strlen
(
varDataVal
(
app
Id
)));
char
client
Id
[
TSDB_CGROUP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tstrncpy
(
varDataVal
(
clientId
),
pConsumer
->
client
Id
,
TSDB_CGROUP_LEN
);
varDataSetLen
(
clientId
,
strlen
(
varDataVal
(
client
Id
)));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
app
Id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
client
Id
,
false
);
// status
char
status
[
20
+
VARSTR_HEADER_SIZE
]
=
{
0
};
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
82b2ae41
...
...
@@ -492,8 +492,8 @@ static int32_t mndDropTopic(SMnode *pMnode, STrans *pTrans, SRpcMsg *pReq, SMqTo
}
static
int32_t
mndProcessDropTopicReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
/*SSdb *pSdb = pMnode->pSdb;*/
SMDropTopicReq
dropReq
=
{
0
};
if
(
tDeserializeSMDropTopicReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
...
...
@@ -502,16 +502,16 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
}
SMqTopicObj
*
pTopic
=
mndAcquireTopic
(
pMnode
,
dropReq
.
name
);
//
if (pTopic == NULL) {
//
if (dropReq.igNotExists) {
//
mDebug("topic:%s, not exist, ignore not exist is set", dropReq.name);
//
return 0;
//
} else {
//
terrno = TSDB_CODE_MND_TOPIC_NOT_EXIST;
//
mError("topic:%s, failed to drop since %s", dropReq.name, terrstr());
//
return -1;
//
}
//
}
if
(
pTopic
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
mDebug
(
"topic:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
return
0
;
}
else
{
terrno
=
TSDB_CODE_MND_TOPIC_NOT_EXIST
;
mError
(
"topic:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
return
-
1
;
}
}
if
(
pTopic
->
refConsumerCnt
!=
0
)
{
mndReleaseTopic
(
pMnode
,
pTopic
);
...
...
@@ -528,12 +528,10 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
mDebug
(
"trans:%d, used to drop topic:%s"
,
pTrans
->
id
,
pTopic
->
name
);
#if 1
if
(
mndDropOffsetByTopic
(
pMnode
,
pTrans
,
dropReq
.
name
)
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
#endif
if
(
mndDropSubByTopic
(
pMnode
,
pTrans
,
dropReq
.
name
)
<
0
)
{
ASSERT
(
0
);
...
...
tests/script/tsim/tstream/basic1.sim
浏览文件 @
82b2ae41
...
...
@@ -409,53 +409,53 @@ sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt;
# row 1
if $data11 != 4 then
print ======$data11
#
return -1
return -1
endi
if $data12 != 4 then
print ======$data12
#
return -1
return -1
endi
if $data13 != 10 then
print ======$data13
#
return -1
return -1
endi
if $data14 != 3 then
print ======$data14
#
return -1
return -1
endi
if $data15 != 1 then
print ======$data15
#
return -1
return -1
endi
# row 2
if $data21 != 4 then
print ======$data21
#
return -1
return -1
endi
if $data22 != 4 then
print ======$data22
#
return -1
return -1
endi
if $data23 != 15 then
print ======$data23
#
return -1
return -1
endi
if $data24 != 4 then
print ======$data24
#
return -1
return -1
endi
if $data25 != 3 then
print ======$data25
#
return -1
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录