Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
05755a28
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看板
未验证
提交
05755a28
编写于
5月 09, 2022
作者:
L
Liu Jicong
提交者:
GitHub
5月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12276 from taosdata/feature/tq
feat(tmq): show subcription
上级
73142a7a
d0f16dfe
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
138 addition
and
9 deletion
+138
-9
include/common/systable.h
include/common/systable.h
+0
-1
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/common/src/systable.c
source/common/src/systable.c
+2
-2
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+2
-2
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+128
-0
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+1
-0
tests/script/sh/copy_udf.sh
tests/script/sh/copy_udf.sh
+4
-3
未找到文件。
include/common/systable.h
浏览文件 @
05755a28
...
...
@@ -45,7 +45,6 @@ extern "C" {
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "smas"
#define TSDB_PERFS_TABLE_SUBSCRIBES "subscribes"
#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
#define TSDB_PERFS_TABLE_QUERIES "queries"
#define TSDB_PERFS_TABLE_TOPICS "topics"
...
...
include/common/tmsg.h
浏览文件 @
05755a28
...
...
@@ -99,7 +99,7 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_VGROUP
,
TSDB_MGMT_TABLE_TOPICS
,
TSDB_MGMT_TABLE_CONSUMERS
,
TSDB_MGMT_TABLE_SUBSCRI
BE
S
,
TSDB_MGMT_TABLE_SUBSCRI
PTION
S
,
TSDB_MGMT_TABLE_TRANS
,
TSDB_MGMT_TABLE_SMAS
,
TSDB_MGMT_TABLE_CONFIGS
,
...
...
source/common/src/systable.c
浏览文件 @
05755a28
...
...
@@ -274,8 +274,8 @@ static const SSysDbTableSchema consumerSchema[] = {
};
static
const
SSysDbTableSchema
subscriptionSchema
[]
=
{
{.
name
=
"topic_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"group_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"topic_name"
,
.
bytes
=
TSDB_TOPIC_FNAME_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"group_id"
,
.
bytes
=
TSDB_CGROUP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"consumer_id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
};
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
05755a28
...
...
@@ -85,8 +85,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type
=
TSDB_MGMT_TABLE_VGROUP
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_CONSUMERS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_CONSUMERS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_SUBSCRI
BE
S
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_SUBSCRI
BE
S
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_SUBSCRI
PTION
S
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_SUBSCRI
PTION
S
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_TRANS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TRANS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_SMAS
,
len
)
==
0
)
{
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
05755a28
...
...
@@ -44,6 +44,9 @@ static int32_t mndSubActionUpdate(SSdb *pSdb, SMqSubscribeObj *pOldSub, SMqSubs
static
int32_t
mndProcessRebalanceReq
(
SNodeMsg
*
pMsg
);
static
int32_t
mndProcessSubscribeInternalRsp
(
SNodeMsg
*
pMsg
);
static
int32_t
mndRetrieveSubscribe
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSubscribe
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndSetSubRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqSubscribeObj
*
pSub
)
{
SSdbRaw
*
pRedoRaw
=
mndSubActionEncode
(
pSub
);
if
(
pRedoRaw
==
NULL
)
return
-
1
;
...
...
@@ -71,6 +74,10 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_VND_MQ_VG_CHANGE_RSP
,
mndProcessSubscribeInternalRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DO_REBALANCE
,
mndProcessRebalanceReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_SUBSCRIPTIONS
,
mndRetrieveSubscribe
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_TOPICS
,
mndCancelGetNextSubscribe
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -706,3 +713,124 @@ int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
END:
return
code
;
}
static
int32_t
mndRetrieveSubscribe
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SMqSubscribeObj
*
pSub
=
NULL
;
while
(
numOfRows
<
rowsCapacity
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_SUBSCRIBE
,
pShow
->
pIter
,
(
void
**
)
&
pSub
);
if
(
pShow
->
pIter
==
NULL
)
break
;
taosRLockLatch
(
&
pSub
->
lock
);
if
(
numOfRows
+
pSub
->
vgNum
>
rowsCapacity
)
{
blockDataEnsureCapacity
(
pBlock
,
numOfRows
+
pSub
->
vgNum
);
}
SMqConsumerEp
*
pConsumerEp
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
taosHashIterate
(
pSub
->
consumerHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
int32_t
sz
=
taosArrayGetSize
(
pConsumerEp
->
vgs
);
for
(
int32_t
j
=
0
;
j
<
sz
;
j
++
)
{
SMqVgEp
*
pVgEp
=
taosArrayGetP
(
pConsumerEp
->
vgs
,
j
);
SColumnInfoData
*
pColInfo
;
int32_t
cols
=
0
;
// topic and cgroup
char
topic
[
TSDB_TOPIC_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
cgroup
[
TSDB_CGROUP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
mndSplitSubscribeKey
(
pSub
->
key
,
topic
,
cgroup
);
varDataSetLen
(
topic
,
strlen
(
varDataVal
(
topic
)));
varDataSetLen
(
cgroup
,
strlen
(
varDataVal
(
cgroup
)));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
topic
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
cgroup
,
false
);
// vg id
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgEp
->
vgId
,
false
);
// consumer id
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pConsumerEp
->
consumerId
,
false
);
// offset
#if 0
// subscribe time
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)&pSub->subscribeTime, false);
// rebalance time
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)&pSub->rebalanceTime, pConsumer->rebalanceTime == 0);
#endif
numOfRows
++
;
}
}
int32_t
sz
=
taosArrayGetSize
(
pSub
->
unassignedVgs
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqVgEp
*
pVgEp
=
taosArrayGetP
(
pSub
->
unassignedVgs
,
i
);
SColumnInfoData
*
pColInfo
;
int32_t
cols
=
0
;
// topic and cgroup
char
topic
[
TSDB_TOPIC_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
cgroup
[
TSDB_CGROUP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
mndSplitSubscribeKey
(
pSub
->
key
,
topic
,
cgroup
);
varDataSetLen
(
topic
,
strlen
(
varDataVal
(
topic
)));
varDataSetLen
(
cgroup
,
strlen
(
varDataVal
(
cgroup
)));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
topic
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
cgroup
,
false
);
// vg id
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgEp
->
vgId
,
false
);
// consumer id
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
NULL
,
true
);
// offset
#if 0
// subscribe time
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)&pSub->subscribeTime, false);
// rebalance time
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)&pSub->rebalanceTime, pConsumer->rebalanceTime == 0);
#endif
numOfRows
++
;
}
taosRUnLockLatch
(
&
pSub
->
lock
);
sdbRelease
(
pSdb
,
pSub
);
}
pShow
->
numOfRows
+=
numOfRows
;
return
numOfRows
;
}
static
void
mndCancelGetNextSubscribe
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
05755a28
...
...
@@ -35,6 +35,7 @@ static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pTopic, SMqTopicObj
static
int32_t
mndProcessCreateTopicReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropTopicReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropTopicInRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndRetrieveTopic
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextTopic
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
tests/script/sh/copy_udf.sh
浏览文件 @
05755a28
...
...
@@ -23,11 +23,12 @@ echo $UDF1_DIR
echo
$UDF2_DIR
UDF_TMP
=
/tmp/udf
rm
-rf
$UDF_TMP
mkdir
$UDF_TMP
rm
$UDF_TMP
/libudf1.so
rm
$UDF_TMP
/libudf2.so
echo
"Copy udf shared library files to
$UDF_TMP
"
cp
$UDF1_DIR
$UDF_TMP
cp
$UDF1_DIR
$UDF_TMP
echo
"copy udf1 result:
$?
"
cp
$UDF2_DIR
$UDF_TMP
echo
"copy udf2 result:
$?
"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录