Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
55a93c96
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看板
提交
55a93c96
编写于
2月 06, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt sma and ndex name conflict
上级
0dd4433e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
106 addition
and
4 deletion
+106
-4
source/dnode/mnode/impl/inc/mndIndexComm.h
source/dnode/mnode/impl/inc/mndIndexComm.h
+37
-0
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+9
-2
source/dnode/mnode/impl/src/mndIndexCom.c
source/dnode/mnode/impl/src/mndIndexCom.c
+51
-0
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+9
-2
未找到文件。
source/dnode/mnode/impl/inc/mndIndexComm.h
0 → 100644
浏览文件 @
55a93c96
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_MND_IDX_COMM_H_
#define _TD_MND_IDX_COMM_H_
#include "mndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SSIdx
{
int
type
;
// sma or idx
void
*
pIdx
;
}
SSIdx
;
int32_t
mndCheckIdxExist
(
SMnode
*
pMnode
,
char
*
name
,
int
type
,
SSIdx
*
idx
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_IDX_COMM_H_*/
\ No newline at end of file
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
55a93c96
...
...
@@ -17,6 +17,7 @@
#include "mndIndex.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIndexComm.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
...
...
@@ -415,8 +416,10 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq) {
mError
(
"idx:%s, failed to create since stb:%s not exist"
,
createReq
.
idxName
,
createReq
.
stbName
);
goto
_OVER
;
}
pIdx
=
mndAcquireIdx
(
pMnode
,
createReq
.
idxName
);
SSIdx
idx
=
{
0
};
if
(
mndCheckIdxExist
(
pMnode
,
createReq
.
idxName
,
SDB_IDX
,
&
idx
)
==
0
)
{
pIdx
=
idx
.
pIdx
;
}
if
(
pIdx
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_SMA_ALREADY_EXIST
;
goto
_OVER
;
...
...
@@ -880,6 +883,10 @@ int32_t mndProcessDropTagIdxReq(SRpcMsg *pReq) {
goto
_OVER
;
}
mInfo
(
"idx:%s, start to drop"
,
req
.
name
);
SSIdx
idx
=
{
0
};
if
(
mndCheckIdxExist
(
pMnode
,
req
.
name
,
SDB_IDX
,
&
idx
)
==
0
)
{
pIdx
=
idx
.
pIdx
;
}
pIdx
=
mndAcquireIdx
(
pMnode
,
req
.
name
);
if
(
pIdx
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndIndexCom.c
0 → 100644
浏览文件 @
55a93c96
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mndIndex.h"
#include "mndIndexComm.h"
#include "mndSma.h"
static
void
*
mndGetIdx
(
SMnode
*
pMnode
,
char
*
name
,
int
type
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIdx
=
sdbAcquire
(
pSdb
,
type
,
name
);
if
(
pIdx
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
0
;
}
return
pIdx
;
}
int
mndCheckIdxExist
(
SMnode
*
pMnode
,
char
*
name
,
int
type
,
SSIdx
*
idx
)
{
SSmaObj
*
pSma
=
mndGetIdx
(
pMnode
,
name
,
SDB_SMA
);
SIdxObj
*
pIdx
=
mndGetIdx
(
pMnode
,
name
,
SDB_IDX
);
if
(
pSma
==
NULL
&&
pIdx
==
NULL
)
return
0
;
if
(
pSma
!=
NULL
)
{
if
(
type
==
SDB_SMA
)
{
idx
->
type
=
SDB_SMA
;
idx
->
pIdx
=
pSma
;
}
else
{
// type == SDB_IDX
mndReleaseSma
(
pMnode
,
pSma
);
}
}
else
{
if
(
type
==
SDB_SMA
)
{
mndReleaseIdx
(
pMnode
,
pIdx
);
}
else
{
idx
->
type
=
SDB_IDX
;
idx
->
pIdx
=
pIdx
;
}
}
return
0
;
}
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
55a93c96
...
...
@@ -18,6 +18,7 @@
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIndex.h"
#include "mndIndexComm.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
...
...
@@ -735,8 +736,11 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
terrno
=
TSDB_CODE_MND_STREAM_ALREADY_EXIST
;
goto
_OVER
;
}
SSIdx
idx
=
{
0
};
if
(
mndCheckIdxExist
(
pMnode
,
createReq
.
name
,
SDB_SMA
,
&
idx
)
==
0
)
{
pSma
=
idx
.
pIdx
;
}
pSma
=
mndAcquireSma
(
pMnode
,
createReq
.
name
);
if
(
pSma
!=
NULL
)
{
if
(
createReq
.
igExists
)
{
mInfo
(
"sma:%s, already exist in sma:%s, ignore exist is set"
,
createReq
.
name
,
pSma
->
name
);
...
...
@@ -982,7 +986,10 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
mInfo
(
"sma:%s, start to drop"
,
dropReq
.
name
);
pSma
=
mndAcquireSma
(
pMnode
,
dropReq
.
name
);
SSIdx
idx
=
{
0
};
if
(
mndCheckIdxExist
(
pMnode
,
dropReq
.
name
,
SDB_SMA
,
&
idx
)
==
0
)
{
pSma
=
idx
.
pIdx
;
}
if
(
pSma
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
mInfo
(
"sma:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录