Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c8bdd984
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
c8bdd984
编写于
7月 22, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: modifying stb in subscription is not allowed
上级
74a57ebb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
9 deletion
+18
-9
source/dnode/mnode/impl/inc/mndTopic.h
source/dnode/mnode/impl/inc/mndTopic.h
+1
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+5
-5
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+12
-3
未找到文件。
source/dnode/mnode/impl/inc/mndTopic.h
浏览文件 @
c8bdd984
...
...
@@ -37,7 +37,7 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
int32_t
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
col_id_t
colId
);
int32_t
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
const
char
*
stbname
,
int64_t
suid
,
col_id_t
colId
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
c8bdd984
...
...
@@ -1144,7 +1144,7 @@ static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj
}
col_id_t
colId
=
pOld
->
pTags
[
tag
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
uid
,
colId
)
!=
0
)
{
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
name
,
pOld
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -1179,7 +1179,7 @@ static int32_t mndAlterStbTagName(SMnode *pMnode, const SStbObj *pOld, SStbObj *
}
col_id_t
colId
=
pOld
->
pTags
[
tag
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
uid
,
colId
)
!=
0
)
{
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
name
,
pOld
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -1213,7 +1213,7 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj
}
col_id_t
colId
=
pOld
->
pTags
[
tag
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
uid
,
colId
)
!=
0
)
{
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
name
,
pOld
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -1295,7 +1295,7 @@ static int32_t mndDropSuperTableColumn(SMnode *pMnode, const SStbObj *pOld, SStb
}
col_id_t
colId
=
pOld
->
pColumns
[
col
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
uid
,
colId
)
!=
0
)
{
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
name
,
pOld
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -1329,7 +1329,7 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
}
col_id_t
colId
=
pOld
->
pColumns
[
col
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
uid
,
colId
)
!=
0
)
{
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pOld
->
name
,
pOld
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
c8bdd984
...
...
@@ -72,13 +72,16 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
return
strchr
(
topic
,
'.'
)
+
1
;
}
int32_t
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
col_id_t
colId
)
{
int32_t
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
const
char
*
stbname
,
int64_t
suid
,
col_id_t
colId
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SMqTopicObj
*
pTopic
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pIter
,
(
void
**
)
&
pTopic
);
if
(
pIter
==
NULL
)
break
;
mDebug
(
"topic:%s, check tag and column modifiable, stb:%s suid:%"
PRId64
" colId:%d, subType:%d sql:%s"
,
pTopic
->
name
,
stbname
,
suid
,
colId
,
pTopic
->
subType
,
pTopic
->
sql
);
if
(
pTopic
->
subType
!=
TOPIC_SUB_TYPE__COLUMN
)
{
sdbRelease
(
pSdb
,
pTopic
);
continue
;
...
...
@@ -95,14 +98,20 @@ int32_t mndCheckColAndTagModifiable(SMnode *pMnode, int64_t suid, col_id_t colId
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
pCol
->
tableId
!=
suid
&&
pTopic
->
ctbStbUid
!=
suid
)
goto
NEXT
;
mDebug
(
"topic:%s, check colId:%d tableId:%"
PRId64
" ctbStbUid:%"
PRId64
,
pTopic
->
name
,
pCol
->
colId
,
pCol
->
tableId
,
pTopic
->
ctbStbUid
);
if
(
pCol
->
tableId
!=
suid
&&
pTopic
->
ctbStbUid
!=
suid
)
{
mDebug
(
"topic:%s, check colId:%d passed"
,
pTopic
->
name
,
pCol
->
colId
);
goto
NEXT
;
}
if
(
pCol
->
colId
>
0
&&
pCol
->
colId
==
colId
)
{
sdbRelease
(
pSdb
,
pTopic
);
nodesDestroyNode
(
pAst
);
terrno
=
TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC
;
mError
(
"topic:%s, check colId:%d conflicted"
,
pTopic
->
name
,
pCol
->
colId
);
return
-
1
;
}
m
Trace
(
"topic:%s, colId:%d is u
sed"
,
pTopic
->
name
,
pCol
->
colId
);
m
Debug
(
"topic:%s, check colId:%d pas
sed"
,
pTopic
->
name
,
pCol
->
colId
);
}
NEXT:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录