Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
53155002
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看板
提交
53155002
编写于
2月 09, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix filter error
上级
5fd971bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
123 addition
and
10 deletion
+123
-10
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+4
-0
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+2
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-1
tests/script/tsim/tagindex/add_index.sim
tests/script/tsim/tagindex/add_index.sim
+116
-7
未找到文件。
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
53155002
...
...
@@ -823,7 +823,11 @@ static int32_t mndAddIndex(SMnode *pMnode, SRpcMsg *pReq, SCreateTagIndexReq *re
if
(
tag
<
0
)
{
terrno
=
TSDB_CODE_MND_TAG_NOT_EXIST
;
return
-
1
;
}
else
if
(
tag
==
0
)
{
terrno
=
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
;
return
-
1
;
}
col_id_t
colId
=
pStb
->
pTags
[
tag
].
colId
;
if
(
mndCheckColAndTagModifiable
(
pMnode
,
pStb
->
name
,
pStb
->
uid
,
colId
)
!=
0
)
{
return
-
1
;
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
53155002
...
...
@@ -452,7 +452,7 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
}
}
if
(
diffIdx
==
-
1
)
{
if
(
diffIdx
==
-
1
&&
diffIdx
==
0
)
{
goto
_err
;
}
...
...
@@ -566,7 +566,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
for
(
int
i
=
0
;
i
<
oStbEntry
.
stbEntry
.
schemaTag
.
nCols
;
i
++
)
{
SSchema
*
schema
=
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
+
i
;
if
(
0
==
strncmp
(
schema
->
name
,
pReq
->
colName
,
sizeof
(
pReq
->
colName
)))
{
if
(
IS_IDX_ON
(
schema
))
{
if
(
i
!=
0
||
IS_IDX_ON
(
schema
))
{
pCol
=
schema
;
}
break
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
53155002
...
...
@@ -784,7 +784,7 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p
pCol
->
tableType
=
pTable
->
pMeta
->
tableType
;
pCol
->
colId
=
pColSchema
->
colId
;
pCol
->
colType
=
(
tagFlag
>=
0
?
COLUMN_TYPE_TAG
:
COLUMN_TYPE_COLUMN
);
pCol
->
hasIndex
=
IS_IDX_ON
(
pColSchema
);
pCol
->
hasIndex
=
((
0
==
tagFlag
)
||
(
pColSchema
!=
NULL
&&
IS_IDX_ON
(
pColSchema
))
);
pCol
->
node
.
resType
.
type
=
pColSchema
->
type
;
pCol
->
node
.
resType
.
bytes
=
pColSchema
->
bytes
;
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
pCol
->
node
.
resType
.
type
)
{
...
...
tests/script/tsim/tagindex/add_index.sim
浏览文件 @
53155002
...
...
@@ -43,14 +43,25 @@ print =============== insert data into each table
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql insert into $tb values(now,
10
);
sql insert into $tb values(now,
$i
);
$i = $i + 1
endw
sql create index ti2 on $mtPrefix (t2)
# equal
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)
print ===== test operator equal
$i = 0
while $i < $tbNum
sql select * from $mtPrefix where t2= $i ;
...
...
@@ -60,6 +71,9 @@ while $i < $tbNum
$i = $i + 1
endw
print ===== test operator great equal
# great equal than
$i = 0
while $i < $tbNum
...
...
@@ -71,21 +85,19 @@ while $i < $tbNum
$i = $i + 1
endw
# great than
print ===== test operator great
$i = 0
while $i < $tbNum
sql select * from $mtPrefix where t2 > $i ;
$tmp = $tbNum - $i
$tmp = $tmp - 1
if $rows != $tmp then
print $rows
print $i
print $tmp
return -1
endi
$i = $i + 1
endw
# lower equal than
print ===== test operator lower
$i = 0
while $i < $tbNum
sql select * from $mtPrefix where t2 <= $i ;
...
...
@@ -96,6 +108,7 @@ while $i < $tbNum
$i = $i + 1
endw
print ===== test operator lower than
# lower equal than
$i = 0
while $i < $tbNum
...
...
@@ -107,9 +120,105 @@ while $i < $tbNum
$i = $i + 1
endw
print ===== add table after index created
$interval = $tbNum + $tbNum
$i = $interval
$limit = $interval + $tbNum
while $i < $limit
$tb = $tbPrefix . $i
sql insert into $tb using $mtPrefix tags( $i , $i , $i , $i , $i ) values( now, $i )
$i = $i + 1
endw
print ===== add table after index created (opeator great equal than)
# great equal than
$i = $interval
while $i < $limit
sql select * from $mtPrefix where t2 >= $i ;
$tmp = $limit - $i
if $rows != $tmp then
return -1
endi
$i = $i + 1
endw
print ===== add table after index created (opeator great than)
# great than
$i = $interval
while $i < $limit
sql select * from $mtPrefix where t2 > $i ;
$tmp = $limit - $i
$tmp = $tmp - 1
if $rows != $tmp then
return -1
endi
$i = $i + 1
endw
print ===== drop table after index created
# drop table
$dropTbNum = $tbNum / 2
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql drop table $tb
$i = $i + 1
endw
print ===== drop table after index created(opeator lower than)
# lower equal than
$i = $interval
while $i < $limit
sql select * from $mtPrefix where t2 < $i ;
$tmp = $i - $interval
if $rows != $tmp then
return -1
endi
$i = $i + 1
endw
print ===== drop table after index created(opeator lower equal than)
# lower equal than
$i = $interval
while $i < $limit
sql select * from $mtPrefix where t2 <= $i ;
$tmp = $i - $interval
$tmp = $tmp + 1
if $rows != $tmp then
return -1
endi
$i = $i + 1
endw
print === show index
sql select * from information_schema.ins_indexes
if $rows != 1 then
return -1
endi
print === drop index ti2
sql drop index ti2
print === drop not exist index
sql_error drop index t2
sql_error drop index t3
sql_error create index ti0 on $mtPrefix (t1)
sql_error create index t2i on ta_3_tb17 (t2)
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录