Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bfe0ac61
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bfe0ac61
编写于
2月 19, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add index case
上级
eafc9db1
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
740 addition
and
23 deletion
+740
-23
.gitignore
.gitignore
+1
-0
gdb.txt
gdb.txt
+646
-0
source/dnode/mnode/impl/inc/mndIndex.h
source/dnode/mnode/impl/inc/mndIndex.h
+2
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-0
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+69
-10
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+6
-1
tests/script/tsim/tagindex/sma_and_tag_index.sim
tests/script/tsim/tagindex/sma_and_tag_index.sim
+14
-11
未找到文件。
.gitignore
浏览文件 @
bfe0ac61
...
...
@@ -130,3 +130,4 @@ tools/COPYING
tools/BUGS
tools/taos-tools
tools/taosws-rs
tags
gdb.txt
0 → 100644
浏览文件 @
bfe0ac61
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/inc/mndIndex.h
浏览文件 @
bfe0ac61
...
...
@@ -13,7 +13,8 @@ SIdxObj *mndAcquireIdx(SMnode *pMnode, char *Name);
void
mndReleaseIdx
(
SMnode
*
pMnode
,
SIdxObj
*
pSma
);
int32_t
mndDropIdxsByStb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
);
int32_t
mndDropIdxsByDb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
);
int32_t
mndGetTableIdx
(
SMnode
*
pMnode
,
char
*
tbFName
,
STableIndexRsp
*
rsp
,
bool
*
exist
);
// int32_t mndDropIdxsByTagName(SMnode *pMnode, SStbObj *pStb, char *tagName);
int32_t
mndGetTableIdx
(
SMnode
*
pMnode
,
char
*
tbFName
,
STableIndexRsp
*
rsp
,
bool
*
exist
);
int32_t
mndRetrieveTagIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
int32_t
mndProcessDropTagIdxReq
(
SRpcMsg
*
pReq
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
bfe0ac61
...
...
@@ -17,6 +17,7 @@
#include "mndDb.h"
#include "mndCluster.h"
#include "mndDnode.h"
#include "mndIndex.h"
#include "mndPrivilege.h"
#include "mndShow.h"
#include "mndSma.h"
...
...
@@ -1053,6 +1054,7 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
/*if (mndDropTopicByDB(pMnode, pTrans, pDb) != 0) goto _OVER;*/
if
(
mndDropStreamByDb
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndDropSmasByDb
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndDropIdxsByDb
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropDbRedoActions
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndUserRemoveDb
(
pMnode
,
pTrans
,
pDb
->
name
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
bfe0ac61
...
...
@@ -469,16 +469,6 @@ static int32_t mndSetDropIdxCommitLogs(SMnode *pMnode, STrans *pTrans, SIdxObj *
return
0
;
}
int32_t
mndDropIdxsByStb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
// stb
return
0
;
}
int32_t
mndDropIdxsByDb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
// by db name
return
0
;
}
static
int32_t
mndProcessGetTbIdxReq
(
SRpcMsg
*
pReq
)
{
//
return
0
;
...
...
@@ -791,3 +781,72 @@ static int32_t mndProcessGetIdxReq(SRpcMsg *pReq) {
// do nothing
return
0
;
}
int32_t
mndDropIdxsByStb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SIdxObj
*
pIdx
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_IDX
,
pIter
,
(
void
**
)
&
pIdx
);
if
(
pIter
==
NULL
)
break
;
if
(
pIdx
->
stbUid
==
pStb
->
uid
)
{
if
(
mndSetDropIdxCommitLogs
(
pMnode
,
pTrans
,
pIdx
)
!=
0
)
{
sdbRelease
(
pSdb
,
pIdx
);
sdbCancelFetch
(
pSdb
,
pIdx
);
return
-
1
;
}
}
sdbRelease
(
pSdb
,
pIdx
);
}
return
0
;
}
/*
int32_t mndDropIdxsByTagName(SMnode *pMnode, SStbObj *pStb, char *tagName) {
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
while (1) {
SIdxObj *pIdx = NULL;
pIter = sdbFetch(pSdb, SDB_IDX, pIter, (void **)&pIdx);
if (pIter == NULL) break;
if (pIdx->stbUid == pStb->uid && strcasecmp(pIdx->colName, tagName) == 0) {
if (mndSetDropIdxCommitLogs(pMnode, pTrans, pIdx) != 0) {
sdbRelease(pSdb, pIdx);
sdbCancelFetch(pSdb, pIdx);
return -1;
}
}
sdbRelease(pSdb, pIdx);
}
return 0;
}*/
int32_t
mndDropIdxsByDb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SIdxObj
*
pIdx
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_IDX
,
pIter
,
(
void
**
)
&
pIdx
);
if
(
pIter
==
NULL
)
break
;
if
(
pIdx
->
dbUid
==
pDb
->
uid
)
{
if
(
mndSetDropIdxCommitLogs
(
pMnode
,
pTrans
,
pIdx
)
!=
0
)
{
sdbRelease
(
pSdb
,
pIdx
);
sdbCancelFetch
(
pSdb
,
pIdx
);
return
-
1
;
}
}
sdbRelease
(
pSdb
,
pIdx
);
}
return
0
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
bfe0ac61
...
...
@@ -17,6 +17,7 @@
#include "mndStb.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIndex.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPerfSchema.h"
...
...
@@ -1358,6 +1359,10 @@ static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj
pNew
->
numOfTags
--
;
pNew
->
tagVer
++
;
// if (mndDropIndexByTag(pMnode, pOld, tagName) != 0) {
// return -1;
// }
mInfo
(
"stb:%s, start to drop tag %s"
,
pNew
->
name
,
tagName
);
return
0
;
}
...
...
@@ -2120,9 +2125,9 @@ static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *p
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndDropIdxsByStb
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndDropSmasByStb
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
_OVER:
...
...
tests/script/tsim/tagindex/sma_and_tag_index.sim
浏览文件 @
bfe0ac61
...
...
@@ -76,30 +76,33 @@ sql drop index smat2i
$i = 0
$smaPre = sma3
while $i < 5
000
while $i < 5
$sma = $smaPre . $i
$i = $i + 1
sql create sma index $sma on $mtPrefix function(max(c1)) interval(6m,10s) sliding(6m);
endw
sql select * from information_schema.ins_indexes
if $rows !=
5001
then
if $rows !=
6
then
return -1
endi
sql drop stable $mtPrefix
sql select * from information_schema.ins_indexes
if $rows != 0 then
return -1
endi
sql create table if not exists $mtPrefix (ts timestamp, c1 int) tags (t1 int, t2 int, t3 int, t4 int, t5 int)
sql create index tagt2i on $mtPrefix (t2)
sql drop database $dbPrefix
print ==== test name conflict
sql_error create index ti3 on $mtPrefix(t2)
sql_error create index ti2 on $mtPrefix(t2)
sql_error create index ti2 on $mtPrefix(t1)
sql_error create index ti2 on $mtPrefix(t3)
sql_error create index ti2 on $mtPrefix(txx)
sql select * from information_schema.ins_indexes
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录