Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eafc9db1
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,发现更多精彩内容 >>
提交
eafc9db1
编写于
2月 18, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix iter and case
上级
51755e97
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
86 addition
and
38 deletion
+86
-38
source/dnode/mnode/impl/inc/mndIndexComm.h
source/dnode/mnode/impl/inc/mndIndexComm.h
+6
-0
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+12
-10
source/dnode/mnode/impl/src/mndIndexCom.c
source/dnode/mnode/impl/src/mndIndexCom.c
+1
-1
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+34
-25
tests/script/tsim/tagindex/sma_and_tag_index.sim
tests/script/tsim/tagindex/sma_and_tag_index.sim
+33
-2
未找到文件。
source/dnode/mnode/impl/inc/mndIndexComm.h
浏览文件 @
eafc9db1
...
...
@@ -28,6 +28,12 @@ typedef struct SSIdx {
void
*
pIdx
;
}
SSIdx
;
// retrieve sma index and tag index
typedef
struct
{
void
*
pSmaIter
;
void
*
pIdxIter
;
}
SSmaAndTagIter
;
int32_t
mndAcquireGlobalIdx
(
SMnode
*
pMnode
,
char
*
name
,
int
type
,
SSIdx
*
idx
);
#ifdef __cplusplus
...
...
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
eafc9db1
...
...
@@ -43,9 +43,9 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq);
// static int32_t mndProcessDropIdxReq(SRpcMsg *pReq);
static
int32_t
mndProcessGetIdxReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessGetTbIdxReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextIdx
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndDestroyIdxObj
(
SIdxObj
*
pIdxObj
);
//
static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
//
static void mndCancelGetNextIdx(SMnode *pMnode, void *pIter);
static
void
mndDestroyIdxObj
(
SIdxObj
*
pIdxObj
);
static
int32_t
mndAddIndex
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SCreateTagIndexReq
*
req
,
SDbObj
*
pDb
,
SStbObj
*
pStb
);
...
...
@@ -496,10 +496,11 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
}
int
invalid
=
-
1
;
SSmaAndTagIter
*
pIter
=
pShow
->
pIter
;
int
invalid
=
-
1
;
while
(
numOfRows
<
rows
)
{
p
Show
->
pIter
=
sdbFetch
(
pSdb
,
SDB_IDX
,
pShow
->
p
Iter
,
(
void
**
)
&
pIdx
);
if
(
p
Show
->
p
Iter
==
NULL
)
break
;
p
Iter
->
pIdxIter
=
sdbFetch
(
pSdb
,
SDB_IDX
,
pIter
->
pIdx
Iter
,
(
void
**
)
&
pIdx
);
if
(
p
Iter
->
pIdx
Iter
==
NULL
)
break
;
if
(
NULL
!=
pDb
&&
pIdx
->
dbUid
!=
pDb
->
uid
)
{
sdbRelease
(
pSdb
,
pIdx
);
...
...
@@ -559,10 +560,11 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
return
numOfRows
;
}
static
void
mndCancelGetNextIdx
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
// static void mndCancelGetNextIdx(SMnode *pMnode, void *pIter) {
// SSdb *pSdb = pMnode->pSdb;
//
// sdbCancelFetch(pSdb, pIter);
//}
static
int32_t
mndCheckIndexReq
(
SCreateTagIndexReq
*
pReq
)
{
// impl
return
TSDB_CODE_SUCCESS
;
...
...
source/dnode/mnode/impl/src/mndIndexCom.c
浏览文件 @
eafc9db1
...
...
@@ -38,7 +38,7 @@ int mndAcquireGlobalIdx(SMnode *pMnode, char *name, int type, SSIdx *idx) {
if
(
type
==
SDB_SMA
)
{
idx
->
type
=
SDB_SMA
;
idx
->
pIdx
=
pSma
;
}
else
{
// type == SDB_IDX
}
else
{
mndReleaseSma
(
pMnode
,
pSma
);
terrno
=
TSDB_CODE_MND_SMA_ALREADY_EXIST
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
eafc9db1
...
...
@@ -45,27 +45,13 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq);
static
int32_t
mndProcessGetSmaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessGetTbSmaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveSma
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndDestroySmaObj
(
SSmaObj
*
pSmaObj
);
// retrieve sma index and tag index
static
int32_t
mndRetrieveIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
int32_t
read
=
mndRetrieveSma
(
pReq
,
pShow
,
pBlock
,
rows
);
read
+=
mndRetrieveTagIdx
(
pReq
,
pShow
,
pBlock
,
rows
-
read
);
return
read
;
}
// sma and tag index comm func
static
int32_t
mndProcessDropIdxReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelRetrieveIdx
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessDropIdxReq
(
SRpcMsg
*
pReq
)
{
int
ret
=
mndProcessDropSmaReq
(
pReq
);
if
(
terrno
==
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
)
{
terrno
=
0
;
ret
=
mndProcessDropTagIdxReq
(
pReq
);
}
return
ret
;
}
static
void
mndCancelGetNextIdx
(
SMnode
*
pMnode
,
void
*
pIter
)
{
// TODO
}
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
.
sdbType
=
SDB_SMA
,
...
...
@@ -85,7 +71,7 @@ int32_t mndInitSma(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_TABLE_INDEX
,
mndProcessGetTbSmaReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndRetrieveIdx
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancel
GetNext
Idx
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancel
Retrieve
Idx
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -1244,10 +1230,10 @@ static int32_t mndRetrieveSma(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
}
SSmaAndTagIter
*
pIter
=
pShow
->
pIter
;
while
(
numOfRows
<
rows
)
{
p
Show
->
pIter
=
sdbFetch
(
pSdb
,
SDB_SMA
,
pShow
->
p
Iter
,
(
void
**
)
&
pSma
);
if
(
p
Show
->
p
Iter
==
NULL
)
break
;
p
Iter
->
pSmaIter
=
sdbFetch
(
pSdb
,
SDB_SMA
,
pIter
->
pSma
Iter
,
(
void
**
)
&
pSma
);
if
(
p
Iter
->
pSma
Iter
==
NULL
)
break
;
if
(
NULL
!=
pDb
&&
pSma
->
dbUid
!=
pDb
->
uid
)
{
sdbRelease
(
pSdb
,
pSma
);
...
...
@@ -1305,7 +1291,30 @@ static int32_t mndRetrieveSma(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
return
numOfRows
;
}
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
// sma and tag index comm func
static
int32_t
mndProcessDropIdxReq
(
SRpcMsg
*
pReq
)
{
int
ret
=
mndProcessDropSmaReq
(
pReq
);
if
(
terrno
==
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
)
{
terrno
=
0
;
ret
=
mndProcessDropTagIdxReq
(
pReq
);
}
return
ret
;
}
static
int32_t
mndRetrieveIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
if
(
pShow
->
pIter
==
NULL
)
{
pShow
->
pIter
=
taosMemoryCalloc
(
1
,
sizeof
(
SSmaAndTagIter
));
}
int32_t
read
=
mndRetrieveSma
(
pReq
,
pShow
,
pBlock
,
rows
);
if
(
read
<
rows
)
read
+=
mndRetrieveTagIdx
(
pReq
,
pShow
,
pBlock
,
rows
-
read
);
return
read
;
}
static
void
mndCancelRetrieveIdx
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSmaAndTagIter
*
p
=
pIter
;
if
(
p
!=
NULL
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
p
->
pSmaIter
);
sdbCancelFetch
(
pSdb
,
p
->
pIdxIter
);
}
taosMemoryFree
(
p
);
}
tests/script/tsim/tagindex/sma_and_tag_index.sim
浏览文件 @
eafc9db1
...
...
@@ -48,19 +48,50 @@ while $i < $tbNum
endw
print
-->
create sma and tag index, global name conflict
print
====
create sma and tag index, global name conflict
sql create sma index t2i on $mtPrefix function(max(c1)) interval(6m,10s) sliding(6m);
sql_error create index t2i on $mtPrefix (t2)
sql drop index t2i
#print -->
create tagindex and sma index, global name conflict
print ====
create tagindex and sma index, global name conflict
sql create index t2i on $mtPrefix (t2)
sql_error create sma index t2i on $mtPrefix function(max(c1)) interval(6m,10s) sliding(6m);
sql drop index t2i
print ===== iter sma and tag index
sql create index tagt2i on $mtPrefix (t2)
sql create sma index smat2i on $mtPrefix function(max(c1)) interval(6m,10s) sliding(6m);
sql select * from information_schema.ins_indexes
if $rows != 2 then
return -1
endi
sql drop index smat2i
$i = 0
$smaPre = sma3
while $i < 5000
$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
return -1
endi
print ==== test name conflict
sql_error create index ti3 on $mtPrefix(t2)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录